Repository navigation
fix(go): keep pendingToolCallIds on the RUN_FINISHED success outcome - #3186
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
The 1.0 success outcome carries pendingToolCallIds: the frontend tool calls a completed run left unanswered, which the application answers in its next input. RunFinishedOutcome had no field for it, so decoding and re-emitting RUN_FINISHED dropped the list and a Go producer could not send it. Add the field and, like interrupts, write it only on the variant that defines it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What's wrong
The 1.0
RunFinishedSuccessOutcomehaspendingToolCallIds. These are the tool calls the run started and left unanswered (noTOOL_CALL_RESULT), which the application has to answer in the next input's messages. The fixture isspec/1.0/fixtures/RunFinishedEvent/valid/outcome-success-pending-tool-call-ids.json. The TypeScript, Python and .NET SDKs all model it.The Go
RunFinishedOutcomehas onlytypeandinterrupts:"outcome":{"type":"success"}. The list is lost, and a frontend downstream of a Go proxy loses the producer's statement of which tool calls it is waiting on.The fix
RunFinishedOutcomegetsPendingToolCallIDs []stringwith the tagjson:"pendingToolCallIds,omitempty". The outcome variants are closed objects, soMarshalJSONalready stripsinterruptsfrom anything that isn't an interrupt outcome. It now does the same forpendingToolCallIdson anything that isn't a success outcome. That way a caller who sets the field on an interrupt or cancelled outcome can't put an event on the wire that peers reject.Test
In
pkg/core/events/run_outcome_test.go:TestRunFinishedSuccessOutcomeKeepsPendingToolCallIDsdecodes the fixture payload, validates it, re-encodes it, and asserts that the output is JSON-equal to the input. It fails onmainbecause the list is dropped, and it passes with the fix.TestRunFinishedInterruptOutcomeDropsPendingToolCallIDschecks that the key never appears on the interrupt variant.The tests are JSON-only, so reverting the struct change makes them fail at runtime rather than at compile time. Mutation check: I reverted only
run_events.go, andTestRunFinishedSuccessOutcomeKeepsPendingToolCallIDsfailed.Checks
cd sdks/community/go && go test ./... -v: all packages ok, 127 top-level tests passed.cd example/server && go test ./...: ok.gofmt -lis clean.🤖 Generated with Claude Code