fix(hooks): skip hook injection when /bin/sh is absent - #274
Merged
Conversation
In remote container environments (e.g. CloudStudio AI inference nodes),
/bin/sh may not exist. CodeBuddy executes hooks via spawn('/bin/sh'),
so every hook invocation fails with ENOENT (error 1001), blocking all
user input.
Detect /bin/sh availability at install time and skip hook injection for
shell-dependent tools (CodeBuddy/WorkBuddy) when absent, with a clear
warning. Other tools (Claude Code, Cursor) are unaffected.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/bin/shmay not existspawn('/bin/sh', ...), so every hook invocation fails with ENOENT (error 1001), blocking all user input/bin/shavailability at install time and skip hook injection for shell-dependent tools (CodeBuddy/WorkBuddy) when absent, with a clear warningChanges
src/builtin-hooks.ts: AddhasShell()detection (cached),SHELL_DEPENDENT_TOOLSshared constant,ensureWrapperIfShellAvailable()helper,_resetShellCache()for testssrc/hooks.ts:injectHooksToAllToolsandreconcileHooksToAllToolsskip shell-dependent tools when/bin/shis absent and warn the usersrc/__tests__/hooks-shell-check.test.ts: 6 tests coveringhasShell()caching and no-shell skip behaviorTest plan
npx tsc --noEmit— type check passesnpx vitest run— 1891 tests pass (144 files), including golden testsnpm run build— build succeeds/bin/sh, runteamai initorteamai pull, verify warning is printed and CodeBuddy settings.json has no hook entries/bin/sh), verify hooks are injected normally (no behavioral change)🤖 Generated with Claude Code