Skip to content

Commit 0bd81a2

Browse files
authored
Open Plan approval forms automatically (#4929)
## Human comments ## What was wrong Plan approval cards started collapsed, hiding both the plan and the decision buttons. A thread could be waiting for approval while showing only a small “Plan review” strip above the composer. ## What changed Open Plan approval cards automatically, matching the existing question behavior. Users can still collapse the card, and each new plan request starts expanded. Ordinary command approvals retain their current collapsed default. No CLI, SDK, server/daemon wire, or protocol changes. ## How you verified The expanded-default and next-plan regression tests fail on origin/main before the fix and pass afterward. `pnpm exec turbo run test --filter=@bb/app -- src/components/thread/pending-interactions` passes all 17 tests; app lint and typecheck pass (lint has existing warnings). In an isolated built BB app, use real Claude Code to request a Plan approval. The base build shows the collapsed strip; the changed build opens the plan and decisions automatically. Browser checks cover manual collapse/reopen and a compact viewport; clicking Approve plan resolves the actual server interaction and Claude replies APPROVED. A fresh pending plan is retained privately for review. Matching before/after captures use the same prompt and viewport in separate real threads because stopping the base server cancelled its pending interaction. The first CI run exposed a workspace route budget overage also reproduced on unchanged main: both builds contained exactly 1,087,984 raw bytes, 120 over the prior limit. Main subsequently fixed that budget in #4933. This PR is rebased onto that fix and contains only the two Plan UI files; no separate budget allowance remains. The local bundle check passes with unchanged payload. Final-head checks: 30 passed, 0 failed, 3 skipped; only the contributor gate remains queued waiting for a GitHub runner (requeued once). > AGENT GENERATED
1 parent 7fd6ee9 commit 0bd81a2

2 files changed

Lines changed: 25 additions & 4 deletions

File tree

‎apps/app/src/components/thread/pending-interactions/ThreadPendingInteractionBanner.test.tsx‎

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,17 +278,16 @@ describe("ThreadPendingInteractionBanner tool-use approval", () => {
278278
});
279279

280280
describe("ThreadPendingInteractionBanner request family", () => {
281-
it("renders a plan review as a request with plan-verdict actions, resolved through today's approval", () => {
281+
it("opens a plan review with visible plan-verdict actions without approving it automatically", () => {
282282
renderBanner(planReview);
283283
expect(screen.getAllByText("Ready to code?").length).toBeGreaterThan(0);
284-
expect(isHidden(screen.getByTestId("plan-review-request"))).toBe(true);
285-
expandBanner();
286284
expect(isHidden(screen.getByTestId("plan-review-request"))).toBe(false);
287285
expect(screen.getByTestId("plan-review-request").textContent).toContain(
288286
"Read labels from the declaration",
289287
);
290288
expect(screen.getByText("/tmp/plans/picker.md")).toBeTruthy();
291289
expect(screen.queryByRole("button", { name: "Allow once" })).toBeNull();
290+
expect(mocks.resolveMutateAsync).not.toHaveBeenCalled();
292291
fireEvent.click(screen.getByRole("button", { name: "Approve plan" }));
293292
expect(mocks.resolveMutateAsync).toHaveBeenCalledWith(
294293
expect.objectContaining({
@@ -305,6 +304,28 @@ describe("ThreadPendingInteractionBanner request family", () => {
305304
);
306305
});
307306

307+
it("allows collapsing a plan review and opens the next plan request independently", () => {
308+
const client = new QueryClient();
309+
const view = render(
310+
<QueryClientProvider client={client}>
311+
<MemoryRouter>{bannerElement(planReview)}</MemoryRouter>
312+
</QueryClientProvider>,
313+
);
314+
fireEvent.click(screen.getByRole("button", { name: "Hide details" }));
315+
expect(screen.queryByRole("button", { name: "Approve plan" })).toBeNull();
316+
expect(mocks.resolveMutateAsync).not.toHaveBeenCalled();
317+
view.rerender(
318+
<QueryClientProvider client={client}>
319+
<MemoryRouter>
320+
{bannerElement({ ...planReview, id: "pint_plan_next" })}
321+
</MemoryRouter>
322+
</QueryClientProvider>,
323+
);
324+
expect(screen.getByRole("button", { name: "Approve plan" })).toBeTruthy();
325+
expect(isHidden(screen.getByTestId("plan-review-request"))).toBe(false);
326+
expect(mocks.resolveMutateAsync).not.toHaveBeenCalled();
327+
});
328+
308329
it("renders a plugin request through the plugin's pendingInteraction slot, keyed by <pluginId>/<kind>", () => {
309330
function SecretForm({ interaction }: PluginPendingInteractionProps) {
310331
return (

‎apps/app/src/components/thread/pending-interactions/ThreadPendingInteractionBanner.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ function PlanReviewRequestBanner({
223223
<PendingInteractionShell
224224
label="Plan review"
225225
title={approval.reason ?? "Ready to code?"}
226-
initiallyExpanded={false}
226+
initiallyExpanded
227227
errorMessage={errorMessage}
228228
sourceThread={sourceThread}
229229
testId="plan-review-banner"

0 commit comments

Comments
 (0)