Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions packages/plugin/src/hooks/magic-context/strip-content.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,26 @@ describe("strip-content", () => {
});
});
});

describe("#given assistant messages with redacted thinking parts", () => {
describe("#when stripping cleared reasoning", () => {
it("#then preserves redacted thinking blocks unchanged", () => {
const redactedPart = {
type: "redacted_thinking",
data: "opaque-provider-payload",
};
const textPart = { type: "text", text: "visible response" };
const msg = message("m-1", "assistant", [redactedPart, textPart]);

const stripped = stripClearedReasoning([msg]);

expect(stripped).toBe(0);
expect(msg.parts).toHaveLength(2);
expect(msg.parts[0]).toBe(redactedPart);
expect(msg.parts[1]).toBe(textPart);
});
});
});
});

describe("stripInlineThinking", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/hooks/magic-context/strip-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ function findMaxTag(messageTagNumbers: Map<MessageLike, number>): number {
return max;
}

const CLEARED_REASONING_TYPES = new Set(["thinking", "reasoning", "redacted_thinking"]);
const CLEARED_REASONING_TYPES = new Set(["thinking", "reasoning"]);

export function stripClearedReasoning(messages: MessageLike[]): number {
let stripped = 0;
Expand Down
Loading