mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
fix(coding-agent): shorten Anthropic thinking drop notices
This commit is contained in:
parent
5a3a03a7f5
commit
4658534986
2 changed files with 20 additions and 12 deletions
|
|
@ -3828,20 +3828,18 @@ export class InteractiveMode {
|
|||
const transformations = diagnostic.details?.transformations;
|
||||
if (!Array.isArray(transformations)) continue;
|
||||
|
||||
const dropped = transformations.flatMap((transformation): string[] => {
|
||||
if (typeof transformation !== "object" || transformation === null) return [];
|
||||
const details = transformation as Record<string, unknown>;
|
||||
if (details.type !== "thinking_dropped") return [];
|
||||
const reason = typeof details.reason === "string" ? details.reason : "unknown reason";
|
||||
const location = typeof details.path === "string" ? ` at ${details.path}` : "";
|
||||
return [`${reason}${location}`];
|
||||
});
|
||||
if (dropped.length === 0) continue;
|
||||
const droppedCount = transformations.filter(
|
||||
(transformation) =>
|
||||
typeof transformation === "object" &&
|
||||
transformation !== null &&
|
||||
(transformation as Record<string, unknown>).type === "thinking_dropped",
|
||||
).length;
|
||||
if (droppedCount === 0) continue;
|
||||
|
||||
const noun = dropped.length === 1 ? "thinking block" : `${dropped.length} thinking blocks`;
|
||||
const noun = droppedCount === 1 ? "1 thinking block" : `${droppedCount} thinking blocks`;
|
||||
this.chatContainer.addChild(new Spacer(1));
|
||||
this.chatContainer.addChild(
|
||||
new Text(theme.fg("warning", `Anthropic dropped ${noun}: ${dropped.join("; ")}`), 1, 0),
|
||||
new Text(theme.fg("warning", `Anthropic dropped ${noun} (details in session)`), 1, 0),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,16 @@ const message: AssistantMessage = {
|
|||
path: "messages.2.content.0",
|
||||
reason: "prefix_binding_mismatch",
|
||||
},
|
||||
{
|
||||
type: "thinking_dropped",
|
||||
path: "messages.5.content.0",
|
||||
reason: "prefix_binding_mismatch",
|
||||
},
|
||||
{
|
||||
type: "thinking_dropped",
|
||||
path: "messages.8.content.0",
|
||||
reason: "prefix_binding_mismatch",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
@ -55,7 +65,7 @@ describe("InteractiveMode assistant diagnostics", () => {
|
|||
};
|
||||
maybeShowAssistantDiagnostics.call(enabled, message);
|
||||
const output = stripAnsi(enabled.chatContainer.render(120).join("\n"));
|
||||
expect(output).toContain("Anthropic dropped thinking block: prefix_binding_mismatch at messages.2.content.0");
|
||||
expect(output).toContain("Anthropic dropped 3 thinking blocks (details in session)");
|
||||
|
||||
const disabled = {
|
||||
chatContainer: new Container(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue