fix(trace): add missing agent_identity fields to the trace claim schema - #632
Conversation
Closes agentrust-io#622. The gateway.agent_identity object in trace-claim.schema.json declared 8 properties while AgentIdentityOut carries 11. The three missing ones, intent_hash, agent_key_thumbprint, and enforcement_mode, reach the signed claim whenever an Agent Manifest binding is configured, which is the default once agent_manifest is set. Any such deployment was signing a claim that failed its own normative schema, a violation of TRACE-001. Adds the three properties to the schema, documents the schema evolution policy in SPEC.md so future additions do not repeat this, updates the agent_identity field table in session-policy.md, and adds a regression test that builds a claim with all three fields set and validates it against the schema. Verified the new test fails on the unmodified schema and passes once the properties are added.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
the regression test |
… subject The regression test in this PR carries intent_hash and enforcement_mode but not agent_key_thumbprint, so a third of the schema change had no coverage. Caught by @rajnisht7 in review. Adding it to the existing case would have pinned a combination the runtime is documented never to emit: session/manager.py omits the thumbprint deliberately because AgentManifestBinding carries no agent key bytes, and the schema says it is only ever set when subject_source names a live-authenticated source, while that test uses subject_source="config". So this is a sibling test with subject_source="svid", which is the shape the schema must already accept on the day agentrust-io#425 wires a real key source. Verified in both directions: it fails against main's schema and passes against this branch's. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X27MBo6tGVw1UmmchuGFnW
imran-siddique
left a comment
There was a problem hiding this comment.
Approving. Both halves of the #622 ruling are here: the three properties in schemas/trace-claim.schema.json, and the statement in docs/spec/session-policy.md that a verifier MUST NOT reject a claim solely for carrying members its own copy of the schema does not declare, with trace-spec#116 named as the general case. The second half is the part that stops this recurring for whoever pinned the old file.
@rajnisht7 was right that agent_key_thumbprint had no coverage, and I have pushed it as 77e94d0 rather than send this back for one line.
It needed a sibling test rather than an addition to the existing one, and the reason is worth recording. session/manager.py:385 omits the thumbprint deliberately, because AgentManifestBinding carries no agent key bytes yet, and the schema description says it is only ever set when subject_source names a live-authenticated source. The existing case uses subject_source="config", so setting the thumbprint there would have pinned a combination this runtime is documented never to emit. The new test uses subject_source="svid", which is the shape the schema has to accept on the day #425 wires a real key source.
Verified in both directions: it fails against main's schema and passes against this branch's. Full CI green on 77e94d0, including all six test matrix jobs and governance.
Merging.
Closes #622.
gateway.agent_identity in schemas/trace-claim.schema.json declared 8 properties, while AgentIdentityOut (src/cmcp_runtime/audit/trace_claim.py:156) carries 11. The three missing ones, intent_hash, agent_key_thumbprint, and enforcement_mode, reach the signed claim whenever an Agent Manifest binding is configured. Since enforcement_mode defaults to enforcing and startup.py always supplies it, any deployment with a manifest binding was signing a claim that failed the project's own normative schema, a TRACE 001 violation.
imran-siddique confirmed the exact numbers and ruled on direction in the issue thread: fix the schema, not the code, since these three fields are real evidence rather than incidental plumbing. He also asked for a second part, a stated policy for what a verifier does when it meets claim members it does not recognize, since additionalProperties false on an evidence format that grows fields over time is the same problem tracked at agentrust io/trace spec#116, evidence outliving the verifiers that check it.
What this PR does
Adds intent_hash, agent_key_thumbprint, and enforcement_mode to gateway.agent_identity in the schema, matching the patterns and enum already used on the model and its sibling fields.
Adds a schema evolution paragraph to SPEC.md stating that additionalProperties false is a producer side authoring aid, not a contract external verifiers should enforce against a pinned older copy of the schema, and that a verifier should not reject a claim solely for carrying members it does not yet know. Cites trace spec#116 and names this issue as its first concrete instance in cmcp.
Updates the agent_identity field table and prose in docs/spec/session-policy.md so the docs describe all three fields, not just agent_key_thumbprint.
Adds a regression test in tests/unit/test_trace_claim.py that builds a claim with intent_hash and enforcement_mode set through generate_trace_claim and validates it against the schema. Confirmed it fails on the schema as it stood before this change and passes after.
Testing
Ran the full test suite, 1736 passed, 14 skipped. Three failures are present on main as well, unrelated to this change, all subprocess module resolution issues in a local editable install rather than anything to do with the schema or trace claim code. Ran ruff on the touched files, clean.