Skip to content

feat: let reviewers approve a plan into Claude Code auto mode - #249

Open
jpalharini wants to merge 2 commits into
contextbridge:mainfrom
jpalharini:feat/exit-plan-mode-auto
Open

feat: let reviewers approve a plan into Claude Code auto mode#249
jpalharini wants to merge 2 commits into
contextbridge:mainfrom
jpalharini:feat/exit-plan-mode-auto

Conversation

@jpalharini

@jpalharini jpalharini commented Jul 31, 2026

Copy link
Copy Markdown

Summary

The PermissionRequest:ExitPlanMode hook always exits plan mode into acceptEdits, so a reviewer who wants Claude to keep going without prompts has to switch modes by hand right after approving.

This PR adds a mode selector next to "Approve Plan" in the browser UI with two options, Accept Edits (still the default) and Auto, and carries the choice through the submission payload into the hook's setMode permission update. The choice is deliberately not persisted: every review starts back at Accept Edits. Aims to address #247.

Review focus

  1. Scope of the enum. ApprovalModeSchema is z.enum(['acceptEdits', 'auto']), not the SDK's full PermissionMode. packages/shared has no dependency edge on @anthropic-ai/claude-agent-sdk, so the subset relationship is held by a comment there plus the contextual typing of updatedPermissions in claudeHookResponse.ts, which fails to compile if the SDK ever drops 'auto'. We may want to also add bypassPermissions, although that no longer seems to be an option in CLI.
  2. Where the mode is echoed to the reviewer. The mode appears as a suffix on the primary button ("Approve Plan (Auto)") in two places: the submit bar and the close-review guard dialog, since that dialog also submits the selected mode. Both go through one predicate (shouldSuffixApprovalMode) so the two surfaces cannot disagree, and neither shows a suffix at the default. Worth a look at whether App.tsx reaching into SubmitBar.tsx for that predicate is the placement you want.
  3. approvalMode: status === 'approved' ? approvalMode : 'acceptEdits' in useAnnotationState.ts keeps a rejected submission from asserting a mode nothing will honor. It is one ternary guarding a wire payload, and it is intentional rather than leftover.

ApprovalModeSchema.default('acceptEdits') makes the field required in the inferred output type, which is why the CLI formatter tests moved onto the annotationSubmission fishery factory instead of hand-rolled literals.

just verify is green locally, including the vitest browser-mode suites. Docs updated at packages/website/src/content/docs/usage/claude-code.mdx.

Commits

  • 512af9d feat(shared): carry an approval mode on plan submissions. Adds ApprovalModeSchema, the defaulted field on AnnotationSubmissionSchema, the factory default, and the test migration onto the factory.
  • 41337f6 feat: let reviewers approve a plan into Claude Code auto mode. The setMode change in the hook formatter, the submit-bar selector, the close-dialog label, and the docs.

jpalharini and others added 2 commits July 31, 2026 10:52
Adds ApprovalModeSchema ('acceptEdits' | 'auto') and an approvalMode
field on AnnotationSubmission, defaulting to 'acceptEdits' so existing
payloads keep today's behavior.

Call sites that built AnnotationSubmission literals by hand now use the
annotationSubmission fishery factory, per the repo testing conventions,
so future schema additions do not ripple through them.

Refs contextbridge#247

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The Claude Code PermissionRequest hook hardcoded acceptEdits as the mode
the session lands in after a plan is approved. The submit bar now carries
an attached mode selector (Accept Edits by default, or Auto), and the hook
envelope sets whichever the reviewer chose.

Auto is Claude Code's model-classifier permission mode. The selector only
appears for Claude Code reviews with no pending feedback, and the choice is
not remembered between reviews.

Refs contextbridge#247

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant