Skip to content

Add non-dispatching PIC approval adapter and real-verification recovery scenarios - #4

Merged
arjun2075 merged 5 commits into
arjun2075:work/retry-recovery-fixturefrom
madeinplutofabio:feat/pic-approval-adapter
Nov 4, 2026
Merged

arjun2075 merged 5 commits into
arjun2075:work/retry-recovery-fixturefrom
madeinplutofabio:feat/pic-approval-adapter

Conversation

@madeinplutofabio

@madeinplutofabio madeinplutofabio commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Adds the signed-approval side of the retry-recovery fixture (#2), for
modelcontextprotocol/modelcontextprotocol#3394, implementing the non-dispatching
adapter contract proposed in adapter-contract.md.

What this adds

  1. test(retry-recovery): vendor PIC refund example and add baseline runner:
    the refund example at eb7cd467, vendored byte-for-byte with its Apache-2.0
    licence and a SHA-256 manifest, plus a runner that executes its own checks in a
    disposable copy.
  2. feat(retry-recovery): add non-dispatching PIC approval adapter:
    pic_adapter/ (verifier, worker-scoped test clock, worker subprocess, async
    client), keyring fixtures and tests.
  3. feat(retry-recovery): integrate real PIC approval verification into recovery scenarios:
    an opt-in approval mode in recovery.py, 17 MCP approval scenarios in
    run_cases.py, the implemented contract, README updates and regenerated
    results.json.
  4. fix(retry-recovery): refuse optimized runs and reject malformed baseline probes:
    run_cases.py refuses to run under python -O or PYTHONOPTIMIZE, since its
    scenario validation uses assert; the baseline checker validates the original
    probe and case lists instead of silently dropping malformed entries.
  5. test(retry-recovery): exercise A03 signer revocation with real PIC verification:
    two MCP scenarios that complete an operation under a valid approval, then retry
    after signer revocation with disclosure allowed and denied.

The original 10 MCP cases and 8 policy tests are unchanged and still pass.

Executed

Python 3.11.9, mcp==2.2.0, pic-standard[crypto] at 330fdd81 (verified from
installed metadata):

  • run_cases.py: 10/10 original cases; 19/19 approval cases with real pinned PIC
    verification in one worker (37 verifications, no replacement).
  • Unit tests: 113 pass (recovery policy including synthetic approval-mode tests,
    adapter through a real worker, baseline runner, optimized-mode refusal).
  • Vendored baseline: 22 cases, 2 integrity probes and 7 self-checks pass.

Approval scenarios cover R01, R05, A01, A02, A03 under a candidate recovery policy
(signer revoked, disclosure allowed/denied), A04 (disclosure allowed/denied), A05
(tenant, principal), A06 and a tampering control, A07 and a decision-mismatch
control, a replay control, a T04-style positive control, and new effects under an
expired approval and under a revoked signer. Each attempt asserts provider
effects, delivered status and client-reported outcome; adapter decisions are
asserted whenever verification is invoked. Details: README "Executed approval
subset".

Answers to the review questions in #2

  • Keyring injection: supported (PipelineOptions.key_resolver). Clock: no SDK
    parameter; a worker-scoped test clock patches only the two modules that read
    time, as test instrumentation, not a PIC clock API.
  • Reportable outputs: check statuses distinguish pass, fail, not_evaluated
    and unavailable. signer_trust is the configured keyring status of the
    evidence key_id; it does not establish that the proposal was signed by it.
  • Environments: MCP and PIC verification share one dependency environment. The
    upstream self-check uses a separate environment because it temporarily modifies
    installed package metadata. Verification runs in a separate process only to
    isolate vendored module names and the test clock.

Provisional, open for review

  1. A03 recovery after signer revocation: exercised under the candidate policy
    described below; the policy itself remains open for review.
  2. Same verified decision under a fresh operation id: currently conflict;
    returning the original outcome is an alternative.
  3. The cross-context decision-id check.
  4. Reason codes added during implementation (proposal_rejected,
    verification_incomplete, clock_rejected, verifier_unavailable) and the
    checks.expected_action extension.

Relation to ryjen's A03 / T01-T03 review

  • A03: now exercised with real PIC verification. The same signed proposal is
    verified against two fixture keyring snapshots, before and after revocation;
    the revoked approval is rejected (signer_revoked) and cannot authorize new
    execution. Under the candidate policy, the retry returns the original receipt
    when disclosure is allowed and denied with no receipt marker when it is
    denied, with one provider effect in both cases. Receipt access rests on the
    harness-owned authenticated context, the scoped retained record and current
    disclosure permission, never on the rejected proposal. This covers the real
    verification part Arjun left pending; the recovery policy itself remains open
    for review.
  • T01-T03 (retention/pruning) are harness-side and not part of this PR.

Not claimed

The provider, recovery store and caller authorization are synthetic. A05 shows
the context change is rejected without returning the receipt; it does not
establish existence hiding. No exactly-once remote effects, durability, restart or
concurrency safety, pruning behaviour, adopted MCP semantics or merged conformance
test, and no change to PIC.

Copy link
Copy Markdown
Owner

Thanks @madeinplutofabio — this is substantial progress, and it addresses the PIC verification dependency we had left open after @ryjen's A03 review.

I reviewed the adapter contract and the recovery integration. The separation between signed-approval verification, new-effect admission, retained-operation recognition, and historical-result disclosure is the right direction.

I particularly appreciate that the implementation distinguishes real PIC verification from the synthetic caller authorization and recovery policy, and that the test clock is documented as worker-scoped instrumentation rather than an SDK capability.

A few points I'd like to preserve before merging:

  1. Keep A03's recovery-after-revocation behavior explicitly provisional. Historical disclosure must be grounded in independently authenticated operation ownership and current disclosure permission, never the rejected approval.
  2. Preserve the distinction between the verified decision's identity and the logical operation identity. The fresh-operation-ID conflict behavior and cross-context decision binding need explicit review before treating them as interoperability requirements.
  3. Keep the added reason codes and adapter response fields fixture-local pending agreement.
  4. Ensure the final validation record distinguishes real PIC verification from synthetic authorization, disclosure and recovery-store behavior.

I'll review the implementation and committed test evidence against these boundaries. T01–T03 can proceed as a separate retention increment so we avoid coupling pruning behavior to the PIC adapter.

Thanks for making this an executable contribution rather than leaving A03 as a proposed test vector.

@madeinplutofabio

Copy link
Copy Markdown
Contributor Author

Thanks @arjun2075. Agreed on all 4 boundaries. They remain explicit in the contract, README and committed validation record: A03 is a candidate recovery policy, decision and operation identities remain separate, and the response fields and reason codes are fixture-local. PIC verification is real; caller authorization, disclosure and recovery storage remain synthetic. I’ll preserve those distinctions through review and keep T01–T03 separate.

@madeinplutofabio

Copy link
Copy Markdown
Contributor Author

Hi @arjun2075, thanks for independently running #4 and building the retention increment on it. Is there anything you need from me to complete the adapter review, or should I keep waiting for your implementation review?

@arjun2075

Copy link
Copy Markdown
Owner

Hi Fabio — thanks for following up. Nothing further is needed from you on the implementation at this stage.

I independently reproduced the #4 validation results at f01ccb4, and the retention work in #5 is intentionally separate from your adapter.

I’m completing the final implementation review, particularly the non-dispatching verification boundary, failure-closed behavior, and decision-to-operation binding. I’ll raise any concrete findings directly on this PR.

Could you mark #4 ready for review? Once the review is closed, the plan is to integrate #4 into the retry-recovery branch, then bring in #5. The A03 recovery policy and fixture-local semantics will remain explicitly provisional.

Thanks again for the substantial contribution.

@madeinplutofabio
madeinplutofabio marked this pull request as ready for review November 2, 2026 16:59

@arjun2075 arjun2075 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the non-dispatching PIC verification boundary, worker isolation, fail-closed client behavior, and decision/operation separation against the committed independent validation evidence at f01ccb4. The archived rerun records 113 passing unit tests, 10/10 original MCP cases, 19/19 real-PIC approval cases, and a passing vendored PIC baseline. Approved for integration as an experimental fixture only. A03 recovery-after-revocation, fresh-operation-ID conflict handling, cross-context binding, and added adapter codes/fields remain provisional fixture choices, not MCP/PIC conformance requirements. Retention/pruning remains separately scoped to #5; no durability, exactly-once payments, or production auth claims.

@arjun2075
arjun2075 merged commit cc829ef into arjun2075:work/retry-recovery-fixture Nov 4, 2026
arjun2075 added a commit that referenced this pull request Nov 4, 2026
Integrate the full experimental MCP lost-response/retry-recovery harness, PIC signed-approval verifier (PR #4), and retention/readback increment (PR #5) into main.

Preserve staged evidence and explicit limitations: synthetic effect and authorization model, no durable/concurrent safety, and provisional policy semantics. Reconcile docs and final PR description with the tested scope.
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.

2 participants