Skip to content

Don't report a bridged agent turn as failed on gRPC transport cancellation - #216

Merged
imaustink merged 1 commit into
mainfrom
fix/invoke-status-transport-cancel
Aug 23, 2026
Merged

Don't report a bridged agent turn as failed on gRPC transport cancellation#216
imaustink merged 1 commit into
mainfrom
fix/invoke-status-transport-cancel

Conversation

@imaustink

Copy link
Copy Markdown
Owner

Summary

  • Root cause of the "❌ Timeout or cancellation waiting for update: stream terminated by RST_STREAM with error code: CANCEL" errors agent-orchestrator surfaces for claude-code-swe-agent runs launched through Temporal.
  • handleInvokeStatus (the /invoke poll endpoint) treated any handle.Get error other than its own poll deadline expiring as a genuine turn failure. The Temporal SDK's WorkflowUpdateServiceTimeoutOrCanceledError is explicitly documented as being about the client call, not the update — the workflow is still running either way. This made a bridged coding agent's routine multi-minute turn (e.g. creating a repo + opening a PR) get reported as an outright failure while the AgentRun kept working in the background.
  • Now any WorkflowUpdateServiceTimeoutOrCanceledError is classified as pending, mirroring how the streaming chat facade's awaitTurnResult (server.go) already handles the exact same SDK error.

Test plan

  • go build ./...
  • go vet ./...
  • go test ./... — new tests added in invoke_status_test.go: TestHandleInvokeStatusTreatsTransportCancelAsPending (the regression), TestHandleInvokeStatusReportsARealFailure, TestHandleInvokeStatusUnknownUpdateIs404, TestHandleInvokeStatusSucceededReportsTheReply

🤖 Generated with Claude Code

https://claude.ai/code/session_01D3zV2JdVTYGuS1KGwyXCJz

…ation

/invoke's status poll treated any handle.Get error other than ctx's own
deadline as a genuine turn failure. But the Temporal SDK's
WorkflowUpdateServiceTimeoutOrCanceledError (e.g. "stream terminated by
RST_STREAM with error code: CANCEL") is explicitly documented as being
about the client call, not the update -- the workflow keeps running
either way. Misclassifying it made agent-orchestrator report a bridged
coding agent's routine multi-minute turn (e.g. launching claude-code-swe-
agent to open a PR) as an outright failure while the AgentRun kept
working in the background.

Now any WorkflowUpdateServiceTimeoutOrCanceledError is treated as
pending, matching how the streaming chat facade's awaitTurnResult
already handles the same SDK error.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D3zV2JdVTYGuS1KGwyXCJz
@imaustink
imaustink merged commit 8d23939 into main Aug 23, 2026
6 checks passed
@imaustink
imaustink deleted the fix/invoke-status-transport-cancel branch August 23, 2026 12:48
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