Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
64536e2
docs(ptycap-05): discuss-phase context and forks for throwaway-repo d…
finedesignz Oct 13, 2026
746e844
docs(PTYCAP-05): lock fork panel verdict (2 sonnet seats + codex)
finedesignz Oct 13, 2026
e572091
docs(PTYCAP-05): plan throwaway-repo due->PR proof (9 plans, 4 waves)
finedesignz Oct 13, 2026
627de11
docs(ptycap-05): plan check PASS
finedesignz Oct 13, 2026
121af3e
feat(05-01): proof tracer - armed run to terminal outcome, flag OFF a…
finedesignz Oct 13, 2026
770161b
feat(05-01): proof state layer - arm/disarm/enable txs, counters, att…
finedesignz Oct 14, 2026
6cf340f
feat(05-01): publish read-only ProofGithub contract and deterministic…
finedesignz Oct 14, 2026
d247291
docs(05-01): complete proof tracer, state layer and ProofGithub contr…
finedesignz Oct 14, 2026
621dfdc
feat(PTYCAP-05-02): read-only ProofGithub adapter over the GitHub App…
finedesignz Oct 14, 2026
15eebed
feat(PTYCAP-05-02): fail-closed protection assertion, freeze, drift, …
finedesignz Oct 14, 2026
c8211aa
docs(PTYCAP-05-02): complete GitHub adapter and protection plan summary
finedesignz Oct 14, 2026
475acda
feat(PTYCAP-05-03): proof verifier default-branch advance and PR scop…
finedesignz Oct 14, 2026
115701b
feat(PTYCAP-05-03): proof verifier CI evaluation and pr_open_green de…
finedesignz Oct 14, 2026
ded4b60
docs(PTYCAP-05-03): complete proof verifier plan summary
finedesignz Oct 14, 2026
57e7097
feat(ptycap-05-04): read-only GET /api/orchestrator/proof status route
finedesignz Oct 14, 2026
1d6dd82
docs(ptycap-05-04): register GET /api/orchestrator/proof in OpenAPI a…
finedesignz Oct 14, 2026
9b623cc
docs(ptycap-05-04): complete proof status route plan summary
finedesignz Oct 14, 2026
a45c3b3
feat(PTYCAP-05-05): proof budget and protection dispatch gates
finedesignz Oct 14, 2026
8be0b29
feat(PTYCAP-05-05): wire proof gates into both orchestrator gate lists
finedesignz Oct 14, 2026
50f0bfa
fix(PTYCAP-05-05): keep counterKey assignment guard green (rename loo…
finedesignz Oct 14, 2026
8b21728
feat(PTYCAP-05-05): never-merge routing refusal for proof repos
finedesignz Oct 14, 2026
5bee3ab
docs(PTYCAP-05-05): complete dispatch gates plan summary
finedesignz Oct 14, 2026
757f52c
feat(PTYCAP-05-06): ordered proof evaluators with tick-side budget te…
finedesignz Oct 14, 2026
9a7702f
feat(PTYCAP-05-06): inject-outcome mapping, real evaluator wiring, co…
finedesignz Oct 14, 2026
64a9a1c
test(PTYCAP-05-06): multi-tick proof cycle scenarios, final-prompt gr…
finedesignz Oct 14, 2026
0e9cd60
docs(PTYCAP-05-06): complete evaluators and inject-outcome mapping pl…
finedesignz Oct 14, 2026
dddeb14
feat(PTYCAP-05-07): ordered fail-closed armProof core with read-only …
finedesignz Oct 14, 2026
39c19a9
feat(PTYCAP-05-07): disarm (tx then kill switch) and enable cores
finedesignz Oct 14, 2026
c6b2353
feat(PTYCAP-05-07): data-only operator CLI for arm/dry-run/enable/dis…
finedesignz Oct 14, 2026
0a49f9d
docs(PTYCAP-05-07): complete arm/disarm/enable mechanism plan summary
finedesignz Oct 14, 2026
d893487
test(PTYCAP-05-08): flag-OFF differential matrix over the three-flag …
finedesignz Oct 14, 2026
db9611b
test(PTYCAP-05-08): real-Postgres proof helper wired into an existing…
finedesignz Oct 14, 2026
666c460
docs(PTYCAP-05-08): plan 08 summary
finedesignz Oct 14, 2026
ba1dae7
docs(PTYCAP-05-09): owner arming and rollback runbook for the throwaw…
finedesignz Oct 14, 2026
3acf155
docs(PTYCAP-05-09): document proof flag, budget knobs, invariants and…
finedesignz Oct 14, 2026
a9de149
test(PTYCAP-05-09): pin runbook statements; roadmap delivery notes fo…
finedesignz Oct 14, 2026
8277a7d
docs(PTYCAP-05-09): complete owner runbook and docs plan summary
finedesignz Oct 14, 2026
3c72a6e
fix(PTYCAP-05-qc1): proof mode is hub-exclusive (codex #1, adversary …
finedesignz Oct 14, 2026
96663b9
fix(PTYCAP-05-qc1): proof dispatch requires an exact active-run match…
finedesignz Oct 14, 2026
ebc3d13
fix(PTYCAP-05-qc1): disarm engages the session kill switch before the…
finedesignz Oct 14, 2026
4f504bc
fix(PTYCAP-05-qc1): a proof-owned task never renders the dev macro un…
finedesignz Oct 14, 2026
d90e7e5
fix(PTYCAP-05-qc1): a usage_event that fails to persist terminalizes …
finedesignz Oct 14, 2026
61d50c8
fix(PTYCAP-05-qc1): PR scope sees every PR and requires the success P…
finedesignz Oct 14, 2026
d3e4b9d
fix(PTYCAP-05-qc1): GitHub repo identity is canonical (lowercase) for…
finedesignz Oct 14, 2026
b0cf5d2
fix(PTYCAP-05-qc1): merge refusal fails closed when the session has n…
finedesignz Oct 14, 2026
6453c1b
fix(PTYCAP-05-qc1): arm refuses an unverified agent permission and bo…
finedesignz Oct 14, 2026
ed0f315
fix(PTYCAP-05-qc2): one hub-global advisory lock for proof arm, disar…
finedesignz Oct 14, 2026
cb2f2bc
fix(PTYCAP-05-qc2): recheck proof identity and kill state at the wire…
finedesignz Oct 14, 2026
e0f4725
fix(PTYCAP-05-qc2): proof owns exactly one session halt row; disarm r…
finedesignz Oct 14, 2026
5cd8728
fix(PTYCAP-05-qc2): listPulls paginates until every PR since arm is i…
finedesignz Oct 14, 2026
8ea439e
fix(PTYCAP-05-qc2): derive budget attribution loss from the database,…
finedesignz Oct 14, 2026
3d741dd
docs(PTYCAP-05): QC rounds 1-3 record + verdict (BLOCKED, 2 open MAJOR)
finedesignz Oct 14, 2026
f671157
docs(PTYCAP-05): phase verification report (SC-1 PASS, SC-2/3 BLOCKED…
finedesignz Oct 14, 2026
b441770
fix(PTYCAP-05-repair): per-turn usage correlation (turn_id) + owner-t…
finedesignz Oct 14, 2026
4d592e2
docs(PTYCAP-05): repair round record (2 MAJOR fixed, 1 new false-posi…
finedesignz Oct 14, 2026
7efbae7
fix(PTYCAP-05): e2e attribution-loss check uses a real proof identity…
finedesignz Oct 17, 2026
15a11f2
fix(PTYCAP-05): attribution grace keys on message completion time; re…
finedesignz Nov 2, 2026
a418613
fix(PTYCAP-05): verifier ignores proof/ PRs from earlier runs on re-a…
finedesignz Nov 10, 2026
771f706
merge origin/main into PTYCAP-05
cursoragent Nov 11, 2026
9935189
fix(PTYCAP-05): retry proof arm race while another e2e holds an orche…
cursoragent Nov 11, 2026
156999e
fix(ptycap-05): wait out a peer enabled orchestrator task in CI
cursoragent Nov 17, 2026
c8a37bd
Merge main into phase-ptycap-05-throwaway-repo-proof
cursoragent Nov 17, 2026
18c2cf4
fix(ptycap-05): run orchestrator e2e one test at a time
cursoragent Nov 17, 2026
a5a1f9a
fix(ptycap-05): drop the leaked enabled orchestrator task and answer …
cursoragent Nov 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .planning/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,21 @@ ceiling (and the programmatic-credit halt).
2. It produces a reviewable PR with a green CI check, or it cleanly does nothing and says why.
3. This has **never once happened**. Until it does, the orchestrator is unproven and unsellable.

**Plans:** 9 plans (the live proof is OWNER-GATED; these plans build, test and document the machinery and the arming runbook, they arm nothing)

Plans:
- [x] 05-01-PLAN.md -- tracer (armed run to terminal outcome through every layer, flag OFF a true no-op) + orchestrator_proof_runs state layer + ProofGithub contract and fake (wave 1)
- [x] 05-02-PLAN.md -- read-only GitHub adapter + protection assertion/freeze/drift (ruleset shape, zero bypass, permission probe) (wave 2)
- [x] 05-03-PLAN.md -- hub verifier: default-branch advance via compare, PR scope, CI/green decision (wave 2)
- [x] 05-04-PLAN.md -- read-only GET /api/orchestrator/proof + OpenAPI + docs:sync (wave 2)
- [x] 05-05-PLAN.md -- proofBudgetGate + proofProtectionGate in both orchestrator gate lists, coverage scans, merge-routing refusal (wave 3)
- [x] 05-06-PLAN.md -- ordered evaluators, tick-side budget termination, inject-outcome mapping, counter-key pin (wave 3)
- [x] 05-07-PLAN.md -- arm/disarm/enable cores + operator CLI (exactly-one allowlist, frozen budget and protection) (wave 3)
- [x] 05-08-PLAN.md -- flag-OFF differential matrix, real-Postgres proof helper (CI only), baseline (wave 4)
- [x] 05-09-PLAN.md -- owner runbook (permissions, repo + ruleset, ordered rollback), CLAUDE.md/docs, runbook pin test (wave 4)

**Delivery notes (Phase 5)**: the machinery is built and tested against a fake GitHub client and, in CI, against real Postgres; nothing was armed and no flag, GitHub or prod system was touched. The live run is OWNER-GATED (`docs/ptycap-05-proof-runbook.md`); Phase 5 stays unchecked until SC-3 closes live, so SC-2/SC-3 are "armed-ready, live proof pending owner GO", never PASS. Deferred: the automation `term.input` PTY producer (D-01, drives the stream-json macro path instead). Recorded dependency: arming refuses `proof_protection_unverifiable` (`bypass_actors_not_visible`) unless the GitHub App token can see ruleset bypass actors (GitHub shows them only to a caller with write access); that is an owner decision about the App's permission level, with no override path.

### Phase 6: Hardening + Docs + Release

**Goal**: Shipped, documented, verified live.
Expand Down Expand Up @@ -225,7 +240,7 @@ fix the CAUSE, and escalates to the human when it cannot.
| 2. PTY Pre-Flight Gate | Done |
| 3. Governed-Automation Guard | Complete (4/4 plans) - PR #505 open |
| 4. Lifetime Counter + Kill Switch | Executed (8/8 plans) - QC BLOCKED (2 open races), draft PR #506 |
| 5. Throwaway-Repo Due→PR Proof | Not started |
| 5. Throwaway-Repo Due→PR Proof | Executed (9/9 plans) - QC BLOCKED (2 open MAJOR), draft PR - live proof pending owner GO |
| 6. Hardening + Docs + Release | Not started |
| 7. Unified Self-Heal Routing | Executed (11/11 plans) - QC BLOCKED (1 open MAJOR), draft PR |
| 8. Periodic Task QC + Optimization | Executed (10/10 plans) - QC BLOCKED (1 open MAJOR), draft PR |
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
phase: PTYCAP-05-throwaway-repo-due-to-pr-proof
plan: 01
subsystem: orchestrator
tags: [proof, orchestrator, schema, dal, flag-gated, tracer]
requires: []
provides:
- orchestrator_proof_runs table (additive DDL)
- proof-types (flag stack, closed outcome sets, ProofRun, ProofGithub contract)
- orchestrator-proof-dal (claim, terminalize, arm/disarm/enable txs, counters)
- proofGuard + single-winner terminalizer + macro-cycle hooks
- shared fakes: proof-fake-sql, proof-fake-github
affects: [05-02, 05-03, 05-05, 05-06, 05-07, 05-08]
tech-stack:
patterns: [flag-gated dynamic import, single conditional UPDATE RETURNING claim, advisory-xact-lock transactions, injectable read-only GitHub client]
key-files:
created:
- hub/src/orchestrator/proof-types.ts
- hub/src/orchestrator/proof-guard.ts
- hub/src/orchestrator/proof-prompt.ts
- hub/src/db/orchestrator-proof-dal.ts
- hub/test/orchestrator-proof-tracer.test.ts
- hub/test/orchestrator-proof-dal.test.ts
- hub/test/orchestrator-proof-schema.test.ts
- hub/test/orchestrator-proof-fake-github.test.ts
- hub/test/fixtures/proof-fake-sql.ts
- hub/test/fixtures/proof-fake-github.ts
modified:
- hub/src/db/schema.sql
- hub/src/db/token-usage-dal.ts
- hub/src/orchestrator/macro-cycle.ts
decisions:
- "ProofCycleHooks widened to {guard, render, observeInject, abort}: render lives on the hooks so macro-cycle never imports proof-prompt/guard at module top level; abort ends a claimed run when render throws"
- "ProofGuardInput/Decision types live in proof-types.ts (not proof-guard.ts) so macro-cycle's only static proof import is proof-types"
- "claim-throws path ends the run via terminalizeActiveProofRunForTask (keyed by task) since no snapshot exists"
- "Refused/failed proof injects do not page from macro-cycle; plan 05-06 maps inject outcomes to terminals on the observeInject seam"
status: complete
plan_head_before: 9c78e0131070196ed31ed691b423ebd987b685e9
commits: 3
actuals:
tasks: 3
commits: 3
---

# Phase PTYCAP-05 Plan 01: Proof tracer, state layer, ProofGithub contract Summary

Flag-gated proof path from an armed `orchestrator_proof_runs` row to a single-winner terminal outcome (claim, snapshot-rendered no-merge prompt, run-log row, one notification, task disabled, session kill), with the transactional state layer and a frozen read-only GitHub contract plus shared fakes.

## Commits

- 60457c5 Task 1 (tracer): schema, proof-types, tracer DAL, proofGuard, proof prompt, macro-cycle hooks, tracer tests
- 70acb3a Task 2: arm/disarm/enable transactions, counters, observation, sumSessionTokensSince, fake sql, DAL + schema tests
- 1273259 Task 3: ProofGithub interface, ProofGithubError, makeFakeProofGithub, shared scenario helpers

## Verification

| Test file (bun, one process each) | Result |
|---|---|
| orchestrator-proof-tracer.test.ts | 20 pass / 0 fail |
| orchestrator-proof-dal.test.ts | 23 pass / 0 fail |
| orchestrator-proof-schema.test.ts | 5 pass / 0 fail |
| orchestrator-proof-fake-github.test.ts | 11 pass / 0 fail |
| orchestrator-macro-cycle.test.ts (existing) | 23 pass / 0 fail |
| `bun run schema-lint` | OK |

Typecheck (tsc via the primary checkout's binary): no errors in touched files; one pre-existing error at macro-cycle.ts:91 (listMessages cast) is unrelated and untouched.

## Deviations from Plan

1. **[Process] Tracer test written after the implementation, not before.** The plan asked for a watched RED. The seams were designed together and the test was written against them before the first run; all 20 passed first run. Flag-OFF differential test uses a hook-touch counter, so it would fail if any proof code ran with a flag off.
2. **[Rule 3 - design] ProofCycleHooks gained `render` and `abort`** (plan listed `{guard, observeInject}`) and the guard types moved to proof-types.ts. Needed to satisfy the acceptance criterion that macro-cycle imports only proof-types statically while still rendering from the claimed snapshot and ending the run on a render throw.
3. **[Rule 2] `terminalizeActiveProofRunForTask` added** so a claim that throws (no snapshot) still fails closed as `nothing:guard_error` through the terminalizer.
4. **Fake sql `begin` rollback** snapshots runs/tasks/rows/allowlist and restores on throw, so the "no partial rows" assertion is real.

## Known Stubs

None. `evaluators` is `[agentDeclinedEvaluator]` by design (plan 05-06 registers the rest); `observeInject` persists `last_inject_outcome` only (05-06 adds the terminal mapping).

## Threat Flags

None beyond the plan's threat model. No network, no env flag flipped, no supervisor change, no push.

## Self-Check: PASSED

All created files present; commits 60457c5, 70acb3a, 1273259 exist on branch phase-ptycap-05-throwaway-repo-proof.
Loading