fix(core): don't fail sibling tools on tool-output encode errors - #47027
Open
xiaomayi-ant wants to merge 1 commit into
Open
fix(core): don't fail sibling tools on tool-output encode errors#47027xiaomayi-ant wants to merge 1 commit into
xiaomayi-ant wants to merge 1 commit into
Conversation
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.
Issue for this PR
Closes #47024
Type of change
What does this PR do?
I was reading through
session/runner/llm.tsto understand how tool execution works in the V2 runner, and got stuck on theraceFirst(FiberSet.join, FiberSet.awaitEmpty)logic inawaitToolFibers. What confused me: if the model dispatches several tool calls at once and just one of them fails, the runner ends up marking all the other still-running ones as failed too — even ones that would've finished fine on their own. That felt wrong, so I dug into what could actually makejoinfail, and it turns out the only thing typed to reach it isToolOutputStore.Error— aStorageErrortagged with eitheroperation: "encode"or"write".That's basically the whole fix: an
encodefailure only means that one tool's output couldn't be serialized, it has nothing to do with anyone else's storage — so there's no good reason to fail the whole batch because of it. I added a short extra wait (FiberSet.awaitEmpty) before sweeping unsettled tools in that specific case, so the other calls get a real chance to finish and report their own actual result instead of getting overwritten with a false "failed". Awritefailure is more likely a shared disk/storage problem, so that path still fails fast like before — didn't touch it.How did you verify your code works?
bun run typecheckin packages/core passes;bun turbo typecheckacross all 30 packages also passes (ran automatically via the pre-push hook).bun testin packages/core: 1096 tests pass, no regressions.Screenshots / recordings
Checklist