Repository navigation
fix(openclaw): launch hooks through the installed Node entry - #1307
Merged
Merged
Conversation
- Record the installing Node executable and TeamAI CLI entry in generated handlers so gateway services do not depend on a shell PATH. - Spawn Node with separate script and dispatch arguments, avoiding Windows npm .cmd execution while preserving workspace and session payloads. - Keep dispatch nonblocking, hide Windows child consoles, and report a missing CLI entry before writing a partial installation. - Verify 77 focused tests, build, typecheck and lint, plus a real-CLI injection and dispatch with an empty service PATH. Related to Tencent#1221.
|
No findings confidently supported by the current PR diff.
|
SaulMoro
approved these changes
Oct 23, 2026
SaulMoro
left a comment
Collaborator
There was a problem hiding this comment.
This was generated by AI during triage.
@nateEc Thanks, approving. This closes the #1221 item "OpenClaw: the hook runs spawn('teamai') without a shell".
We ran teamai hooks inject with the built CLI on this head and on its base 97f1e7b4. Then we called the rendered OpenClaw handler with an empty PATH:
- Base: the handler renders
spawn('teamai', …), never reaches the CLI, anddebug.loghas nohook-dispatchline. - This PR: the handler spawns the pinned Node binary with the CLI entry, and
debug.logshows[hook-dispatch] session-start/openclaw.
The new e2e and the new unit case fail on the base and pass here. tsc, lint and the unit tests pass.
Not blocking:
[P2 non-blocking]With the Node path rewritten to one that no longer exists, the handler exits 0 and logs nothing. After a Node upgrade, hooks would stop until the handler is rendered again.~/.teamai/bin/teamaipins paths the same way, butinitandpullrewrite it. Worth checking that the OpenClaw handler is refreshed on the same path.[P3 nit]The e2e checkswindowsHideby reading the rendered source. It does not run anything on Windows.
Outside this PR: src/opencode-hooks.ts:119 also spawns a bare teamai.
49 of 52 tasks
This was referenced Oct 23, 2026
Walternater
pushed a commit
to Walternater/teamai-cli
that referenced
this pull request
Nov 2, 2026
…#1307) - Record the installing Node executable and TeamAI CLI entry in generated handlers so gateway services do not depend on a shell PATH. - Spawn Node with separate script and dispatch arguments, avoiding Windows npm .cmd execution while preserving workspace and session payloads. - Keep dispatch nonblocking, hide Windows child consoles, and report a missing CLI entry before writing a partial installation. - Verify 77 focused tests, build, typecheck and lint, plus a real-CLI injection and dispatch with an empty service PATH. Related to Tencent#1221.
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
OpenClaw gateways with a restricted service PATH never start TeamAI's generated hook; native Node spawn also cannot execute a Windows npm .cmd shim. Generate the handler with the installing Node executable and CLI entry, then pass the dispatch arguments directly to Node. Workspace/session mapping and nonblocking error handling are preserved.
Type of Change
Test Plan
openclaw-hooks.test.tsandhooks-cmd.test.ts.npm run build,npx tsc --noEmit,npm run lint, andgit diff --checkpassed.1eedff6:Related Issues
Related to #1221, one specific item in "Other findings". This PR does not close the umbrella issue or include its descriptor/resolver redesign.
Notes for Reviewers
Uses existing
resolveCliEntry(); adds no shell or dependency. Generated absolute paths are refreshed by the existing injection/reconcile path. macOS execution verified; a native Windows gateway and a live OpenClaw runtime were not available locally. Windows behavior is covered structurally by spawning Node directly with windowsHide.Integration verification: all five independent fixes cherry-picked cleanly onto origin/main in a local-only checkout; combined build, typecheck and lint passed, with 174 unit tests and 7 real-CLI cases across 6 E2E files. The Windows test-list guard and moved POSIX command regression also pass together (25 tests).