mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-05 19:28:25 +00:00
msg_sub_many was the last of the eleven coordinator tools with no live proof, and pointing a harness at it showed why: it could not succeed. CEP-41 says a stream's `close` does not complete the JSON-RPC request, so an open-ended subscription has no response to wait for — its budget running out is the only way it can ever end. callTool let that timeout propagate, so every subscription, however healthy, finished by throwing. CordnSyncLoop read that as a failure and went into backoff after each one. Under TimeoutMode.TOTAL the budget is now a normal return with whatever the stream delivered; IDLE still throws, because there silence really is a stalled peer. The fixture missed it by answering the subscribe call like any other request, which no coordinator does. CordnGroupManager.subscribe also persists on the way out now, like catchUp and for the same reason: delivering a message advances the ratchet and the cursor, so a subscription that ended without writing left that progress only in memory. A long-lived host survives it; a process-per-command client does not, and neither does a crash. New verb: `amy cordn watch [--timeout MS]`. It calls msg_sub_many and nothing else, so what it prints arrived over an open stream rather than a poll — the only way to exercise the one tool a request/response client never reaches. `fetch` and `watch` now share one delivery collector instead of two copies of the same when-branch. tier-b.sh gains the step, ordered so it proves something: the watcher goes up FIRST and only then does alice send, because a message sent beforehand would be backlog the subscription replays. A second step checks the cursor survived the watching process — removing the persist makes that one fail, so it is not decoration. Verified live: TIER B PASSED, with the message arriving under "via": "msg_sub_many" and not coming back on the next fetch. All eleven tools of spec/00.md are now exercised against the reference coordinator. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012BfD4txdnsaPRXmNXbup9n