Skip to content

Gate P3 — Daemon, MCP and certified read

Status: Passed (2026-10-21). G0 passed on 2026-10-20. Independent review findings, the closure check N1–N3, and the closure confirmation's two minors are all closed (ADR 0008 §18). ADR 0008 was accepted at revision 3.2 after four independent review rounds. Round 1 found 5 blockers, 14 majors and 12 minors; round 2 found 1 blocker, 7 majors and 9 minors; round 3 found 4 majors and 6 minors; the confirmation found 1 major. All are closed. SPEC v1.5.0–v1.5.3 records the amendments. The P2 gate passed (see P2.md).

0. Scope

  • SPEC §5 P3, §6.3 (MCP tools), §6.4 (Certificate); SD13, SD14(b), SD15, SD16, SD18.3; I4, I6.
  • Owner decisions (2026-10-20):
  • sessions, read ledgers and certificates live in their own append-only session log;
  • MCP is hand-rolled JSON-RPC over stdio.
  • Milestones are listed in ADR 0008 §12.
  • Explicitly deferred:
  • hooks and action gating (P4);
  • path-filtered checks (P5a);
  • branches, WHAT_IF, ctx_commit (P6);
  • conflicts and validators (P7);
  • hybrid retrieval and packing (P8);
  • multiple principals and ACL (P9).

1. Gate matrix

