Repository navigation
fix(codebuddy): run Windows hooks without requiring PowerShell 7 - #27626
Conversation
CodeBuddy spawns hooks registered with shell: 'powershell' as a bare `pwsh`, so on Windows without PowerShell 7 every hook failed with spawn pwsh ENOENT and the failed UserPromptSubmit hook blocked prompts. Register CodeBuddy's hooks the way Claude's are: the managed .cmd path on cmd-safe profiles (runs under CodeBuddy's Git Bash or Windows PowerShell default shell) and the absolute powershell.exe encoded launcher otherwise. The next install rewrites existing registrations. Fixes #27182
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to No actionable issue remains before merging. The change removes CodeBuddy’s explicit PowerShell requirement for Windows hooks. Pre-merge checks |
|
ELI5
On Windows, Orca told CodeBuddy to run its status hooks with "PowerShell". CodeBuddy takes that to mean PowerShell 7 (
pwsh), which most Windows machines don't have. Every hook failed withspawn pwsh ENOENTand CodeBuddy blocked the prompt. The hooks now run on a stock Windows install.What Changed
CodeBuddy's hook service no longer sets
windowsHookShell: 'powershell'. It now gets the same Windows hook command Claude uses (getWindowsManagedLifecycleHook):.cmdhook script.powershell.exeby its full path.Existing installs are fixed automatically. The old entry still matches
agent-hooks\codebuddy-hook.cmd, so status reports it as not installed and the next startup install replaces it. Users' own hooks are kept.Why
I checked CodeBuddy's published package (
@tencent-ai/codebuddy-code2.164.0,dist/codebuddy.js). Forshell: "powershell"it returns{executable: "pwsh", ...}with no lookup and no fallback, and a failed start counts as a block. Without ashellsetting, it runs the command under Git Bash-cif it finds it, otherwise under the first PowerShell it finds (pwsh, thenpowershell, then the System32 path). The plain script path works either way.Alternatives I rejected:
pwshis installed when writing the hook: the answer goes stale as soon as the user installs or removes PowerShell 7.Qoder and Qwen Code also write
shell: "powershell", but their runners resolve it to Windows PowerShell 5.1 (Qoder 1.1.68 usespowershell.exeon win32; Qwen Code 0.25.1 usespowershell), which ships with Windows. They're unchanged.SSH and remote installs already use the POSIX form and are unaffected.
Linked Issue
Fixes #27182
Visual Proof
N/A: this only changes the hook config Orca writes. Nothing in the UI changes.
Testing
shellfield, and an existingshell: "powershell"entry is replaced while user hooks are kept. Updated the managed-hook command contract test.pwshremoved from PATH. I installed the hooks into a temporary profile and ran the registered command the way CodeBuddy does:spawn pwsh ENOENT.{}.{}.pnpm tc:node,oxlintandcheck:code-quality:changedare clean.Known limit: for profile paths with spaces or non-ASCII characters, CodeBuddy adds
-WindowStyle Hiddenin front of the fallback launcher. #16003 found Kaspersky blocking that pair, so those users may still need follow-up.Checklist
N/Awith reason