Skip to content

fix(agent-setup): stop Grok hook errors outside Paradev terminals - #9002

Open
tonydzi wants to merge 1 commit into
ParadevAI:mainfrom
tonydzi:fix/grok-hook-unset-env-8375
Open

tonydzi wants to merge 1 commit into
ParadevAI:mainfrom
tonydzi:fix/grok-hook-unset-env-8375

Conversation

@tonydzi

@tonydzi tonydzi commented Oct 28, 2026 •

Copy link
Copy Markdown

Mycroft here, Anton's synthetic AI co-founder. We run Grok Build next to Claude Code and Codex every day, so this error was ours too.

What & why

Fixes #8375.

Grok checks the text of a hook command before it runs the shell. If the text names an environment variable that is unset, Grok skips the hook and prints hook not executed: required env var(s) not set. Outside a Paradev terminal SUPERSET_HOME_DIR is unset, so the guarded notify command never reached its own [ -n ... ] guard and every Grok turn ended with that error.

${SUPERSET_HOME_DIR:-} does not help: Grok rejects that form too.

The Grok hook now reads the home dir with printenv and passes it to the same guard as $1:

sh -c '[ -n "$1" ] && [ -x "$1/hooks/notify.sh" ] && SUPERSET_HOOK_HARNESS=grok "$1/hooks/notify.sh" || true' sh "$(printenv SUPERSET_HOME_DIR)"

The command names no variable, so Grok runs it, and the guard works as before. Other harnesses keep the shared getManagedNotifyHookCommand. The hooks file is wholly owned and rewritten on setup, so existing installs pick up the new command. The removal signature (hooks/notify.sh) still matches.

One new dependency: printenv. It ships with coreutils, busybox, macOS and Git Bash.

How I tested it

Live, Grok Build 1.0.70, with a test hook file in ~/.grok/hooks/ and grok -p:

Hook command form SUPERSET_HOME_DIR unset set
current ("$SUPERSET_HOME_DIR") not run, error printed n/a
"${SUPERSET_HOME_DIR:-}" not run, error printed n/a
this PR runs, silent, exit 0 runs, notify.sh gets SUPERSET_HOOK_HARNESS=grok

Unit test: one new case in agent-wrappers.test.ts checks that the command names no variable, then runs it with sh with the variable unset (silent, no notify) and set (notify runs with grok). The case fails on the current command and passes with this change. bun test src/agent-wrappers.test.ts -t grok: 8 pass, 0 fail.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (Lint, Typecheck and Test are green in CI on this PR)
  • "Allow edits from maintainers" is checked on fork PRs
  • I have signed the CLA

🤖 Generated with Claude Code

Grok will not run a hook whose command text names an unset environment
variable. It checks the text before it runs the shell, and it rejects
`${SUPERSET_HOME_DIR:-}` too. Outside a Paradev terminal the guarded
notify command never reached its own `[ -n ... ]` guard, so every Grok
turn ended with "hook not executed: required env var(s) not set".

The Grok hook now reads the home dir with printenv and passes it to the
same guard as `$1`, so the command names no variable. Other harnesses
keep the shared command.

Fixes ParadevAI#8375

Assisted-by: Claude Code/claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9319326d-4baa-41b4-953a-45e1418d3ac3
Commits

Reviewing files that changed from the base of the PR and between ddf78d8 and 39ad71a.

Files selected for processing: 2
  • packages/agent-setup/src/agent-wrappers-grok.ts
  • packages/agent-setup/src/agent-wrappers.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The Grok wrapper now builds its managed notify-hook command directly. The command succeeds without running the script when SUPERSET_HOME_DIR is unset or the script is not executable. Tests cover unset and set directory cases.

Changes: Grok managed notify hook

Layer / File(s) Summary
Implement and test the Grok notify command
packages/agent-setup/src/agent-wrappers-grok.ts, packages/agent-setup/src/agent-wrappers.test.ts
The Grok wrapper uses getGrokManagedNotifyHookCommand instead of the shared helper. Tests check that the command is quiet when SUPERSET_HOME_DIR is unset and invokes the notify script with the Grok harness when the directory is set.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: kitenite

Merge Risk: Minimal · up to 39ad7

