Skip to content

grok-implementer: fix two headless-lane footguns (preflight false negative, silent exec cancel)#8

Open
hstrick2000 wants to merge 1 commit into
DannyMac180:mainfrom
hstrick2000:fix/headless-lane-footguns
Open

grok-implementer: fix two headless-lane footguns (preflight false negative, silent exec cancel)#8
hstrick2000 wants to merge 1 commit into
DannyMac180:mainfrom
hstrick2000:fix/headless-lane-footguns

Conversation

@hstrick2000

Copy link
Copy Markdown

Two failure modes hit in production use of the grok-implementer lane, both costing a full turn each time. Diagnosed 2026-07-16/18 from the Grok CLI's own ~/.grok/logs/unified.jsonl and --debug output; both are now also documented as operator runbook rules in the reporting workspace's CLAUDE.md.

1. Preflight false negative: grok models says "You are not authenticated" while auth is fine

grok.com access tokens are short-lived (~6h). When one has lapsed, grok models prints "You are not authenticated" even though that same invocation silently refreshes the token successfully. Caught in the CLI's unified log (grok 0.2.101): the same pid logged auth.refresh.success at 21:49:51.403Z yet printed "not authenticated" at .663Z. An immediate second call succeeds.

The preflight as written treats one failed check as fatal, so the lane reports STATUS: unavailable and the caller falls back to a more expensive lane — precisely the routing this agent exists to avoid.

Fix: retry grok models once; only two consecutive failures mean a real logout.

2. Silent no-op: headless runs exit 0 with no files when grok needs a shell command

The Grok CLI merges the caller's global ~/.claude/settings.json permission rules into its own resolver. Under that merge, terminal-command execution defaults to "ask" — and with no human present, an "ask" silently cancels the turn: exit 0, no diff, no error. Any spec step that needs even a trivial shell command (ls) kills the run invisibly. Two invocations were lost to this before --debug surfaced the cancel.

Fix: add a scoped --allow 'Bash(*)' to the documented invocation. This approves shell execution only — --always-approve remains forbidden, and the wrapper still re-runs verification itself (the stale parenthetical claiming acceptEdits may have blocked grok's own verification is removed, since it no longer applies).

🤖 Generated with Claude Code

1. Preflight: retry 'grok models' once before STATUS: unavailable — the
   CLI prints 'You are not authenticated' when the ~6h access token has
   lapsed even though the same invocation silently refreshes it, so a
   single failed check is usually a false negative.

2. Invocation: add scoped --allow 'Bash(*)'. The Grok CLI merges the
   caller's global ~/.claude/settings.json permission rules into its
   resolver; terminal exec defaults to 'ask', which headlessly cancels
   silently (exit 0, no diff). --always-approve stays forbidden.

Co-Authored-By: Claude Fable 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