feat: add Grok CLI provider for cli/grok models #498
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.47) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 348 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.350
Shallow Review Depth
shallow_review_depth
0.344
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #498"
general
weight: 0.35
steipete
Summary
--cli grok,--model cli/grok,--model cli/grok/<model>, andcli.grok.{binary,model,extraArgs,isolated}config, plusGROK_PATH/SUMMARIZE_CLI_GROKbinary overrides andCLI_GROKavailability handling across the daemon model picker and the Chrome extension.src/llm/cli-runners/grok.ts) invokesgrok --prompt-file <file> --output-format jsonso untrusted page content never touches argv. Text summaries run in an isolated temp cwd with a read-onlylist_dirtoolset,MCPTool()denied,--sandbox strict, and plan/subagent/web-search off;GROK_HOMEis redirected to a temp dir carrying onlyauth.jsonso sessions/hooks/user config do not load. Attachment runs keep the caller cwd with--always-approve --sandbox off.src/llm/cli-provider-output/grok.ts) maps additive cache usage fields (input + cache_creation + cache_read) andtotal_cost_usd, tolerates brace-containing diagnostic preludes, and surfaces{type:"error"}payloads — including stdout errors on non-zero exits (execCliWithInputnow attaches buffered stdout to rejected errors).pino longer leaks its isolated temp cwd if the promptmkdtempfails;PI_PATH,GROK_HOME, andCODEX_HOMEadded to the daemon env snapshot whitelist (they were missing).Test plan
pnpm run check— 3,688 tests green, lint/typecheck/format/localization all passgrokv1.0.41 binary — transcripts below~/.grok/sessionsresidue and no temp-dir leaks on isolated runsextraArgsoverrides are handled viahasAnyFlag-style guardsReal-run transcript (
grokv1.0.41, macOS)Raw grok output shape (verified):
{"text": "...", "usage": {"input_tokens": N, "cache_read_input_tokens": N, "cache_creation_input_tokens": N, "output_tokens": N, "total_tokens": N}, "total_cost_usd": N}; errors:{"type":"error","message":"..."}on stdout with exit 1. Session residue check:~/.grok/sessionscount unchanged after isolated runs; allsummarize-grok-temp dirs removed infinally.Generated with Devin