Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Commit 84f149c

Browse files
fix(core): prefer streamed plan content
Generated-By: PostHog Code Task-Id: c1bbe3cf-742b-4b24-bf96-d11a18b4cf22
1 parent edb0ae3 commit 84f149c

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

packages/core/src/sessions/planApprovalPresentation.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ describe("extractPlanText", () => {
1818
expect(extractPlanText(toolCall)).toBe(expected);
1919
});
2020

21-
it("prefers the canonical raw plan over rendered content", () => {
21+
it("prefers streamed content over stale raw input", () => {
2222
expect(
2323
extractPlanText({
2424
rawInput: { plan: "Canonical" },
2525
content: [{ text: "Rendered" }],
2626
}),
27-
).toBe("Canonical");
27+
).toBe("Rendered");
2828
});
2929
});

packages/core/src/sessions/planApprovalPresentation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ export function extractPlanText(toolCall: {
1212
rawInput?: { plan?: unknown } | null;
1313
content?: readonly unknown[] | null;
1414
}): string | null {
15-
const rawPlan = toolCall.rawInput?.plan;
16-
if (typeof rawPlan === "string" && rawPlan.trim()) return rawPlan;
17-
1815
for (const item of toolCall.content ?? []) {
1916
const text = extractTextContent(item);
2017
if (text?.trim()) return text;
2118
}
19+
20+
const rawPlan = toolCall.rawInput?.plan;
21+
if (typeof rawPlan === "string" && rawPlan.trim()) return rawPlan;
2222
return null;
2323
}

0 commit comments

Comments
 (0)