Title: Tier 2 commercial-identity gate: latency / headers / side-effects parity contract · Issue #392 · adcontextprotocol/adcp-client-python · GitHub
Open Graph Title: Tier 2 commercial-identity gate: latency / headers / side-effects parity contract · Issue #392 · adcontextprotocol/adcp-client-python
X Title: Tier 2 commercial-identity gate: latency / headers / side-effects parity contract · Issue #392 · adcontextprotocol/adcp-client-python
Description: Summary Follow-up from #375 (PR for the wire-code rename portion). This issue tracks the parity-contract refactor that was deferred from that PR per the user's stop-rule ("if the parity contract turns out to be more complex than fits in ...
Open Graph Description: Summary Follow-up from #375 (PR for the wire-code rename portion). This issue tracks the parity-contract refactor that was deferred from that PR per the user's stop-rule ("if the parity contract tu...
X Description: Summary Follow-up from #375 (PR for the wire-code rename portion). This issue tracks the parity-contract refactor that was deferred from that PR per the user's stop-rule ("if the parity co...
Opengraph URL: https://github.com/adcontextprotocol/adcp-client-python/issues/392
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Tier 2 commercial-identity gate: latency / headers / side-effects parity contract","articleBody":"## Summary\n\nFollow-up from #375 (PR for the wire-code rename portion). This issue tracks the **parity-contract refactor** that was deferred from that PR per the user's stop-rule (\\\"if the parity contract turns out to be more complex than fits in a single PR, file a separate issue for the parity-contract follow-up\\\").\n\n## Why\n\nThe cross-tenant onboarding-oracle clamp in the AdCP spec requires the unrecognized-agent path and the recognized-but-denied path to be observably **indistinguishable** to an external attacker — across:\n\n- HTTP status code (already aligned via shared `PERMISSION_DENIED` envelope).\n- Response headers (Content-Type, Content-Length within negligible tolerance).\n- Side effects (audit emission, metric increment with the same operation label).\n- Latency (cannot shortcut the unrecognized path; needs a deliberate budget).\n- Observability (logs, APM spans, third-party error telemetry).\n\n#375's rename portion closed the code mismatch but left the eager-raise structural difference — see the docstring on `_resolve_buyer_agent` (the \\\"Note on parity\\\" paragraph) and the test-file docstring on `tests/test_tier2_spec_conformance.py`.\n\n## Required design\n\nPer the issue body of #375:\n\n> Approach: introduce a `PermissionDeniedReason` internal enum/struct with `(scope, status)` fields. The dispatch layer raises a single `PermissionDeniedError` carrying a reason; the wire-level translator emits the spec-correct `PERMISSION_DENIED` envelope with `details` populated only when scope is set. The unrecognized path still does the same audit-emission + metric increment as the denied path. Latency parity may require an explicit small delay budget — document the tradeoff.\n\nConcretely:\n\n1. **Single emit point.** Move all four denial paths in `_resolve_buyer_agent` (and the `validate_billing_for_agent` path) through one common projection — an internal `PermissionDeniedError` wrapping a `PermissionDeniedReason` struct, projected to the wire envelope by a single translator. Today four call sites build the envelope inline.\n2. **Latency budget.** The unrecognized path needs to do equivalent resolution work to the recognized-but-denied path before raising. The simplest design is an explicit small delay (50–100 ms?) on every denial path so the variance between branches is dominated by the budget rather than the code path. Document the budget tradeoff (extra latency on every denial vs. closing the side channel).\n3. **Audit / metric parity.** Today the recognized branches log `details.agent_url` and `details.status`; the unrecognized branch logs nothing. Need to converge on a uniform log shape — same operation label, same fields (with the discriminator either missing or hashed-then-truncated to prevent log scraping from becoming the side channel).\n4. **Header parity.** A2A and MCP transports both go through the framework's wire serializer. Verify Content-Length is within tolerance (the message strings are already identical post-#375; the variance is `details` size). Consider padding the unrecognized envelope to match a fixed byte count.\n\n## Tests\n\n- Latency parity test: assert p99 difference between unrecognized-agent and recognized-but-suspended paths is \u003c 5 ms over N requests (with the explicit budget set high enough that branch-comparison variance is negligible).\n- Header parity test: same Content-Type, Content-Length within ±N bytes (where N covers the `details` shape variance).\n- Side-effects parity test: same audit-sink writes, same metric increments with the same operation label.\n- Status code parity test: same HTTP status across all four denial paths.\n\n## Refs\n\n- #375 (rename portion shipped here).\n- Spec source (when available): `static/schemas/source/error-details/agent-permission-denied.json` line 10 — the elevation note.\n- Spec uniform-response MUST list: `error-handling.mdx` (Per-Agent Authorization Gate).\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)","author":{"url":"https://github.com/bokelley","@type":"Person","name":"bokelley"},"datePublished":"2026-05-03T00:43:31Z","url":"https://github.com/adcontextprotocol/adcp-client-python/issues/392"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:25ae0f59-cac1-0e55-3553-4fc54613c2f0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A62A:291B58:24A588:2E7DE2:6B00FF13 |
| html-safe-nonce | b828fffcd3c42e0b75b9ddc8557b216b13ae86e568985da553c588173df2fd1e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjJBOjI5MUI1ODoyNEE1ODg6MkU3REUyOjZCMDBGRjEzIiwidmlzaXRvcl9pZCI6Ijg2ODYyNzc0NzkxMTI5NjU5MDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 550a298b26b03daf40b7b14a08261f87e1e9238d1a02592a711378488cb68653 |
| hovercard-subject-tag | issue:4370471483 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/adcontextprotocol/adcp-client-python/392/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7e46748a67a4da3ce16da037453ba899e299ca7daa2af4e2b3964c3bde7aa93e/adcontextprotocol/adcp-client-python/issues/392 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7e46748a67a4da3ce16da037453ba899e299ca7daa2af4e2b3964c3bde7aa93e/adcontextprotocol/adcp-client-python/issues/392 |
| og:image:alt | Summary Follow-up from #375 (PR for the wire-code rename portion). This issue tracks the parity-contract refactor that was deferred from that PR per the user's stop-rule ("if the parity contract tu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bokelley |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| turbo-cache-control | no-preview |
| go-import | github.com/adcontextprotocol/adcp-client-python git https://github.com/adcontextprotocol/adcp-client-python.git |
| octolytics-dimension-user_id | 221690821 |
| octolytics-dimension-user_login | adcontextprotocol |
| octolytics-dimension-repository_id | 1090305973 |
| octolytics-dimension-repository_nwo | adcontextprotocol/adcp-client-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1090305973 |
| octolytics-dimension-repository_network_root_nwo | adcontextprotocol/adcp-client-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width