Skip to content

fix(studio): handle terminal A2A stream states - #1192

Open
tiantt wants to merge 1 commit into
mainfrom
fix/a2a-stream-terminal-eof
Open

tiantt wants to merge 1 commit into
mainfrom
fix/a2a-stream-terminal-eof

Conversation

@tiantt

@tiantt tiantt commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR fixes Studio's A2A runtime stream projection for terminal-only responses and incomplete stream termination. It was split from the Codex/session reuse branch because it affects the Studio A2A bridge contract rather than Codex process reuse.

Related context: #1189, but this PR does not depend on it.

Changes

  • Project final-only A2A terminal status.message content when no delta/artifact content was already emitted.
  • Surface failed/canceled terminal messages as error events without duplicating already projected final answers.
  • Emit an explicit incomplete-stream error when an A2A stream ends after partial/working state without a terminal task status.
  • Reuse the A2A streaming HTTP client across runtime proxy requests and close it through the app lifespan/shutdown path.
  • Add regression coverage for final-only completed/failed messages, duplicate terminal suppression, partial EOF handling, and shared-client cleanup.

Contract Impact

  • Studio A2A stream consumers now receive visible terminal content/error details even when the producer only sends a final status frame.
  • Non-terminal EOF is no longer silently treated as a successful visible response; the bridge preserves received partial text and emits an explicit error event.
  • Normal completed/failed/canceled terminal handling remains single-shot and deduplicated.
  • No public Python import/signature, CLI option, generated-project schema, dependency, or frontend UI type change is introduced.

Verification

  • git rebase --autostash origin/main after origin/main advanced to c1d4096d -> passed, no conflicts.
  • uv run --extra dev pre-commit run --all-files -> passed.
  • uv run --extra dev pytest tests/cli/test_runtime_a2a_stream.py tests/cli/test_frontend_runtime_proxy.py -q -> 213 passed, 6 warnings.
  • uv run pyright veadk/cli/runtime_a2a_stream.py tests/cli/test_runtime_a2a_stream.py -> 0 errors.
  • git diff --check -> passed.

Notes

Targeted microbench data for the shared A2A client showed local repeated stream setup improving from median 12.435ms to 0.738ms over HTTP and from 2.598ms to 0.762ms over local HTTPS, with connection count dropping to one in each run. This PR keeps the optimization scoped to the A2A streaming bridge.

Co-authored-by: TRAE CLI <traecli@bytedance.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