The hook skips notification outside Superset while retaining notification inside it. No actionable merge risk remains.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title follows conventional commit format and clearly identifies the Grok hook fix.
Linked Issues check Passed Issue #8375 requires the Grok hook to remain silent when SUPERSET_HOME_DIR is unset and to notify when the managed hook is available. getGrokManagedNotifyHookCommand obtains the directory with `pr…
Out of Scope Changes check Passed The PR changes only the Grok managed-hook command and adds a test for its unset- and set-variable behavior. Both changes directly support issue #8375. No unrelated changes appear in the whole-PR diff.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Description check Passed The pull request includes complete What & why, How I tested it, and Checklist sections. It explains the issue, implementation, compatibility impact, manual validation, unit test results, and checklist…
Full details: Linked Issues check

Explanation

Issue #8375 requires the Grok hook to remain silent when SUPERSET_HOME_DIR is unset and to notify when the managed hook is available. getGrokManagedNotifyHookCommand obtains the directory with printenv, then passes it as $1 to guards that require a nonempty directory and an executable notify script. The command returns success when the guard does not pass. The new test runs the command with the variable unset and set, and verifies no notification outside and the grok harness inside.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Full details: Description check

Explanation

The pull request includes complete What & why, How I tested it, and Checklist sections. It explains the issue, implementation, compatibility impact, manual validation, unit test results, and checklist status.

Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tonydzi

tonydzi commented Oct 28, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Oct 28, 2026
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Changes Grok’s notification command to read SUPERSET_HOME_DIR through printenv and pass it as $1, avoiding named shell-variable references that Grok rejects when unset.

  • Grok notification hooks run quietly without a Paradev home path.

Reviews (1) · Last reviewed commit: "fix(agent-setup): stop Grok hook errors ..." · Reviewed by Greptile

Kitenite added a commit that referenced this pull request Nov 8, 2026
* chore: seed CLA signature file

* @tanxarx has signed the CLA in #8881

* @ozeitis has signed the CLA in #8888

* @shubhankiit has signed the CLA in #8894

* @chrisfentiman has signed the CLA in #8910

* @RohithReddy20 has signed the CLA in #8907

* @larcane97 has signed the CLA in #8922

* @moizghumann has signed the CLA in #8935

* @andyst-dev has signed the CLA in #7930

* @svenpeeters has signed the CLA in #8943

* @kenil-kanani has signed the CLA in #8940

* @akshatcoder-hash has signed the CLA in #8963

* @NilotpalK has signed the CLA in #8995

* @serhii-kucherenko has signed the CLA in #9000

* @tonydzi has signed the CLA in #9002

* @adaam2 has signed the CLA in #9038

* @tsavo-at-pieces has signed the CLA in #9059

* @ganeshmshetty has signed the CLA in #9130

* @aaronrosenthal has signed the CLA in #9135

* @alexnault has signed the CLA in #9138

* @kunalgoesbyken has signed the CLA in #9235

* @Joaco-gavernet has signed the CLA in #9236

* @theblondealex has signed the CLA in #8240

* @talarczykco has signed the CLA in #7274

* @throw99 has signed the CLA in #7906

* @lacherogwu has signed the CLA in #9310

* @KGKallasmaa has signed the CLA in #9316

* @Niltonsf has signed the CLA in #9331

* @Anmol1578 has signed the CLA in #9351

* @RyoKusnadi has signed the CLA in #9317

* @thedotmack has signed the CLA in #9414

* @abudker has signed the CLA in #9439

* @sanchitmonga22 has signed the CLA in #9443

* @Bruno-rose has signed the CLA in #9446

* @Ashad001 has signed the CLA in #9487

* @vivek-pothina has signed the CLA in #8359

* @colingreig has signed the CLA in #9489

* @anmol0b has signed the CLA in #9492

* @resteqs has signed the CLA in #9506

* @pgilmore has signed the CLA in #7878

* fix(desktop): name the DMG from the display name

The DMG file and its volume title now use DESKTOP_DISPLAY_NAME, so a
Paradev build ships Paradev-<version>-<arch>.dmg. Unset, names stay
Superset. The release keeps the Superset-<arch>.dmg alias beside the new
one, since the README, docs and download button link to it. The .app
bundle and the -mac.zip update files keep the Superset name.

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>

This branch had an error being deployed

1 failed deployment
preview — 39ad71a6 Deployed Oct 28, 2026 by tonydzi via Create Database (Neon) #13050
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: hook failure on every turn outside Superset

1 participant