feat(plug): implement tasks/resubscribe - #106
Merged
Merged
Conversation
Resubscribe answered unsupported-operation for every request, which is the right answer for exactly one case and wrong for the rest: an unknown task should report not-found, and a task still running should get a stream. Subscribing now opens an SSE stream whose first event is the task as it stands, then one status update per state change, ending when the task is terminal. Subscribers live in the agent's own state because the library may not start a supervision tree, so there is nowhere else to keep them; each is monitored, which makes a dropped connection deregister itself without the agent being told. An idle timeout closes a stream whose task never finishes, so it cannot pin a connection process open forever. The stored task still carries the agent's own source enumerable, and that is a trap rather than a resume point: enumerating it replays from the start instead of attaching, and each consumer casts its own completion, duplicating the task's artifacts and history. A subscriber therefore only reads the snapshot and waits for pushed events, which also means nothing produced before it attached is replayed. Clears the last baselined compliance failure, and un-skips the subscribe and multi-stream families along with it. Closes #99. Part of #13.
TCK Compliance ResultsResult: passed - failures match the tracked baseline. TCK run complete — 0 known failure(s), matching test/tck/expected-failures.txt. |
|
Reviewed — no high-confidence issues found. LGTM. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
tasks/resubscribe(SubscribeToTask), which answered-32004for every request. This empties the TCK baseline —test/tck/expected-failures.txtnow has no entries.Type of change
What changed
-32001unknown task,-32004terminal task or undeclared streaming:authorize_tasknow runs under a new:resubscribeoperation — the arm ran no authorization at all beforeA2A.Pluggains:resubscribe_timeout(default 60s) for streams that go idleA2A.Client.resubscribe/3Results
All four STREAM-SUB requirements pass, and the subscribe/multi-stream families un-skipped with them:
STREAM-SUB-001/002andSTREAM-ORDER-001..004plus the threetest_multi_streamtests all went from skipped to passing.mix test652 passed,mix qualityclean.The trap this had to avoid
A stored
:workingtask still holds the agent's source enumerable inmetadata[:stream], andget_taskhands it back. Enumerating it replays from element one rather than attaching, and each consumer'sStream.transformafter-fun casts its own{:stream_done, …}— duplicating artifacts, history, the terminal transition, and the push delivery.So resubscribe never touches it: it reads the task for a snapshot and waits for events the agent pushes. There's a regression test asserting artifacts and history stay at one after a subscribe.
Design notes
Why the registry lives in agent state.
AGENTS.mdforbids a supervision tree inapplication/0, so there is nowhere else to hang one. The agent fans out from the same three transition seams push notifications already hook, andProcess.monitoris the entire cleanup story.Why an idle timeout. The relay blocks in a receive loop; a task that never terminates would pin its connection process indefinitely.
Deliberate limits
tasks/getfor full history.:rejectedis not terminal toA2A.Task.terminal?/1(it covers completed/canceled/failed), though STREAM-SUB-002's wording includes it. The runtime never produces:rejected, so it cannot bite today — widening@terminal_stateswould also changecontinue_task/5, so I left it alone rather than quietly expanding scope.Closes #99. Part of #13.