Layer Requirement Result Evidence
G0 Spec ADR 0008 accepted after independent review; SDs unchanged or amended in SPEC appendix C; no SPEC §3.5 prohibited mechanism Pass ADR 0008 rev 3.2 §14–§16; SPEC v1.5.0–v1.5.3
G1 Build & lint fmt, Clippy -D warnings, tests, cargo-deny, dependency policy (daemon/mcp externals reviewed) Pass bash scripts/check.sh (fmt, Clippy, all tests, loom models, dependency policy + negatives, cargo-deny) on macOS for the final tree, and on Linux (remote host, Ubuntu 24.04) for 826625c, where it found and fixed the ECONNRESET bug. GitHub Actions started no job since 2026-10-21 (account billing), so no hosted CI run exists for P3
G2 Golden T06b, T06d-sem, T07e, T08 (concurrent), T12 (concurrent), T15/b/c/d (incremental), T16, T16b-cert, T21, T32, T36, T37, T46a, T62 (engine), T65 Pass Engine: testkit/tests/p3.rs (T06d-sem, T16, T16b-cert, T21, T62-P3, T65); T06b and T15/b/c/d in the Counting (incremental) module of p0.rs. End to end: daemon/tests/service.rs (T07e handle/logical@rev/recall, T32, T36, T46a, carry_rules, admin-only validate) and daemon/tests/server.rs (T08 concurrent coupled heads, T12 concurrent CAS in one group, T37)
G3 Oracle incremental L1/L2 == oracle (10,000 seeds); PROP2b; PROP11; mutation scope + layers.rs, cert.rs Pass PROP1–9 + PROP2b: 10,000 seeds, both modes, with coverage gates (L1/L2 flip without L0 27.8%, reason-only 18.1%, witness/dimension-only 36.9%). PROP11: 10,000 seeds, engine == oracle for full issuance and validation output. Mutation over counting, txn, arena, stage, memory, layers and cert: 785 mutants, 771 caught, 14 unviable, 0 survivors, no waivers (summary); core unchanged since. Re-validated 2026-10-21 (P4): that run shared one CARGO_TARGET_DIR across parallel mutants, which can mis-report results; rerun with per-mutant target dirs, 787 tested, 2 missed (LogicalArena::export_key), both killed by a new core test (logical_info_reports_key_kind_and_lane)
G4 Robustness stress 1/8/32/128 clients, 10 min mixed (I4, no lost update); loom on snapshot publication; cargo-fuzz IPC + MCP ≥ 1 h; group-commit crash injection Pass Stress on the final daemon code e1ac9b1: 1/8/32/128 clients × 600 s, all G4 PASS, 0 mixed epochs, 0 chain breaks, 0 replay mismatches, 0 Busy, 151–257 write tx/s with CAS conflicts at 8+ clients (p3-g4-stress.txt). The closure-confirmation fixes after it touch only startup and session-log open, and are covered by regression tests. Fuzz: ipc_request and mcp_json, 3,618 s each (≈3.66 B and 0.96 B execs), 0 OOM / timeout / crash (p3-g4-fuzz.txt). Since then the fuzzed decoders changed only in random_id. Crash injection at 1,000 runs per point: group commit (append, sync, post-sync), session log, staged payloads at every step (ordered sync, ordered dir sync, append, op_log sync), kill-restart-retry, page-cache frames after restart, rejected-group dedup, harness self-tests (missing fsync, missing barrier). loom: three models of publication/reclaim incl. two-behind replay (check.sh). Earlier stress runs on 5aa9104 (pre-G5) and on the pre-N1 review-fix tree also passed.
G5 Performance MCP read p95 ≤ 5 ms every cell; write p95 ≤ 15 ms at 1 client and ≤ 2 × N / throughput at N clients (owner calibration, ADR 0008 §11); peak ≥ 2,000 tx/s per fullfsync mode with saturation curve Pass p3-g5-mcp.txt (g5_pass=true): read p95 ≤ 2.53 ms; write p95 11.74 / 19.91 / 18.89 / 32.39 ms (on; budgets 15 / 28.7 / 30.2 / 52.8) and 0.87 / 4.27 / 10.92 / 27.94 ms (off; 15 / 5.4 / 13.7 / 38.7); peak 4,846 tx/s on, 6,618 off; 1 clone fallback per cell. Handle-dep cells reported (write p95 35.7 ms on at 1 client: serial session + op_log sync, accepted deviation m3). Store: p3-g5-store.txt incl. pack-scan cold open 289 ms / 100K payloads. Sync costs: p3-apfs-sync.txt
G6 Scenario three simulated agents via MCP: stale plan → Invalid with diff; alternative support → ValidRecertified Pass mcp/tests/g6.rs g6_three_agents_stale_plan_invalid_and_semantic_plan_recertified (JSON-RPC through ctx-mcp's server layer against an in-process ctxd service)
G7 Regression P0–P2 G2/G3/G4 at gate counts Pass Paranoid P0 52 + P1 24 + P1/P2/P3 properties at 10,000 seeds; exhaustive depth 6 (770 states, 0 violations) and depth 8 (1,711 states, 0 violations); store G4 at 1,000 runs per point and PROP10 at 10,000 seeds; P1 G5 memory all PASS (hot 77.78 / 81.73 ≤ 90, inputs 47.17 / 48.68 ≤ 50, query cache 28.35 / 27.89 ≤ 32, history 52.70 ≤ 58 B/inc); P2 G5 store bench g5_initial_pass=true (commit p99 13.4 ms fullfsync on, 0.14 ms off; cold replay 100K in 521 ms, 162 ms with snapshot)
G8 Docs README, CHANGELOG, MCP tools, ctxd operation Pass README §守护进程与 MCP (operation, sockets, trust boundary, tools, admin commands); CHANGELOG milestones 3–5 and G5; docs/IMPLEMENTATION_STATUS.md
Independent review non-implementing reviewer (SPEC §4.2) Findings closed Review of e1110aa: 1 blocker, 2 majors, 7 minors, notes; all fixed with regression tests or accepted with reasons (ADR 0008 §18). A closure check of the fixes raised N1–N3, which e1ac9b1 fixes. A closure confirmation by a non-implementing reviewer found N1–N3 closed with no new blocker or major. It raised two minors: a LogBroken marker that fails to sync must stop startup, and session-log open must sync sessions/. Both are fixed with regression tests that fail without the fix