Skip to content

feat(trace): host execution trace + replay oracles (contextgraph-trace, sketch)#45

Merged
macanderson merged 1 commit into
mainfrom
feat/host-trace-oracles
Jul 23, 2026
Merged

feat(trace): host execution trace + replay oracles (contextgraph-trace, sketch)#45
macanderson merged 1 commit into
mainfrom
feat/host-trace-oracles

Conversation

@macanderson

Copy link
Copy Markdown
Owner

What

The provider conformance suite holds a provider honest; nothing holds the host-side agent loop honest. This PR adds the protocol-side substrate for benchmarking that loop, at sketch stage:

  • docs/sketches/host-trace.md — a design sketch (non-normative, in the push-invalidation.md tradition) for an append-only NDJSON journal a harness — or a Harbor-adapter-style shim observing one — emits while it works: turns, prompt assemblies, tool-call pairing, context/verify observations, side effects, crashes and resumes. The journal reuses the protocol's identity spine (FrameId, wire Verdict) and no frame body ever travels in it — identities and costs only, the same economy context/verify runs on.

  • contextgraph-trace — a new unpublished workspace crate (deps: contextgraph-types + serde only) with the journal wire types and eight pure replay oracles, in the conformance suite's vocabulary (named checks, pass/fail/skip, evidence naming exact seq numbers):

    Check Catches
    sequence-integrity non-dense seq, unbalanced turns, events after session end
    turn-loop-pairing phantom tool executions, orphan/duplicate results, prompts issued over unresolved calls
    assembly-budget-honesty §B1/§B3 at the point of assembly; nonzero-cost reference frames
    staleness-at-use frames rendered after a stale/gone verdict (§4 V2 — citing dead evidence)
    citation-at-use §F3 held at the prompt, not just the provider boundary
    deterministic-composition §1 prefix stability, finally checkable via composition_digest
    effect-exactly-once side effects replayed across a crash-resume (the double-git push bug)
    resume-integrity resumes blind to their own durable record — work loss, quantified
  • Adversarial fixtures in the --misbehave tradition: two golden journals (clean run; crash + lossless resume) that pass, and one fixture per check that trips exactly that check — asserted by the integration suite.

Why here

Per the design discussion: the protocol repo defines the measurable surface (trace vocabulary + oracles, portable to any CGEP host); the benchmark runner (chaos scheduling, scripted-model cassettes, task generators, memory-ablation arms) lives with the system under test and is deliberately absent. Where that runner lands — internal vs. a public agent-agnostic runner with per-harness adapters — is an open question recorded in the sketch, and the journal contract is designed so either works.

Notes

  • No wire shape or SPEC.md change; nothing here is normative. The crate inherits publish = false.
  • cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, and cargo test --workspace all green locally (21 new tests).
  • Open questions (runner location, probe vocabulary, resume-shortfall severity, JSON Schema, publication) are recorded in the sketch doc.

…e, sketch)

The provider conformance suite holds a provider honest; nothing holds the
host-side agent loop honest. This adds the missing half at sketch stage:

- docs/sketches/host-trace.md — an append-only NDJSON journal a harness
  (or a Harbor-adapter-style shim observing one) emits while it works,
  reusing the protocol identity spine (FrameId, wire Verdict), carrying
  no frame bodies.
- contextgraph-trace (new unpublished workspace crate, deps:
  contextgraph-types + serde only) — the journal wire types and eight
  pure replay oracles: sequence-integrity, turn-loop-pairing,
  assembly-budget-honesty, staleness-at-use, citation-at-use,
  deterministic-composition, effect-exactly-once, resume-integrity.
- Adversarial fixtures in the --misbehave tradition: two golden journals
  that pass, and one fixture per check that trips exactly that check.

No wire shape or SPEC.md change; nothing here is normative.
@vercel

vercel Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
context-graph-protocol Ready Ready Preview, Comment Jul 23, 2026 8:17pm

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @macanderson, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@macanderson
macanderson marked this pull request as ready for review July 23, 2026 20:21
@macanderson
macanderson merged commit 6f8d7ef into main Jul 23, 2026
14 checks passed
@macanderson
macanderson deleted the feat/host-trace-oracles branch July 23, 2026 20:21
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