chore(vendor): import pi 1.3.0
Imported as a linear vendor commit so forge rebases do not replay the upstream root tree. git-subtree-dir: third_party/pi git-subtree-split: 71023aec1546d6d677a65669c5665c0927ce0dd0
This commit is contained in:
@@ -32,36 +32,64 @@ 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",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
type NoticeContext = {
|
||||
chatContainer: Container;
|
||||
settingsManager: { getShowCacheMissNotices(): boolean };
|
||||
sessionManager: { getBranch(): Array<{ type: "message"; message: AssistantMessage }> };
|
||||
};
|
||||
|
||||
const maybeShowThinkingDropNotice = Reflect.get(InteractiveMode.prototype, "maybeShowThinkingDropNotice") as (
|
||||
this: NoticeContext,
|
||||
message: AssistantMessage,
|
||||
) => void;
|
||||
|
||||
describe("InteractiveMode assistant diagnostics", () => {
|
||||
test("shows Anthropic thinking drops when cache miss notices are enabled", () => {
|
||||
const maybeShowAssistantDiagnostics = Reflect.get(InteractiveMode.prototype, "maybeShowAssistantDiagnostics") as (
|
||||
this: {
|
||||
chatContainer: Container;
|
||||
settingsManager: { getShowCacheMissNotices(): boolean };
|
||||
},
|
||||
message: AssistantMessage,
|
||||
) => void;
|
||||
|
||||
initTheme("dark");
|
||||
const enabled = {
|
||||
chatContainer: new Container(),
|
||||
settingsManager: { getShowCacheMissNotices: () => true },
|
||||
sessionManager: { getBranch: () => [] },
|
||||
};
|
||||
maybeShowAssistantDiagnostics.call(enabled, message);
|
||||
maybeShowThinkingDropNotice.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(),
|
||||
settingsManager: { getShowCacheMissNotices: () => false },
|
||||
sessionManager: { getBranch: () => [] },
|
||||
};
|
||||
maybeShowAssistantDiagnostics.call(disabled, message);
|
||||
maybeShowThinkingDropNotice.call(disabled, message);
|
||||
expect(disabled.chatContainer.children).toHaveLength(0);
|
||||
});
|
||||
|
||||
test("does not repeat unchanged Anthropic thinking drops", () => {
|
||||
initTheme("dark");
|
||||
const context = {
|
||||
chatContainer: new Container(),
|
||||
settingsManager: { getShowCacheMissNotices: () => true },
|
||||
sessionManager: { getBranch: () => [{ type: "message" as const, message }] },
|
||||
};
|
||||
|
||||
maybeShowThinkingDropNotice.call(context, { ...message, timestamp: 2 });
|
||||
|
||||
expect(context.chatContainer.children).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user