feat: let reviewers approve a plan into Claude Code auto mode - #249
Open
jpalharini wants to merge 2 commits into
Open
feat: let reviewers approve a plan into Claude Code auto mode#249jpalharini wants to merge 2 commits into
jpalharini wants to merge 2 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
PermissionRequest:ExitPlanModehook always exits plan mode intoacceptEdits, 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
setModepermission update. The choice is deliberately not persisted: every review starts back at Accept Edits. Aims to address #247.Review focus
ApprovalModeSchemaisz.enum(['acceptEdits', 'auto']), not the SDK's fullPermissionMode.packages/sharedhas no dependency edge on@anthropic-ai/claude-agent-sdk, so the subset relationship is held by a comment there plus the contextual typing ofupdatedPermissionsinclaudeHookResponse.ts, which fails to compile if the SDK ever drops'auto'. We may want to also addbypassPermissions, although that no longer seems to be an option in CLI.shouldSuffixApprovalMode) so the two surfaces cannot disagree, and neither shows a suffix at the default. Worth a look at whetherApp.tsxreaching intoSubmitBar.tsxfor that predicate is the placement you want.approvalMode: status === 'approved' ? approvalMode : 'acceptEdits'inuseAnnotationState.tskeeps 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 theannotationSubmissionfishery factory instead of hand-rolled literals.just verifyis green locally, including the vitest browser-mode suites. Docs updated atpackages/website/src/content/docs/usage/claude-code.mdx.Commits
512af9dfeat(shared): carry an approval mode on plan submissions. AddsApprovalModeSchema, the defaulted field onAnnotationSubmissionSchema, the factory default, and the test migration onto the factory.41337f6feat: let reviewers approve a plan into Claude Code auto mode. ThesetModechange in the hook formatter, the submit-bar selector, the close-dialog label, and the docs.