Skip to content

feat(server): Introduce SettleByTaskId method - #692

Merged
bartek-gralewicz merged 4 commits into
mainfrom
bgralewicz/introduce_settle_by_task_id_method
Sep 15, 2026
Merged

bartek-gralewicz merged 4 commits into
mainfrom
bgralewicz/introduce_settle_by_task_id_method

Conversation

@bartek-gralewicz

Copy link
Copy Markdown
Collaborator

Description

When the agent executor returns, _settleBus decides whether to tear down that task's event bus from the last state it saw published on the bus. That only works when the bus delivers synchronously, as DefaultExecutionEventBus does. A bus that batches or persists events before handing them to subscribers has published nothing observable at that moment, so lastState is undefined, the keepBusAliveStates guard is skipped, and the bus is released before its events arrive. The caller then hangs, or fails with "Agent execution finished without a result".

This adds an optional settleByTaskId to ExecutionEventBusManager. When present, the handler delegates the decision entirely and performs no teardown of its own, letting a deferred-delivery bus settle from its own drain instead. _settleBus is the only caller of finished() and cleanupByTaskId() in src/, so the seam covers bus lifetime completely.

keepBusAliveStates is unchanged and remains the default policy — it is ignored only while settleByTaskId is present. DefaultExecutionEventBusManager deliberately does not implement the new method, so nothing changes for existing users.

Fixes #620 🦕

@bartek-gralewicz
bartek-gralewicz requested a review from a team as a code owner September 1, 2026 07:07
@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

🧪 Code Coverage

⬇️ Download Full Report

Base PR Delta
src/server/events/execution_event_queue.ts 94.44% 100% 🟢 +5.56%
src/server/request_handler/default_request_handler.ts 91.84% 92.66% 🟢 +0.82%
Total 85.13% 85.22% 🟢 +0.09%

Generated by coverage-comment.yml

Comment thread test/integration/support/delaying.ts Resolved
Comment thread test/integration/support/delaying.ts Resolved
@bartek-gralewicz
bartek-gralewicz merged commit e856bda into main Sep 15, 2026
15 checks passed
@bartek-gralewicz
bartek-gralewicz deleted the bgralewicz/introduce_settle_by_task_id_method branch September 15, 2026 09:03
bartek-gralewicz added a commit that referenced this pull request Sep 18, 2026
🤖 I have created a release *beep* *boop*
---


## [1.2.0](v1.1.0...v1.2.0)
(2026-09-18)


### Features

* **server:** Introduce SettleByTaskId method
([#692](#692))
([e856bda](e856bda))


### Bug Fixes

* accept GetExtendedAgentCard JSON-RPC calls with omitted params
([#687](#687))
([047d970](047d970))
* avoid mutating caller message configuration
([#725](#725))
([e3a6428](e3a6428))
* **client:** cache the extended Agent Card only after signature
verification ([#711](#711))
([55b601c](55b601c))
* guard terminal state transitions and make cancelTask atomic
([#636](#636))
([7b87c94](7b87c94))
* preserve call context for JSON-RPC tenant requests
([#708](#708))
([ae20aca](ae20aca))
* preserve HeadersInit in authenticating fetch
([#721](#721))
([f8c33fa](f8c33fa))
* preserve historyLength=0 and reject invalid REST listTasks pageSize
([#685](#685))
([32c1865](32c1865))
* reject empty task IDs with RequestMalformedError in getTask/cancelTask
([#629](#629))
([71aae97](71aae97))
* reject invalid ListTasks status filters with RequestMalformedError
([#631](#631))
([a881fae](a881fae))
* reject missing required extensions before mutating task history
([#690](#690))
([3b4ef3f](3b4ef3f))
* reject whitespace-only taskId on sendMessage
([#689](#689))
([85227a0](85227a0))
* return 404/-32001 for missing push notification configs
([#630](#630))
([34f06e3](34f06e3))
* scope ExecutionEventBusManager by tenant and owner to match TaskStore
([#707](#707))
([69d8899](69d8899))
* stamp the resolved taskId onto sendMessage push configs
([#688](#688))
([cfb19a8](cfb19a8))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: Bartek Gralewicz <[email protected]>
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.

[Clarification]: Evetbus is closed directly after executor has finished

4 participants