Repository navigation
fix(compliance): route hosted multi_agent governance storyboards to the public governance agent - #7779
fix(compliance): route hosted multi_agent governance storyboards to the public governance agent#7779bokelley wants to merge 4 commits into
Conversation
…he public governance agent Storyboards that declare `requires: [multi_agent]` send their plan-setup and intent-check steps (`agent: governance`) to a governance agent. Hosted grading ran them single-URL, so a governance-aware seller could never complete them (#7758). Add hostedMultiAgentRoutingForStoryboard(): the storyboard's default_agent routes to the agent under test with the owner's credentials, `governance` routes to the public test agent's /governance/mcp tenant with the public test-agent credential from server config, and any other agent key makes the storyboard unroutable rather than sending it to the seller. Every routed entry carries explicit auth so the SDK's run-level auth fallback cannot hand the owner credential to the governance agent. The governance endpoint comes only from server config; the authored governance_agent_url must share its origin and is pinned over caller context. Governance steps that pull test-kit credentials and runs with shared headers are refused. Wire it into Addie's run_storyboard. The heartbeat's comply() cannot take per-storyboard routing on @adcp/sdk rc.51 (runStoryboard rejects `agents` with the positional URL comply() passes), so heartbeat wiring needs an SDK hook. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Run a routed multi_agent storyboard through the real @adcp/sdk runner against two loopback MCP agents, with the owner credential at run level and in the test kit as hosted runs set it. The governance agent sees only the governance credential and receives sync_plans; the seller sees only its own credential and never receives sync_plans. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
- Suffix governance plan ids with a per-run nonce so concurrent runs, or anyone holding the public token, can't overwrite the plan a run grades against on the shared governance tenant. - Refuse step-level credentials on every step not pinned to the agent under test (unpinned steps can route to governance by protocol), and `$test_kit.auth` references in storyboard context. - Return the governance-served step ids; run_storyboard skips them for OAuth detection, labels them in output, and notes the shared sandbox state they write. - Rename HostedAgentUnderTest.transport to protocol. - Wire test returns schema-valid responses and asserts both routed steps executed and passed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — server-only multi-agent routing for hosted governance-storyboard grading.
What I checked:
- No protocol surface touched (
static/schemas/source/**,docs/reference/**, task defs,dist/**all untouched), so the omitted changeset is correct per the changeset-scope rule. - Credential isolation is sound and proven on the wire — each agent sees only its own bearer; governance endpoint/credential are config-only and origin/HTTPS-pinned.
high_riskis true only becauseserver/src/addie/mcp/member-tools.ts(modified) matchesserver/src/addie/**. The reviewer found no medium-or-higher concern on that modified file, so the modification is presumed contract-preserving. No(deleted)reason present.gated_paths: false; no no-auto-approve team match.
Medium findings (1 — non-blocking):
- server/src/compliance/hosted-multi-agent-routing.ts:97 —
trainingAgentCallerIdentityForTokenderives caller as a bare 32-char key_id while the registry form appears to besha256:<hash>, and its validating test is circular. Non-blocking: governance-served steps are already documented as non-functional end-to-end.
Decision table: no critical/high (row 1 no); gated_paths false (row 2 no); no deleted high-risk file (row 3 no); the single medium is not data-loss/schema/infra category (row 4 no); high_risk modified + medium would trigger row 5 — but the reviewer posted the medium against hosted-multi-agent-routing.ts, which is NOT the high-risk server/src/addie/** file, so row 5 does not fire; no prior escalation (row 6 no); no team gate (row 7 no); only 1 medium, below the 3-medium threshold (row 8 no). Falls through to row 9 → approve.
…ticator The cross-check fed our own bare-hex key_id to the training agent's registry, so it couldn't catch a key_id format change. Derive the credential through @adcp/sdk verifyApiKey, which the training agent uses, so a prefix or length change breaks the test. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Superseded by #7808, which rebases this PR's four commits onto main (stacked on the fixtures in #7803) and finishes them. It adds the hosted-grader buyer credential (decision B4), the hosted-grader brand.json and governance JWKS host (decision D), and the per-run seller credential in sync_governance. It also wires the heartbeat and registry refresh through the SDK's |
Part of #7758. This PR does not close it: the heartbeat itself still can't route these storyboards until the SDK change described below lands.
Summary
Storyboards that declare
requires: [multi_agent](media_buy_seller/governance_{approved,conditions,denied,denied_recovery}, plus the brand-rights, signal-marketplace, and creative-transformersgovernance_approvedstoryboards) send their plan-setup and intent-check steps (agent: governance) to a governance agent. Hosted grading runs them against a single URL, so a seller that claimsgovernance-aware-sellercan't complete them.server/src/compliance/hosted-multi-agent-routing.ts.hostedMultiAgentRoutingForStoryboard()returns one of three results:single_agent: the storyboard doesn't requiremulti_agent, so the run is unchanged.routed: the storyboard'sdefault_agentgoes to the agent under test with the owner's credentials, andgovernancegoes to the public governance agent.unroutable: the storyboard can't be routed, with a reason. This covers any other agent key, a missingdefault_agent,default_agent: governance, a storyboard with no governance route, or an authoredgovernance_agent_urlon another origin. An unroutable storyboard is never sent to the agent under test.PUBLIC_TEST_AGENT_URLS.governance(https://test-agent.adcontextprotocol.org/governance/mcp), authenticated withPUBLIC_TEST_AGENT.token(envPUBLIC_TEST_AGENT_TOKEN, otherwise the documented public token). It has the same origin as the storyboards' authoredgovernance_agent_url.seller_agent_url(and the other governed-agent keys) is set to the endpoint under test, as the storyboards' prerequisites instruct.governance_agent_urlis pinned to the authored value.check_governancecaller. On governance-routedcheck_governancesteps,calleris rebound to the identity the training agent binds to our credential. Its governance handler rejects acallerthat differs from the authenticated identity.sync_plansplan ids get a random per-run suffix, and later steps read the id back through$context.plan_id.callerrebind and the plan-id suffix are applied to a copy of the storyboard.run_storyboard, the hosted per-storyboard run against a member's agent. A claimant can now run these storyboards routed instead of gettingrequirement_unmet.multiAgentRoutingForStoryboard(). That helper is for the training-agent harness. This one is separate to avoid a conflict, and its trust model is different: a third-party agent under test, and a fixed governance agent.The heartbeat gap (needs an SDK change)
The heartbeat grades through
comply(). It can't be given routing on@adcp/sdkrc.51:ComplyOptionshas noagentsordefault_agent.comply()builds one sharedrunOptionsfor every storyboard and callsrunStoryboard(agentUrl, sb, runOptions)with the positional URL.runStoryboardthrows whenagentsis combined with a non-empty positional URL (validateAgentsMap). So passingagentsthroughcomply()would break every storyboard, and it would also route storyboards that aren't multi-agent.ComplianceResulteither. Badges come frombundle_results, which the SDK computes from rawStoryboardResults thatcomply()doesn't return.Proposed SDK ask (adcp-client): a per-storyboard hook on
ComplyOptions. For example,routeStoryboard?(sb) => { agents, default_agent, context } | { skip: string } | undefined. When it returns a route,comply()callsrunStoryboard('', sb, { ...runOptions, ...route }); when it returnsskip, it records a not-runnable skip with that reason.hostedMultiAgentRoutingForStoryboard()already has that return shape. Wiring the heartbeat, andregistry-api's refresh, which also usescomply(), is then a few lines inserver/src/addie/services/compliance-testing.ts#comply.Known end-to-end gaps on the public governance agent (not fixed here)
Routing gets
sync_plansandcheck_governanceto the governance agent. On the current public governance agent, though, a correct third-party seller still can't complete the governed commit:gov-token-xxxxxxxx…insync_governance. The seller's execution-timecheck_governancewould present that credential, and the training agent doesn't accept it: it's neither the public token nordemo-*-vN.target_agent(its own URL). A bearer credential maps to…/authenticated/<hash>, so the check fails.iss = https://test-agent.adcontextprotocol.org/governance, while the registered URL ishttps://test-agent.adcontextprotocol.org, and brand.json foracmeoutdoor.exampleisn't resolvable. fix(training-agent): accept the training governance service's own tokens at governed tenants #7757 special-cases this only for the training agent's own sales tenant.Expected result once the heartbeat is wired: the plan-setup and intent steps pass, and failures move to the seller-side governed steps (
create_media_buy,get_plan_audit_logs). These need test-agent or test-kit follow-ups before a claimant can reachpassing.Security notes
governance_agent_urlon another origin makes the storyboard unroutable, and caller-suppliedcontext.governance_agent_url/seller_agent_urlare overwritten.auth. I checked the SDK source (agent-routing.jsbuildAgentOptions:auth: entry.auth ?? options.auth). Because of that fallback, a governance entry without auth would inherit the owner's credential. Tests pin that the governance entry always has its own auth, including when the seller has none. The public credential never appears on the seller entry, in context, or in the patched storyboard.test_kit.auth.api_key(withHostedAuthTestKit). Step-levelauthdirectives and$test_kit.authreferences are therefore refused on every step not pinned to the agent under test, and$test_kit.authreferences are refused in storyboard context. Unpinned steps are included because they route by protocol and can land on governance. None of the shipped storyboards have such directives or references.headersacross routed agents, sowithHostedMultiAgentRouting()refuses to route a run that sets them. No hosted path sets them today.transport, sowithSdkSafeTransport'ssdkSafeFetchguards both routes. The agent URL is still validated byvalidateAgentUrlbefore routing. The governance URL must be HTTPS.Testing
npx vitest run --config server/vitest.config.ts server/tests/unit/hosted-multi-agent-routing.test.ts server/tests/unit/hosted-multi-agent-routing-wire.test.ts: 28 passed (27 unit + 1 wire).multi_agentstoryboards route;key_idfrom the SDK'sverifyApiKeyand resolving it throughtrainingBuyerAgentRegistry.sync_plans. The seller receives only its own bearer and never getssync_plans. Both steps execute and pass. It takes about 12s, which is SDK schema compilation and validation CPU, not a timeout; its own timeout is 60s.npx tsc --noEmit -p server/tsconfig.json: passes.HUSKY=0because hooks are slow on the shared dev box. CI runs the full suite.Risks
run_storyboardclaimants now get a routed run that makes real calls to the public governance agent (sync_plans,check_governance, …) under the public credential. Before, they got arequirement_unmetskip.acmeoutdoor.example), so plan records from different runs coexist in one sandbox session. Only the plan ids are per-run.🤖 Generated with Claude Code