You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Grok --always-approve skips classifyTool; deny-tier tools run with no Guardrail #812
Follow-up from #697 / #409. Grok is claude-stream and shares runner.js's control_request branch — the only place classifyTool runs for Claude-shaped CLIs.
Grok 1.0.5 maps asking modes to bypassPermissions + --always-approve (electron/providers.js, #578 / #549). Headless -p has no permission-prompt channel; --always-approve means the CLI never emits can_use_toolcontrol_request. Result: deny-tier tools (e.g. curl | sh via run_terminal_command) execute with no Guardrail event.
classifyTool also does not know Grok tool names (run_terminal_command, search_replace, read_file).
Real pre-exec seam: Grok PreToolUse hooks in the isolated GROK_HOME overlay. Official docs: hooks fire before permission checks and still deny under always-approve. Hook ask is auto-approved in YOLO, so ask must be treated as deny (same as #697).
Approach on this thread: Grok -p + --always-approve never emits can_use_tool, so the Claude control_request seam cannot run classifyTool. Official grok PreToolUse hooks still deny under always-approve, so the isolated GROK_HOME overlay now registers electron/grok-guardrail-hook.js (copied next to a copy of guardrails.js).
deny / ask → stdout {"decision":"deny","reason":…} and exit 2. Ask is deny because YOLO auto-approves a hook ask.
Transcript gets the same Guardrail blocked run_terminal_command: … event as Claude.
classifyTool now knows grok names (run_terminal_command, search_replace, read_file).
CODER_GUARDRAILS=off skips the inject.
Claude control_request is unchanged.
ssh/WSL still skip the overlay (#706), so they only get the after-the-fact event.
Implemented on coder/fork-fork-solenta-guardrail-deny-ask-int-daf14a (this thread). --always-approve never emits can_use_tool; the real gate is Grok PreToolUse in the isolated GROK_HOME overlay.
Overlay config.toml gets [[hooks.PreToolUse]] pointing at a copied grok-guardrail-hook.js (plus guardrails.js so packaging/asar cannot break require).
deny and ask both emit { "decision": "deny" } and exit 2. Official docs: hook ask is auto-approved in YOLO; timeout/crash fail-open.
CODER_GUARDRAILS=off skips the inject. Claude control_request is unchanged.
Tests drive the hook and a fake grok that would have executed curl | sh with no control_request; the marker proves executed: false before any Guardrail event line.
ssh/WSL still skip the overlay (#706). CI does not spawn live grok.
Vendor contract holds. Isolated GROK_HOME overlay config.toml[[hooks.PreToolUse]] is the seam the current CLI actually loads. JSON-file fallback is not required.
Binary:grok 1.0.13 (5e9a58528b76) [stable] at ~/.local/bin/grok.
Setup: temp GROK_HOME with auth.json symlink only (no hooks/ link, so user ~/.grok/hooks/*.json could not fire). Overlay config.toml had:
JSON-file ~/.grok/hooks/*.json is a second official source (inspect lists those too). Do not write the Solenta gate through the overlay hooks/ symlink (GROK_HOME_LINKS still links the user's ~/.grok/hooks). Overlay config.toml is the live seam #812 already injects.
Do not symlink sessions/ into a probe home: grok stale-session GC deletes through the link.
Skip-unless-env live canary is in electron/test/grok-live-hook.test.js (#826). Default suite / CI stay on the fake grok.
GROK_LIVE=1 node --test electron/test/grok-live-hook.test.js (not CI) re-ran green on grok 1.0.13 just now: inspect listed source.type=configToml on the overlay config.toml, deny blocked run_terminal_command (~48s). Marker present, canary absent, transcript had Hook denied, no control_request.
Isolated GROK_HOME still links auth.json only. CI=true skips even if GROK_LIVE=1 leaks.
#827: this worktree now has the overlay inject plus a default fake-grok unit test.
materializeGrokHome writes the live 1.0.13 config.toml shape ([[hooks.PreToolUse]] + matcher = "") and copies grok-guardrail-hook.js next to guardrails.js. The gate is not on the GROK_HOME_LINKShooks/ symlink. Live canary stays skip-unless-GROK_LIVE. CI unchanged.
#829: always-on fake-grok runner on this worktree.
Fake --always-approve never emits control_request. It consults overlay GROK_HOME/config.toml[[hooks.PreToolUse]] (live 1.0.13 configToml seam), would execute curl | sh, and the marker is executed: false plus a Guardrail event.
This checkout did not have the #827 inject; materializeGrokHome now writes the same matcher = \"\" shape and copies grok-guardrail-hook.js next to guardrails.js. Gate is not on the hooks/ symlink. Claude control_request unchanged. CI still does not set GROK_LIVE.
Live canary file is now on coder/fork-fork-fork-fork-fork-fork-fork-solen-cea26d (#831): electron/test/grok-live-hook.test.js, skip unless GROK_LIVE=1, also skip when CI=true. CI does not set GROK_LIVE. Overlay probe links auth.json only and asserts inspectsource.type=configToml.
#832 copies the overlay inject onto coder/fork-fork-fork-fork-fork-fork-fork-fork--d40e1a (from 86edef / f47cc9): materializeGrokHome writes live 1.0.13 config.toml[[hooks.PreToolUse]]matcher="" and copies grok-guardrail-hook.js. Always-on fake-grok runner is the last describe in electron/test/grok-guardrail-hook.test.js. GROK_HOME_LINKS still includes sessions and hooks. No GROK_LIVE in CI.
The grok PreToolUse hook from the leftover worktrees is now on origin/main via #840. Leaving this open until we confirm --always-approve no longer skips classifyTool on a live grok turn.
Activity
currentbits commentedon Sep 2, 2026
Approach on this thread: Grok
-p+--always-approvenever emitscan_use_tool, so the Claudecontrol_requestseam cannot runclassifyTool. Official grok PreToolUse hooks still deny under always-approve, so the isolatedGROK_HOMEoverlay now registerselectron/grok-guardrail-hook.js(copied next to a copy ofguardrails.js).{"decision":"deny","reason":…}and exit 2. Ask is deny because YOLO auto-approves a hook ask.Guardrail blocked run_terminal_command: …event as Claude.classifyToolnow knows grok names (run_terminal_command,search_replace,read_file).CODER_GUARDRAILS=offskips the inject.control_requestis unchanged.ssh/WSL still skip the overlay (#706), so they only get the after-the-fact event.
currentbits commentedon Sep 2, 2026
Implemented on
coder/fork-fork-solenta-guardrail-deny-ask-int-daf14a(this thread).--always-approvenever emitscan_use_tool; the real gate is GrokPreToolUsein the isolatedGROK_HOMEoverlay.config.tomlgets[[hooks.PreToolUse]]pointing at a copiedgrok-guardrail-hook.js(plusguardrails.jsso packaging/asar cannot breakrequire).{ "decision": "deny" }and exit 2. Official docs: hook ask is auto-approved in YOLO; timeout/crash fail-open.classifyToolaliases grok names (run_terminal_command,run_terminal_cmd,search_replace,read_file, …).CODER_GUARDRAILS=offskips the inject. Claudecontrol_requestis unchanged.curl | shwith nocontrol_request; the marker provesexecuted: falsebefore any Guardrail event line.ssh/WSL still skip the overlay (#706). CI does not spawn live grok.
currentbits commentedon Sep 2, 2026
ssh/WSL follow-up is #821: remote overlay +
env GROK_HOME=on the wrap. Local isolated overlay is unchanged.currentbits commentedon Sep 2, 2026
Live CLI proof (grok 1.0.13)
Vendor contract holds. Isolated
GROK_HOMEoverlayconfig.toml[[hooks.PreToolUse]]is the seam the current CLI actually loads. JSON-file fallback is not required.Binary:
grok 1.0.13 (5e9a58528b76) [stable]at~/.local/bin/grok.Setup: temp
GROK_HOMEwithauth.jsonsymlink only (nohooks/link, so user~/.grok/hooks/*.jsoncould not fire). Overlayconfig.tomlhad:Probe wrote a marker from stdin, printed
{"decision":"deny","reason":"solenta-live-proof-deny"}, exited 2.inspect (no model)
GROK_HOME=<overlay> grok inspect --jsonlisted the hook as:event:pre_tool_usesource.type:configTomlsource.path:$GROK_HOME/config.tomlconfigSources.layers[0]: that same overlay filelive
-p --always-approveInit event:
permissionMode=bypassPermissions. Model calledrun_terminal_commandthree times (printf/echo/printfintoCANARY.txt).GROK_HOOK_NAME=user:pre_tool_use[0].hooks[0]gate hook blocked \u2026 reason=solenta-live-proof-denythentool call denied by pre_tool_use hookCANARY.txttool_resultis_error+Hook denied: solenta-live-proof-denycontrol_request/can_use_toolJSON-file
~/.grok/hooks/*.jsonis a second official source (inspectlists those too). Do not write the Solenta gate through the overlayhooks/symlink (GROK_HOME_LINKSstill links the user's~/.grok/hooks). Overlayconfig.tomlis the live seam #812 already injects.Do not symlink
sessions/into a probe home: grok stale-session GC deletes through the link.currentbits commentedon Sep 2, 2026
Skip-unless-env live canary is in
electron/test/grok-live-hook.test.js(#826). Default suite / CI stay on the fake grok.GROK_LIVE=1 node --test electron/test/grok-live-hook.test.js(notCI) re-ran green on grok 1.0.13 just now: inspect listedsource.type=configTomlon the overlayconfig.toml, deny blockedrun_terminal_command(~48s). Marker present, canary absent, transcript hadHook denied, nocontrol_request.Isolated
GROK_HOMEstill linksauth.jsononly.CI=trueskips even ifGROK_LIVE=1leaks.currentbits commentedon Sep 2, 2026
#827: this worktree now has the overlay inject plus a default fake-grok unit test.
materializeGrokHomewrites the live 1.0.13config.tomlshape ([[hooks.PreToolUse]]+matcher = "") and copiesgrok-guardrail-hook.jsnext toguardrails.js. The gate is not on theGROK_HOME_LINKShooks/symlink. Live canary stays skip-unless-GROK_LIVE. CI unchanged.currentbits commentedon Sep 2, 2026
#829: always-on fake-grok runner on this worktree.
Fake
--always-approvenever emitscontrol_request. It consults overlayGROK_HOME/config.toml[[hooks.PreToolUse]](live 1.0.13configTomlseam), would executecurl | sh, and the marker isexecuted: falseplus a Guardrail event.This checkout did not have the #827 inject;
materializeGrokHomenow writes the samematcher = \"\"shape and copiesgrok-guardrail-hook.jsnext toguardrails.js. Gate is not on thehooks/symlink. Claudecontrol_requestunchanged. CI still does not setGROK_LIVE.currentbits commentedon Sep 2, 2026
Live canary file is now on
coder/fork-fork-fork-fork-fork-fork-fork-solen-cea26d(#831):electron/test/grok-live-hook.test.js, skip unlessGROK_LIVE=1, also skip whenCI=true. CI does not setGROK_LIVE. Overlay probe linksauth.jsononly and assertsinspectsource.type=configToml.currentbits commentedon Sep 2, 2026
#832 copies the overlay inject onto
coder/fork-fork-fork-fork-fork-fork-fork-fork--d40e1a(from 86edef / f47cc9):materializeGrokHomewrites live 1.0.13config.toml[[hooks.PreToolUse]]matcher=""and copiesgrok-guardrail-hook.js. Always-on fake-grok runner is the last describe inelectron/test/grok-guardrail-hook.test.js.GROK_HOME_LINKSstill includessessionsandhooks. NoGROK_LIVEin CI.currentbits commentedon Sep 2, 2026
The grok PreToolUse hook from the leftover worktrees is now on
origin/mainvia #840. Leaving this open until we confirm--always-approveno longer skips classifyTool on a live grok turn.currentbits commentedon Sep 2, 2026
Worktree already on origin/main via #840 (
ca6c5146). Closing and marking plan:done.