fix(coding-agent/advisor): fixed collapsed advisor notes to wrap instead of two-line truncation

- Removed the collapsed-mode truncation branch that forced advisor message cards to restrict bodies to two lines.
- Added a regression test covering long collapsed advisor notes to ensure they wrap at narrow widths instead of being cut short.
- Updated the package changelog to document the collapsed advisor note wrapping fix.
This commit is contained in:
can1357
2026-06-15 16:54:20 +02:00
parent c6fd50b8e6
commit ecccff62f3
3 changed files with 12 additions and 5 deletions
+1
View File
@@ -22,6 +22,7 @@
- Session dump output now renders message history using the model's native dialect turn envelope instead of markdown role headings
### Fixed
- Fixed advisor message card notes getting truncated to two lines when the card is collapsed.
- Fixed advisor context handling to automatically maintain its token budget by promoting the advisor model or compacting/restarting advisor context when needed, preventing advice from degrading on long sessions
- Fixed `startup.quiet` leaving MCP and LSP startup status events visible during launch ([#2639](https://github.com/can1357/oh-my-pi/issues/2639)).
@@ -332,5 +332,15 @@ describe("advisor", () => {
const text = strip(card.render(30));
expect(text).toContain("truncated.");
});
it("wraps long notes even when the message card is collapsed", async () => {
const uiTheme = await getThemeByName("dark");
if (!uiTheme) throw new Error("theme unavailable");
const note =
"This is a very long advisor note that will definitely exceed the restricted width constraint of thirty characters and should therefore wrap across multiple lines rather than getting truncated.";
const card = createAdvisorMessageCard({ notes: [{ note, severity: "concern" }] }, () => false, uiTheme);
const text = strip(card.render(30));
expect(text).toContain("truncated.");
});
});
});
@@ -73,7 +73,7 @@ export function createAdvisorMessageCard(
const w2 = Math.max(10, Math.min(NOTE_LINE_WIDTH, width) - quoteWidth);
const paragraphs = entry.note.split("\n").filter(p => p.trim());
let bodyLines: string[] = [];
const bodyLines: string[] = [];
for (let i = 0; i < paragraphs.length; i++) {
const p = paragraphs[i];
if (i === 0) {
@@ -83,10 +83,6 @@ export function createAdvisorMessageCard(
}
}
if (!expanded && bodyLines.length > 2) {
bodyLines = [bodyLines[0], truncateToWidth(bodyLines.slice(1).join(" "), w2, Ellipsis.Unicode)];
}
bodyLines.forEach((line, index) => {
const prefix = index === 0 ? badge : "";
lines.push(` ${quote} ${prefix}${uiTheme.fg("toolOutput", replaceTabs(line))}`);