Skip to content

fix(desktop): pass ZDOTDIR and BASH_ENV through env filter for agent hooks#795

Merged
Kitenite merged 2 commits intomainfrom
hooks-not-working
Jan 17, 2026
Merged

fix(desktop): pass ZDOTDIR and BASH_ENV through env filter for agent hooks#795
Kitenite merged 2 commits intomainfrom
hooks-not-working

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Jan 17, 2026

Summary

  • Add ZDOTDIR and BASH_ENV to the environment variable allowlist in buildSafeEnv()
  • These shell initialization variables are required for the agent wrapper PATH injection to work
  • Without them, the terminal daemon was filtering them out, preventing ~/.superset/bin from being prepended to PATH

Root Cause

The persistent terminal daemon calls buildSafeEnv() to filter environment variables before spawning shells. This was stripping ZDOTDIR (used by zsh) and BASH_ENV (used by bash), which meant the shell wrappers in ~/.superset/zsh/.zshrc weren't being sourced. As a result, ~/.superset/bin wasn't in PATH, so the real claude/opencode binaries were used instead of the wrappers that fire hook notifications.

Test plan

  • Verified which claude returns ~/.superset/bin/claude (wrapper) instead of ~/.local/bin/claude (real binary)
  • Verified PATH starts with ~/.superset/bin
  • Test agent hooks fire correctly and UI status indicators update

Summary by CodeRabbit

  • Bug Fixes

    • Improved terminal shell environment support for better shell initialization compatibility.
  • Chores

    • Removed debug logging statements from internal event handlers and agent lifecycle listeners.

✏️ Tip: You can customize this high-level summary in your review settings.

…hooks

The terminal daemon's buildSafeEnv() was filtering out ZDOTDIR and BASH_ENV,
preventing the shell wrapper from being sourced. Without these variables,
~/.superset/bin wasn't prepended to PATH, so the real agent binaries were
used instead of the wrappers that fire hook notifications.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 17, 2026

Warning

Rate limit exceeded

@Kitenite has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 12 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d1db13e and 7ad1b04.

📒 Files selected for processing (1)
  • apps/desktop/src/main/lib/notifications/server.ts
📝 Walkthrough

Walkthrough

This PR removes debug logging statements from two files and extends the terminal environment variable allowlist by adding ZDOTDIR and BASH_ENV to support shell wrapper PATH injection.

Changes

Cohort / File(s) Summary
Debug logging removal
apps/desktop/src/main/lib/notifications/server.ts, apps/desktop/src/renderer/stores/tabs/useAgentHookListener.ts
Removed debugLog emissions: eliminated detailed hook request logging in /hook/complete handler (eventType, mappedEventType, paneId, tabId, workspaceId) and removed debug log from AGENT_LIFECYCLE branch without altering control flow.
Terminal environment allowlist extension
apps/desktop/src/main/lib/terminal/env.ts
Added ZDOTDIR and BASH_ENV to ALLOWED_ENV_VARS constant to enable shell initialization variables to reach wrappers for PATH injection.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Poem

🐰 Logs fade like morning dew,
ZDOTDIR joins the env queue,
Shells wrap 'round PATH so tight,
Cleaner code—a rabbit's delight!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding ZDOTDIR and BASH_ENV to the environment variable filter for agent hooks, which is the core fix implemented in the PR.
Description check ✅ Passed The description provides a comprehensive summary of changes, root cause analysis, and test plan covering all essential aspects of the fix, though the formal template sections are not strictly followed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@Kitenite Kitenite merged commit 637c494 into main Jan 17, 2026
4 of 5 checks passed
@Kitenite Kitenite deleted the hooks-not-working branch January 17, 2026 23:39
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

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