Drop progress notifications to keep MCP transport stable#15
Open
felixding wants to merge 1 commit into
Open
Conversation
`Council.notify` was sending notifications/progress with a hardcoded `progress_token="owlex-council"`. Per MCP spec progressToken must echo the token the client attached to the originating request via `_meta.progressToken`. Spec-compliant clients (e.g. Claude Code) treat an unknown token as a protocol violation and drop the stdio transport, killing the active deliberation mid-run. Echoing the client's own request_id back in the token doesn't help either: `council_ask` returns a task_id synchronously and the deliberation runs in the background, so any progress notification arrives AFTER the originating tools/call response. The client has already completed and deregistered its callback for that request id, so the token is "unknown" by the time the notification lands. Drop the progress notification entirely and rely on `send_log_message` for CLI visibility — log messages aren't tied to a request and don't have this issue. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bfff3ff to
fae8156
Compare
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
Council deliberation drops the MCP stdio transport mid-run when invoked from spec-strict clients (e.g. Claude Code).
Two compounding causes:
1. Hardcoded progress token (the original bug).
Council.notifysentnotifications/progresswithprogress_token=\"owlex-council\". Per the MCP spec,progressTokenmust echo the token the client attached to the originating request via_meta.progressToken. An unknown token is treated as a protocol violation:2. Even with the right token, async + progress don't mix here.
council_askreturns atask_idsynchronously and the deliberation runs in the background. Any progress notification the engine fires arrives AFTER the originatingtools/callresponse — by then the client has completed that request id and deregistered its callback. Echoing back_meta.progressToken(which Claude Code auto-derives from the request id) hits the same crash a few seconds later.Fix
Drop the progress notification entirely. Keep
send_log_message, which has no token requirement and provides equivalent CLI visibility.Test plan
tests/test_council.py::TestCouncilNotifywith two tests:test_progress_notifications_are_not_sent— asserts the helper does not callsend_progress_notification.test_log_messages_still_flow— assertssend_log_messageis still called with the right args.uv run --with pytest --with pytest-asyncio pytest tests/test_council.py→ 10 passed).council_askno longer drops the connection during round 1.🤖 Generated with Claude Code