fix(agents): harden tool search child streams#101295
Conversation
Co-authored-by: 陈宪彪0668000387 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 411d3260ea
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| child.stderr?.on("error", (error) => { | ||
| settle(() => reject(error)); |
There was a problem hiding this comment.
Abort bridged calls on stderr stream failure
When the new stderr error path fires while model-authored code is awaiting openclaw.tools.call(...), this settles the code-mode promise and kills the child but never aborts bridgeAbortController; the in-flight runCodeModeBridgeRequest still passes that un-aborted signal through ToolSearchRuntime.call to the target tool, so side-effectful or long-running catalog tools can continue running after tool_search_code has already failed. Abort the bridge controller before rejecting on this stream-failure path so it matches the timeout/parent-abort cleanup behavior.
Useful? React with 👍 / 👎.
|
Land-ready at
Known proof gaps: none. |
|
Merged via squash.
|
Co-authored-by: 陈宪彪0668000387 <[email protected]>
Co-authored-by: 陈宪彪0668000387 <[email protected]>
What Problem This Solves
Code-mode
tool_searchspawned an unused stdout pipe and left stderr stream errors unhandled. A broken diagnostic pipe could therefore surface as an uncaughterrorevent instead of rejecting the tool call cleanly.Supersedes #101022 after the contributor fork head became unstable during maintainer fixup. The original author remains credited in the commit.
Why This Change Was Made
The worker already returns logs and results over IPC, so stdout is ignored instead of creating an unused pipe. Stderr failures now flow through the existing once-only settlement path, which rejects pending work and terminates the unusable child without duplicating lifecycle policy.
The one-off proof script and redundant testing export from the submitted branch are omitted. A focused regression exercises the real spawn owner, stderr rejection, child termination, and exact stdio contract.
User Impact
Code-mode Tool Search fails cleanly when its child diagnostic stream breaks, instead of risking a gateway crash or stranded request. Normal IPC results and stderr diagnostics are unchanged.
Evidence
oxfmtandgit diff --check: clean.aws, leasecbx_b04650d7e1c8, runrun_4f37de478300, exact head411d3260ea455417dbd251ca3a48a32fd1117e4b: focused test passed 1/1. Broker fallback tot3.smallrequired an 8 GiB swap file after a prior undersized lease was OOM-killed during dependency installation before tests.