fix: auto-forward CAPISCIO_SERVER_URL → CAPISCIO_REGISTRY_ENDPOINT#29
Conversation
The Go binary reads CAPISCIO_REGISTRY_ENDPOINT for JWKS-based badge verification. Without it, BadgeVerifier is nil and all badge checks fail with ErrBadgeInvalid — even for valid badges. Previously users had to set both CAPISCIO_SERVER_URL (Python SDK) and CAPISCIO_REGISTRY_ENDPOINT (Go binary) to the same value. Now connect.py auto-forwards SERVER_URL into REGISTRY_ENDPOINT before spawning the Go subprocess, following the same pattern used for CAPISCIO_BUNDLE_URL. Users can still override REGISTRY_ENDPOINT explicitly if needed. Closes #28
|
✅ Integration tests passed! capiscio-core gRPC tests working. |
There was a problem hiding this comment.
Pull request overview
This PR reduces configuration friction by automatically forwarding the registry base URL used by the Python SDK into the environment variable expected by the embedded Go core, so badge signature verification can build the correct JWKS URL without requiring users to set two equivalent env vars.
Changes:
- Set
CAPISCIO_REGISTRY_ENDPOINTfromserver_urlwhen it’s not already present in the environment (before any Go core subprocess spawn paths). - Document the rationale inline (issue #28 / badge verification failure mode).
| # Forward SERVER_URL so the Go binary can build its JWKS URL for | ||
| # badge verification. Without this, BadgeVerifier is nil and all | ||
| # badge checks fail with ErrBadgeInvalid. (See issue #28) | ||
| if "CAPISCIO_REGISTRY_ENDPOINT" not in os.environ: | ||
| os.environ["CAPISCIO_REGISTRY_ENDPOINT"] = server_url |
| # Forward SERVER_URL so the Go binary can build its JWKS URL for | ||
| # badge verification. Without this, BadgeVerifier is nil and all | ||
| # badge checks fail with ErrBadgeInvalid. (See issue #28) | ||
| if "CAPISCIO_REGISTRY_ENDPOINT" not in os.environ: | ||
| os.environ["CAPISCIO_REGISTRY_ENDPOINT"] = server_url |
| server_url="http://localhost:8080", | ||
| keys_dir=tmp_keys_dir, | ||
| ) | ||
|
|
||
| assert os.environ.get("CAPISCIO_REGISTRY_ENDPOINT") == "http://localhost:8080" |
| # Should retain the explicit value, not overwrite with server_url | ||
| assert os.environ.get("CAPISCIO_REGISTRY_ENDPOINT") == explicit_endpoint |
| # Forward SERVER_URL so the Go binary can build its JWKS URL for | ||
| # badge verification. Without this, BadgeVerifier is nil and all | ||
| # badge checks fail with ErrBadgeInvalid. (See issue #28) | ||
| if "CAPISCIO_REGISTRY_ENDPOINT" not in os.environ: | ||
| os.environ["CAPISCIO_REGISTRY_ENDPOINT"] = server_url |
…rning - Move assertions for registry endpoint tests inside the patch.dict context manager (fixes CI failures — patch.dict restores env on exit) - Add warning log when CAPISCIO_REGISTRY_ENDPOINT differs from server_url (addresses multi-connect race concern from review)
|
Addressed the review comments in c130bf3: Tests (comments 3 & 4): Moved both assertions inside the Multi-connect race (comment 1): Added a Env var semantics (comment 5): All 413 tests pass locally. |
|
✅ Integration tests passed! capiscio-core gRPC tests working. |
Problem
Users must set two env vars that point to the same registry URL:
The Go binary reads
CAPISCIO_REGISTRY_ENDPOINTto build the JWKS URL for badge signature verification (mcp_service.go:61). Without it,BadgeVerifieris nil and all badge checks fail withErrBadgeInvalid— even for valid badges.Fix
Auto-forward
CAPISCIO_SERVER_URLintoCAPISCIO_REGISTRY_ENDPOINTbefore spawning the Go subprocess — same pattern already used forCAPISCIO_BUNDLE_URL(lines 361, 508).Users can still override
CAPISCIO_REGISTRY_ENDPOINTexplicitly if needed (e.g., separate JWKS endpoint).Impact
Once released,
a2a-demoscan dropCAPISCIO_REGISTRY_ENDPOINTfrom.env.example— one less env var for users to configure.Closes #28