fix(demos): wait for the gateway to bind instead of sleeping - #34
Merged
Conversation
Demos 1-5 and the web console started their processes and then slept a fixed 1-2 seconds. cMCP Runtime 0.3.0 does attestation and audit setup before it binds, so on a cold start the first tool call hit a refused connection and every cMCP demo failed. Poll the port instead, with a 60s ceiling and a message pointing at the logs. Also fixes demo-05's docstring, which was copied from demo-04. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
What
Demos 1-5 and the web console started their subprocesses and then slept a fixed 1-2 seconds before the first call. cMCP Runtime 0.3.0 does attestation and audit setup before it binds :8443, so on a cold start every cMCP demo failed with
ConnectionRefusedError/URLErroron its first tool call. Demo 3 then failed too, since it reads demo 1's claim.They now poll the port until it accepts, with a 60s ceiling and an error that points at the
*.logfiles.Also corrects demo-05's module docstring, which still said "Demo 4: context-aware enforcement".
Verified locally
python demo.py --no-pause— all 9 demos pass, exit 0:list_dir403 POLICY_DENY, signed claim writtenpolicy_bundle.hashFAIL against the pinned v1 hash and PASS against v2partially_verified, all crypto checks passwrite_fileallowed ininvoice-run, 403 inchat-freeform, read allowed in bothWeb console: all three obligors run through the real
financial-servicesexample; the €750k write is blocked citing EBA/GL/2020/06 under the approved bundle, allowed under the tampered bundle, and that record then failspolicy_bundle.hashagainst the pinned approved hash.🤖 Generated with Claude Code