Skip to content

fix(go): keep pendingToolCallIds on the RUN_FINISHED success outcome - #3186

Open
rudycelekli wants to merge 1 commit into
ag-ui-protocol:mainfrom
rudycelekli:fix/go-run-finished-pending-tool-calls
Open

rudycelekli wants to merge 1 commit into
ag-ui-protocol:mainfrom
rudycelekli:fix/go-run-finished-pending-tool-calls

Conversation

@rudycelekli

Copy link
Copy Markdown

What's wrong

The 1.0 RunFinishedSuccessOutcome has pendingToolCallIds. These are the tool calls the run started and left unanswered (no TOOL_CALL_RESULT), which the application has to answer in the next input's messages. The fixture is spec/1.0/fixtures/RunFinishedEvent/valid/outcome-success-pending-tool-call-ids.json. The TypeScript, Python and .NET SDKs all model it.

The Go RunFinishedOutcome has only type and interrupts:

  • Data loss on relay. Decoding and re-encoding the fixture gives "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.
  • Go producers can't send it. There is no field to set.

The fix

RunFinishedOutcome gets PendingToolCallIDs []string with the tag json:"pendingToolCallIds,omitempty". The outcome variants are closed objects, so MarshalJSON already strips interrupts from anything that isn't an interrupt outcome. It now does the same for pendingToolCallIds on 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:

  • TestRunFinishedSuccessOutcomeKeepsPendingToolCallIDs decodes the fixture payload, validates it, re-encodes it, and asserts that the output is JSON-equal to the input. It fails on main because the list is dropped, and it passes with the fix.
  • TestRunFinishedInterruptOutcomeDropsPendingToolCallIDs checks 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, and TestRunFinishedSuccessOutcomeKeepsPendingToolCallIDs failed.

Checks

  • cd sdks/community/go && go test ./... -v: all packages ok, 127 top-level tests passed.
  • cd example/server && go test ./...: ok.
  • gofmt -l is clean.

🤖 Generated with Claude Code

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant