Skip to content

feat(agent-readiness): compliance document search, signing bound to the reviewed subject, required rationale (AGB-79) - #739

Closed
nimrodbusany wants to merge 6 commits into
developfrom
feature/agb-79-compliance-evidence-next
Closed

nimrodbusany wants to merge 6 commits into
developfrom
feature/agb-79-compliance-evidence-next

Conversation

@nimrodbusany

Copy link
Copy Markdown
Contributor

What

Three contract changes for the agent Compliance evidence feature (follow-up to #721 and #728). The feature is behind a server flag that is off in production.

Ticket: AGB-79
Security note: public schema only. Field definitions and operation shapes; no customer data, no secrets. The search text is declared as a request-body field so it never appears in a URL. The signing change tightens an access-controlled operation (a stale review token is refused).
Spine-Trail: st_f6fb29f7a817

  1. Document reference search. A new operation, POST /api/v1/projects/{project_id}/agents/{agent_ref}/compliance-document-refs/search (project_compliance_document_refs.search_compliance_document_references), with the request body DocumentReferenceSearchRequest. The search text travels in the body only, never in the URL.
  2. Signing is bound to what the signer reviewed.
    • Each attestation row (kind: A) of the evidence response carries review_context: 64 lowercase hex characters, or null when the caller cannot sign that row.
    • AttestationCreateRequest.review_context is now required.
    • A stale value gets a closed 409 with reason stale_review_context. A closed 503 is declared for the case where the server cannot issue or check the value.
  3. A "not applicable" decision needs a reason.
    • In DecisionInput, a decision of not_applicable requires a rationale that contains at least one visible character.
    • The schema pattern rejects the blank characters of the Basic Multilingual Plane. The server applies the full rule (Unicode categories Z, Cc and Cf count as blank) and is the authority.
    • The rejection is a closed 400 with reason rationale_required (RationaleRequiredError).

Breaking changes

Items 2 and 3 tighten request contracts. Both are recorded through the repo's own mechanism, scripts/breaking_schema_allowlist.json; the checker itself is unchanged. No client other than the Traigent portal calls these operations, and the feature is off in production.

Related PRs

  • TraigentBackend: to follow (pins this branch's commit, then re-pins to the merge commit).
  • TraigentFrontend: to follow.

Merge order: this PR first, then the Backend, then the Frontend.

Production-safety checklist

  1. Policy surface? Yes: the contract of an access-controlled signing operation.
  2. Fails closed in production? The contract declares closed 409 and 503 responses; enforcement is in the Backend PR.
  3. Public API or schema change? Yes, described above.
  4. Tenant scoping? Unchanged. No tenant or project field is added to any request body.
  5. Tests prove it? Contract tests for each change: tests/test_compliance_attestation_contract.py, tests/test_compliance_document_ref_contract.py, tests/test_compliance_evidence_contract.py, tests/test_compliance_applicability_contract.py.
  6. Operator step? None.

Verification

  • make local-gate on head 9d9be8b: passed (ruff, mypy, pytest 8015 passed / 1 skipped, parity, breaking-change check).
  • scripts/breaking_schema_check.py --check: passes with the allowlist entries above.
  • scripts/refresh_parity.py --check: OK.

Review

Each change had an independent second-model review of the code before this PR opened, with one follow-up read of the fixes. The schema pattern for item 3 was checked to be valid in both Python and ECMAScript regular-expression syntax and never stricter than the server rule.

Wording

The feature shows evidence coverage only. It makes no claim that an agent meets, or is approved under, any law.

🤖 Generated with Claude Code

nimrodbusany and others added 6 commits November 19, 2026 02:32
…ubstring (AGB-79 B2b)

Adds POST .../compliance-document-refs/agents/{agent_id}/search
(searchComplianceDocumentReferences, x-replay: read) and the closed
DocumentReferenceSearchRequest. The search text is customer content, so it
travels in the body only; the response is the existing list response.

Spine-Trail: st_f6fb29f7a817

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
…e reviewed subject (AGB-79 C1)

Ingredient gains review_context on A rows (a 64-hex string or null, absent on other kinds):
an opaque, server-issued, keyed freshness token. AttestationCreateRequest gains a REQUIRED
review_context to echo it; a stale value is refused with 409 stale_review_context and nothing is
recorded. The sign operation also declares a 503 for when the server cannot issue or verify the
token. Coordinated pre-release break, acknowledged in scripts/breaking_schema_allowlist.json.

Spine-Trail: st_f6fb29f7a817

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
…res a rationale (AGB-79 R4)

DecisionInput gains an if/then: when decision is not_applicable, rationale is required and must hold
a non-whitespace character (cap unchanged); applicable and unresolved keep it optional and a carry
item is not re-validated. The write's 400 also admits the closed RationaleRequiredError
(rationale_required, fixed message, no obligation id, no client text). Coordinated pre-release
break, acknowledged in scripts/breaking_schema_allowlist.json.

Spine-Trail: st_f6fb29f7a817

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
…tern (AGB-79 R4)

Replace \S with an explicit class excluding Z*, Cc and Cf BMP code points.

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Search operation moved to /api/v1/projects/{project_id}/agents/{agent_ref}/compliance-document-refs/search
(project_compliance_document_refs.search_compliance_document_references); AGB-79 allowlist entries regenerated for the new paths.

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@nimrodbusany

Copy link
Copy Markdown
Contributor Author

Superseded by #768 (same changes, consolidated into one commit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant