fix: wait for tool results before processor cleanup#27850
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potentially related PR: Related PR:
This PR appears to be in the same domain (session processor and tool handling), though it focuses specifically on orphaned interrupted tools rather than pending tool results timing. It may provide context or have related logic worth reviewing. All other searches returned only the current PR (#27850) itself. No exact duplicates found. |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
Summary
Motivation
This addresses a race where long-running tools, especially
task/subagent tools, can still be resolving after the model stream finishes. The previous 250ms cleanup grace period could mark those calls asTool execution abortedand let the parent session continue before the tool result was recorded.Related reports: #23404, #21250.
Test plan
bun test test/session/processor-effect.test.tsbun run typecheck