Skip to content

fix: headless read-only runs can't auto-approve within their own sandbox - #12

Merged
aksheyd merged 1 commit into
xai-org:mainfrom
mittalpk:fix/headless-readonly-auto-approve
Aug 4, 2026
Merged

aksheyd merged 1 commit into
xai-org:mainfrom
mittalpk:fix/headless-readonly-auto-approve

Conversation

@mittalpk

Copy link
Copy Markdown
Contributor

Summary

Fixes #5.

executeReviewRun and the read-only branch of executeTaskRun in grok-bridge.mjs passed --permission-mode plan with no --always-approve. Both are headless invocations (/grok-build:review and /grok-build:delegate without --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-only is the actual safety boundary for these paths, so combining it with --always-approve is safe, and matches the pattern the --write branch already uses one line below (alwaysApprove: write with no sandbox when write is true).

Changes

  • executeReviewRun: permissionMode: "plan" → alwaysApprove: true (keeps sandbox: "read-only")
  • executeTaskRun: alwaysApprove: write → alwaysApprove: true unconditionally; dropped the now-redundant permissionMode branch (kept sandbox: write ? undefined : "read-only" unchanged)

Test plan

  • Added tests/grok-bridge-permissions.test.mjs, following the existing FAKE_GROK_LOG fixture pattern to assert on the actual argv the fake grok binary receives:
    • review passes --always-approve alongside --sandbox read-only
    • run without --write passes --always-approve alongside --sandbox read-only
    • run --write passes --always-approve with no --sandbox flag (unchanged behavior)
  • Confirmed the first two new tests fail against the pre-fix code (git stash) and pass after the fix.
  • Full suite: npm test → 61 passed, 0 failed, 0 regressions.

🤖 Generated with Claude Code

@mittalpk
mittalpk requested a review from a team July 30, 2026 08:41
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
mittalpk force-pushed the fix/headless-readonly-auto-approve branch from bf49b5f to 286c6ee Compare July 30, 2026 09:09

@aksheyd aksheyd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

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.

Headless read-only can't request auto-approve: alwaysApprove/permissionMode/sandbox are coupled in the bridge

2 participants