Skip to content

fix: grok headless runs die on first gated tool; map asking modes to auto and surface run errors in thread_status - #4

Merged
currentbits merged 1 commit into
mainfrom
coder/grok-provider-runs-fail-immediately-afte-f92fae
Aug 14, 2026
Merged

currentbits merged 1 commit into
mainfrom
coder/grok-provider-runs-fail-immediately-afte-f92fae

Conversation

@currentbits

@currentbits currentbits commented Aug 14, 2026 •

Copy link
Copy Markdown
Owner

Root cause (issue #3)

Grok-provider threads run the grok CLI headless (-p), and headless grok has no permission prompt channel — nothing like claude's --permission-prompt-tool stdio / stream-json stdin control protocol exists. Solenta spawned it with --permission-mode default ("Ask first"), so the first tool call that needed approval was auto-cancelled by the CLI (User cancelled the execution for tool …) and the run ended with result subtype error_during_execution.

The issue's "before making any tool call" premise was slightly off: the failed runs in the store did make tool calls — read-only tools (read_file, grep, safe git status) are auto-approved even in default mode — and every run died at the first gated tool (search_replace, MCP use_tool). Reproduced live: default mode → error_during_execution; --permission-mode auto → same write task completes with result subtype success.

What changed

  • electron/providers.js — grok buildArgs maps the asking modes (default, acceptEdits) to grok's non-prompting auto; plan and bypassPermissions never prompt and pass through unchanged. Same spirit as kimi one-shot turns, which also cannot ask.
  • electron/orchServer.js — thread_status now returns lastError (the run's Run error: … event text: result subtype / exit code / stderr tail) when a thread is failed, so orchestrators can see why a run died, not just that it did — the issue's second ask.
  • Tests updated for the new mode mapping plus a new lastError case.

Other providers (checked as part of this work)

  • kimi and opencode run gated tools unprompted headless (verified live with the same write-task repro) — not affected.
  • claude workers don't die, they stall: gated tools become UI permission prompts and the run waits at working for a human. Fork unattended claude workers with acceptEdits/bypassPermissions.
  • codex cannot die grok-style (exec never prompts) but may silently run with a read-only sandbox; unverified live (account at usage limit), no codex thread has ever run. Follow-up if needed: add -s workspace-write to codex buildArgs.

Verification

  • node --test on grok/providers/providers-set/reasoning-effort/workflow suites → 69/69 pass
  • electron/test/orch-server.test.js handler suite passes incl. the new lastError test (HTTP-listener subtests fail identically on a clean checkout in this sandbox — pre-existing, unrelated)
  • npm run typecheck → exit 0
  • Live repro: headless grok write task fails in default, succeeds in auto

Fixes #3

🤖 Generated with Claude Code

  • PR created by the Claude Code agent

…auto

Headless grok (-p) has no permission prompt channel (no
--permission-prompt-tool / stream-json input like claude), so
--permission-mode default auto-cancels the first tool that needs approval
and the run ends with result subtype error_during_execution (issue #3).
Map default and acceptEdits to grok's non-prompting auto mode; plan and
bypassPermissions never prompt and pass through.

thread_status now returns lastError (the run's 'Run error: ...' event)
when a thread is failed, so orchestrators can see why a run died.

Fixes #3

Co-Authored-By: Claude Fable 5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@currentbits currentbits changed the title fix: grok headless runs die on first gated tool (#3) fix: grok headless runs die on first gated tool; map asking modes to auto and surface run errors in thread_status Aug 14, 2026
@currentbits
currentbits merged commit 4dd96b4 into main Aug 14, 2026
@currentbits
currentbits deleted the coder/grok-provider-runs-fail-immediately-afte-f92fae branch October 3, 2026 16:07
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.

Grok provider runs fail immediately after first assistant message

1 participant