Skip to content

Phase 2: bind and verify the whole outbound context #53

Description

@johnnygreco

Objective

Issue attestation v2 over the complete ordered user/tool context immediately before sending and verify the provider wire body against that exact subject.

Context

  • Tracker: GitHub goal delivery: close Pi attested-admission gaps #50
  • Append-time admission protects storage; provider-context admission protects the model and is the only operation that issues an attestation.
  • Stateless design is required; Phase 2b ledger is optional and not part of this issue.

Scope

  • Runtime adapter: derive full ordered entries, admit provider_context, apply per-index replacements, and bind handle lookup to the final admitted context.
  • Egress Gate: add provider-context adapter; attestation v2 subject hash/count; adapters derive all user/tool entries from Chat Completions and Responses bodies; verify before and after gate mutations; append-time allows return empty attestation.
  • OpenShell: allow an admission allow with empty attestation to return no handle.
  • Shared golden vectors pin JS/Python context-entry derivation.
  • Non-goals: persistent provenance ledger, assistant/system-prompt hashing, caller identity.
  • Dependencies: Phase 1.

Acceptance Criteria

  • Any earlier-entry mutation, insertion, or deletion is denied with stable reason codes.
  • Matching multi-turn Chat Completions and Responses requests pass.
  • Send-time replacements bind the replacement and reject the original.
  • Append-time admissions issue no handle; exactly one provider-context bridge call occurs per provider request.

Required Validation

Research make check; JS golden-vector tests; focused OpenShell bridge tests; current Pi admission tests and npm run check.

PR Expectations

Reviewer notes must reproduce the canonical entry derivation and hash/count checks, and state the intentional assistant/system exclusions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions