Repository navigation
fix: headless read-only runs can't auto-approve within their own sandbox - #12
Merged
Merged
Conversation
executeReviewRun and the read-only branch of executeTaskRun in grok-bridge.mjs used --permission-mode plan with no --always-approve. Headless invocations have no user who can click Approve, so any tool call needing approval had nobody able to grant it. --sandbox read-only is the actual safety boundary for these paths, so combining it with --always-approve is safe and matches the pattern already used by the --write branch (alwaysApprove + no sandbox). Fixes xai-org#5
mittalpk
force-pushed
the
fix/headless-readonly-auto-approve
branch
from
July 30, 2026 09:09
bf49b5f to
286c6ee
Compare
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
Fixes #5.
executeReviewRunand the read-only branch ofexecuteTaskRuningrok-bridge.mjspassed--permission-mode planwith no--always-approve. Both are headless invocations (/grok-build:reviewand/grok-build:delegatewithout--write) — there is no user who can click Approve — so any tool call needing approval had nobody able to grant it, exactly as described in #5.--sandbox read-onlyis the actual safety boundary for these paths, so combining it with--always-approveis safe, and matches the pattern the--writebranch already uses one line below (alwaysApprove: writewith no sandbox whenwriteis true).Changes
executeReviewRun:permissionMode: "plan"→alwaysApprove: true(keepssandbox: "read-only")executeTaskRun:alwaysApprove: write→alwaysApprove: trueunconditionally; dropped the now-redundantpermissionModebranch (keptsandbox: write ? undefined : "read-only"unchanged)Test plan
tests/grok-bridge-permissions.test.mjs, following the existingFAKE_GROK_LOGfixture pattern to assert on the actual argv the fakegrokbinary receives:reviewpasses--always-approvealongside--sandbox read-onlyrunwithout--writepasses--always-approvealongside--sandbox read-onlyrun --writepasses--always-approvewith no--sandboxflag (unchanged behavior)git stash) and pass after the fix.npm test→ 61 passed, 0 failed, 0 regressions.🤖 Generated with Claude Code