Skip to content

fix(streaming): make StreamHandle execution mode explicit and fix idle-worker reservation - #227

Merged
MisterVVP merged 1 commit into
dev-implement-reusable-synchronous-stream-worker-executor-jskgukfrom
dev-fix-streaming-worker-timeout-regressions
Aug 27, 2026
Merged

MisterVVP merged 1 commit into
dev-implement-reusable-synchronous-stream-worker-executor-jskgukfrom
dev-fix-streaming-worker-timeout-regressions

Conversation

@MisterVVP

@MisterVVP MisterVVP commented Aug 27, 2026 •

Copy link
Copy Markdown
Owner

Motivation

  • Two regressions caused timeouts after the reusable synchronous stream-worker change: gRPC StreamHandle::Cancel() inferred executor-backed execution from worker_.joinable() leading to waits that never complete after the owned worker was joined, and StreamWorkerExecutor::Submit() could observe the same idle worker multiple times and overcommit a single idle worker.
  • The intent is to make execution model explicit and make idle-worker assignment accurate without reverting the reusable synchronous stream-worker optimization.

Description

  • Add an explicit ExecutionMode (enum) on StreamHandle and initialize/preserve it on construction and moves, and use it to decide whether to wait on State::completion_condition instead of inferring from std::thread::joinable(); this makes repeated Cancel() idempotent and avoids the gRPC destructor/blocking deadlock. (changes in include/a2a/client/client.h and src/client/client.cpp).
  • Fix idle-worker reservation in StreamWorkerExecutor by decrementing idle_workers_ on Submit() when assigning a pending task to an idle worker and removing a redundant decrement in the worker loop so each idle worker is reserved for at most one submitted task. (change in src/client/stream_worker_executor.cpp).
  • Extend a focused unit test to cover repeated Cancel() on gRPC streams to prevent regressions. (change in tests/unit/grpc_transport_test.cpp).
  • Modified files: include/a2a/client/client.h, src/client/client.cpp, src/client/stream_worker_executor.cpp, and tests/unit/grpc_transport_test.cpp.

@MisterVVP MisterVVP added the codex Automatic label added by codex agent. Should not be used label Aug 27, 2026 — with ChatGPT Codex Connector
@MisterVVP MisterVVP self-assigned this Aug 27, 2026
@MisterVVP MisterVVP added AI agent AI agent contribution performance Performance improvement related tasks based on benchmark results. Performance tests changes. and removed codex Automatic label added by codex agent. Should not be used labels Aug 27, 2026
@MisterVVP
MisterVVP merged commit 300663c into dev-implement-reusable-synchronous-stream-worker-executor-jskguk Aug 27, 2026
19 checks passed
@MisterVVP
MisterVVP deleted the dev-fix-streaming-worker-timeout-regressions branch August 27, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI agent AI agent contribution performance Performance improvement related tasks based on benchmark results. Performance tests changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant