Repository navigation
feat(context): audit delivery receipts - #2792
Conversation
Problem: exact context-delivery receipts were durable but unavailable to the API and read-role MCP audit surfaces. What changed: add a recipient-scoped API lookup and a read-only MCP tool that returns the immutable context image, digest, evidence, omissions, and caveats. The receipt remains stored by the existing user-tier writer; no new manifest or scheduler is introduced. Compatibility: adds one API method and one read-role MCP tool. Ref polylogue-fs1.11. Co-Authored-By: Claude <[email protected]>
Add the read-role MCP discovery pin, minimal invocation arguments, and single-object envelope contract for recipient-scoped context-delivery receipts. Ref polylogue-fs1.11. Co-Authored-By: Claude <[email protected]>
|
Warning Review limit reached
Next review available in: 17 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
CI triage: this PR has the same external GitHub Actions failure signature as #2789. CI run |
Problem: the newly exposed delivery-receipt facade returned Any and the\nMCP boundary lacked a regression test for absent or recipient-mismatched\nreceipts.\n\nWhat changed: expose the durable receipt envelope in the facade contract,\ncompute the fixture digest from the rendered context image, and assert the\nMCP tool returns a uniform not_found response when no authorized receipt is\navailable.\n\nRef polylogue-fs1.11
|
Adversarial self-review iteration 1 Findings fixed:
What survived scrutiny:
Verification:
Ref polylogue-fs1.11 |
Problem: the receipt facade named its envelope only under TYPE_CHECKING,\nso runtime consumers using typing.get_type_hints received NameError.\n\nWhat changed: import the public receipt envelope at module scope and pin that\nget_type_hints resolves the exact optional envelope return contract.\n\nRef polylogue-fs1.11
|
Adversarial self-review iteration 2 Finding fixed:
What survived scrutiny:
Verification:
Ref polylogue-fs1.11 |
Problem: runtime introspection of the delivery payload mapper could not\nresolve its envelope annotation because it was imported only for static\ntype checking.\n\nWhat changed: expose the envelope at module scope and pin resolved mapper\ninput and output type hints.\n\nRef polylogue-fs1.11
|
Adversarial self-review iteration 3 Finding fixed:
What survived scrutiny:
Verification:
Ref polylogue-fs1.11 |
|
Adversarial self-review iteration 4 — zero new findings I refreshed from Final acceptance matrix:
Anti-vacuity evidence:
Final focused verification: Ref polylogue-fs1.11 |
…789,2792,2797 d3xj, w8et, w379 (cost-honesty, PR #2776), fs1.3 (hermes-wedge, PR #2789), and f2qv.5 (usage-convergence, PR #2797) fully satisfied — closed. cuxz (temporal-provenance, PR #2786), th0 (test-harness, PR #2777), and fs1.11/ fs1.12 (hermes-wedge cluster, PR #2792) partially satisfied — noted with disposition, left open per closure-discipline (no closing on partial ACs). Co-Authored-By: Claude <[email protected]>
… receipts Problem: fs1.11 shipped a minimal read-only Hermes recall leg (#2792: get_context_delivery API/MCP lookup over the existing context_deliveries ledger) but deferred auth/scheduler to polylogue-37t.11 (open, out of this cluster). The 2026-07-10 Nous follow-up refinement separately asked to "persist the context token budget and rendered-token estimate alongside the exact rendered-byte hash" and "correlate each delivery with the Hermes snapshot revision and the durable context-delivered event from fs1.7/fs1.2" -- fs1.7's spool (this branch, prior commits) is what that correlation needed and did not exist before now. Finding: token budget and rendered-token estimate were already persisted (context.compiler.context_snapshot_record_from_image writes metadata["max_tokens"]/metadata["token_estimate"]) -- no new write needed there, only exposure. The event-correlation half was genuinely missing. Solution: context/hermes_delivery_correlation.py is a read-side join, not a new write path or schema (consistent with fs1.11's own design directive to extend the existing ledger rather than create another manifest): a Hermes producer that injects a compiled context pack emits a context_injected lifecycle event (fs1.7's spool) whose payload carries the snapshot_ref it received; this module resolves that id against the existing context_deliveries receipt across the two durable tiers (source.db spool + user.db ledger). An event with no resolvable receipt renders an explicit available=False row with a caveat -- archive outage or a not-yet-committed write is visible, never silently skipped (fs1.11 AC). Wired onto the public facade as Polylogue.correlate_hermes_context_deliveries (added to BESPOKE_METHODS + a dedicated contract test, per the existing "every public async method is categorized" completeness gate). No new MCP tool: extending the MCP tool surface has ripple costs (EXPECTED_TOOL_NAMES, tool contracts, generated docs, and role-allowlist config that lives in the sinnix repo, not here) disproportionate to this pass; the API method is fully queryable/testable without it, and adding the MCP tool is a small, clean, separately-reviewable follow-up. Verification: devtools test tests/unit/context/test_hermes_delivery_correlation.py tests/unit/api/test_facade_contracts.py -k "hermes or context_delivery" -- 9 passed, including the exact-bytes-hash/token-budget/rendered-estimate correlation happy path, a missing-receipt caveat, and a malformed (no snapshot_ref) event caveat. Ref polylogue-fs1.11. Co-Authored-By: Claude <[email protected]>
Summary
Expose existing immutable context-delivery receipts through a recipient-scoped API lookup and a read-role MCP audit tool.
Problem
The user-tier receipt writer already persists the exact context image, hash, evidence references, omissions, caveats, recipient, and delivery boundary. There was no supported API/MCP path to recover that evidence after delivery.
Solution
Polylogue.get_context_delivery(snapshot_ref, recipient_ref=...), which returns a receipt only when its persisted recipient matches.get_context_delivery, returning the exact stored image and SHA-256 through a typed payload; mismatch and absence both return not-found.Acceptance criteria
Anti-vacuity
test_get_context_delivery_scopes_exact_receipt_to_recipientwrites a real durable receipt, then exercises the facade against user.db. Removing the user-tier reader or recipient equality check makes it fail.test_get_context_delivery_reads_recipient_scoped_facade_receiptinvokes the real MCP tool and asserts the exact image/hash plus facade call. Removing the tool, facade call, or payload mapper makes it fail.Verification
nix develop --command devtools test tests/unit/api/test_facade_contracts.py tests/unit/mcp/test_server_surfaces.py -k context_delivery— 3 passed, 337 deselected.nix develop --command devtools test tests/unit/mcp/test_server_surfaces.py tests/unit/mcp/test_envelope_contracts.py -k 'server_surface_contract or RegistryWideClassification'— 7 passed, 103 deselected.nix develop --command devtools verify --quick— passed all 15 checks.The broad MCP discovery test run was interrupted by its supervisor after the envelope suite and produced no result summary; it is not claimed as passing.
Ref polylogue-fs1.11
Ref polylogue-fs1.12