Skip to content

fix(PTYCAP-05): e2e attribution-loss check uses a real proof identity - #515

Merged
finedesignz merged 2 commits into
phase-ptycap-05-throwaway-repo-prooffrom
fix/ptycap05-proof-checks-identity
Oct 17, 2026
Merged

finedesignz merged 2 commits into
phase-ptycap-05-throwaway-repo-prooffrom
fix/ptycap05-proof-checks-identity

Conversation

@finedesignz

Copy link
Copy Markdown
Owner

qc fails on PR #511 (pipeline 884, step pr-gate): check-baseline reports fail=1 > fail_max=0. Not baseline drift: BSA-07 e2e proof-checks.ts section 6 expected proof_budget_attribution_lost but got lifetime_counter_key_missing, because the QC round-2 proofIdentityRefusal now runs before the attribution check and the raw run used a synthetic counter key and no proofRunId.

Fix is test-only: seed the run with task:<id>, a 1h wall budget, and pass proofRunId. Baseline untouched. Needs the CI Postgres e2e to confirm (no local PG available).

Targets the PTYCAP-05 branch so #511 picks it up; #513/#512 carry the same failure and will inherit it on rebase.

🤖 Generated with Claude Code

QC round-2 added proofIdentityRefusal ahead of the attribution check in the
proof budget gate. The e2e section 6 seeded a raw run with a synthetic counter
key and no proofRunId, so the gate now refused lifetime_counter_key_missing
instead of proof_budget_attribution_lost. Seed the run with the task:<id> key,
a wall budget the seeding cannot outlast, and pass proofRunId. Test-only; no
baseline change (the real failure was fail=1, not drift).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@zero-exposure-app

zero-exposure-app Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

AgentAutofix AI Review

claude

INFRA FAILURE: reviewer CLI reported quota exhaustion

codex

PASSED

No findings.

agy

advisory -- not part of the gate decision

PASSED

No findings.

Result: PARTIALLY REVIEWED -- codex passed, claude infra-failed (not a full dual-reviewer pass)

Reviewer models (requested pin, not independently confirmed):

  • claude: claude-haiku-4-5-20251001 (requested pin, not independently confirmed)
  • codex: gpt-5.5 (requested pin, not independently confirmed)

@finedesignz finedesignz reopened this Oct 17, 2026
…c pipeline created)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@finedesignz
finedesignz merged commit d1156c3 into phase-ptycap-05-throwaway-repo-proof Oct 17, 2026
1 check was pending
finedesignz added a commit that referenced this pull request Nov 2, 2026
…#515)

* fix(PTYCAP-05): e2e attribution-loss check uses a real proof identity

QC round-2 added proofIdentityRefusal ahead of the attribution check in the
proof budget gate. The e2e section 6 seeded a raw run with a synthetic counter
key and no proofRunId, so the gate now refused lifetime_counter_key_missing
instead of proof_budget_attribution_lost. Seed the run with the task:<id> key,
a wall budget the seeding cannot outlast, and pass proofRunId. Test-only; no
baseline change (the real failure was fail=1, not drift).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* ci: retrigger woodpecker (pull_request opened hook returned 204, no qc pipeline created)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
finedesignz added a commit that referenced this pull request Nov 10, 2026
…#515)

* fix(PTYCAP-05): e2e attribution-loss check uses a real proof identity

QC round-2 added proofIdentityRefusal ahead of the attribution check in the
proof budget gate. The e2e section 6 seeded a raw run with a synthetic counter
key and no proofRunId, so the gate now refused lifetime_counter_key_missing
instead of proof_budget_attribution_lost. Seed the run with the task:<id> key,
a wall budget the seeding cannot outlast, and pass proofRunId. Test-only; no
baseline change (the real failure was fail=1, not drift).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* ci: retrigger woodpecker (pull_request opened hook returned 204, no qc pipeline created)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
cursor Bot pushed a commit that referenced this pull request Nov 17, 2026
* docs(ptycap-05): discuss-phase context and forks for throwaway-repo due->PR proof

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(PTYCAP-05): lock fork panel verdict (2 sonnet seats + codex)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(PTYCAP-05): plan throwaway-repo due->PR proof (9 plans, 4 waves)

Tracer-first plan set for Phase 5. Builds and tests ALL machinery (allowlist
entry mechanism, hard per-proof budget, branch-only, never-merge guard with
ruleset assertion + detective layer, terminal "did nothing and why" outcomes,
counter-key pin tests, rollback ordering), flag-gated default OFF. The live
proof is OWNER-GATED: no plan arms prod or touches Coolify/prod DB; plan 09
writes the arming + rollback runbook as owner steps.

Waves: 01 tracer+state | 02 github+protection, 03 verifier, 04 read API |
05 gates, 06 guard, 07 arm CLI | 08 e2e+noop, 09 runbook/docs.
Every locked-verdict amendment (F1-1..6, F2-1..4, F3-1..4) maps to a task
and a test in 05-VALIDATION.md. ROADMAP Phase 5 gets the plan list.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* docs(ptycap-05): plan check PASS

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(05-01): proof tracer - armed run to terminal outcome, flag OFF a true no-op

- orchestrator_proof_runs table (additive DDL, named CHECKs, partial unique indexes)
- proof-types, tracer DAL subset, proofGuard + single-winner terminalizer, proof prompt
- macro-cycle: optional proof hooks, loaded only when the flag stack is ON; fail closed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(05-01): proof state layer - arm/disarm/enable txs, counters, attribution-safe token sum

- armProofRunTx/disarmProofRunTx/enableProofTaskTx: one transaction each under a per-user advisory lock
- findProofRunForRequest, findActiveProofRunForRepo, countProofInjects, recordProofObservation (monotone tokens_hwm), listProofRunsForUser
- sumSessionTokensSince reports sessionExists so a deleted session fails closed
- DB-free fake sql fixture, DAL and schema static-pin tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(05-01): publish read-only ProofGithub contract and deterministic fake

- ProofGithub interface (10 read-only methods), typed ProofGithubError (forbidden|not_found|unavailable)
- makeFakeProofGithub with call log, per-method fail map, unmodeled-method throw
- shared scenario helpers greenPr/redPr/mainAdvanced/unreadableRulesets

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(05-01): complete proof tracer, state layer and ProofGithub contract plan

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(PTYCAP-05-02): read-only ProofGithub adapter over the GitHub App transport

- GET-only injectable request, 403/404/other mapped to forbidden/not_found/unavailable
- bypass_actors absent normalizes to null (never empty), check state truncation flag
- five-probe permission check, no network in tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(PTYCAP-05-02): fail-closed protection assertion, freeze, drift, permission and agent-admin checks

- branch_lock or review_gate shapes only; PR plus green check is insufficient
- zero visible bypass actors; null bypass_actors is unverifiable
- digest/updated_at/ids/default-branch re-assert, never throws

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(PTYCAP-05-02): complete GitHub adapter and protection plan summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(PTYCAP-05-03): proof verifier default-branch advance and PR scope detection

- verifyProof classifies from ProofRun frozen fields + read-only ProofGithub only
- compare(base_sha, default) not HEAD equality: ahead/behind/diverged/not_found are terminal main_advanced
- merged proof PR, foreign proof/ head, wrong base are terminal; unreadable reads are ci_unverifiable

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(PTYCAP-05-03): proof verifier CI evaluation and pr_open_green decision

- green requires open PR, >=1 passing check, every frozen required context success, no red/pending, not truncated, re-compare identical
- neutral/skipped are not success; unreadable, truncated or sha-less checks are ci_unverifiable
- 47-test scenario matrix over the shared fake

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(PTYCAP-05-03): complete proof verifier plan summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(ptycap-05-04): read-only GET /api/orchestrator/proof status route

- tenant-scoped (user id only from auth context), allowlisted response mapping
- no installation id, ruleset ids, raw preconditions or counter key; digest truncated
- mounted after the auth catch-all; mount-order test pins 401 unauth

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(ptycap-05-04): register GET /api/orchestrator/proof in OpenAPI and regenerate docs

- _openapi.ts spec-only registration (200/401/500), bearerAuth
- docs/openapi.json and docs/api.md produced by bun run docs:sync (stable on rerun)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(ptycap-05-04): complete proof status route plan summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(PTYCAP-05-05): proof budget and protection dispatch gates

- proofBudgetGate: injects / four-bucket tokens (monotone hwm) / wall, counter-key pin, terminal block
- proofProtectionGate: re-asserts frozen ruleset before every proof dispatch
- flag OFF is zero-call pass-through; flag ON fails closed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(PTYCAP-05-05): wire proof gates into both orchestrator gate lists

- kill switch first, proofBudgetGate + proofProtectionGate next, counter last
- coverage scans assert position with non-vacuous self-checks (additive)
- counterkey test pinned the old list: extended additively

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05-05): keep counterKey assignment guard green (rename lookup args)

- proof DAL/gate lookup args use requestKey/key; counterKey stays a DispatchRequest-only identity

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(PTYCAP-05-05): never-merge routing refusal for proof repos

- runMergeToMain refuses proof_repo_never_merges for a repo with an armed/running proof run
- one run-log row, nothing injected; flag OFF skips the lookup; lookup error fails closed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(PTYCAP-05-05): complete dispatch gates plan summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(PTYCAP-05-06): ordered proof evaluators with tick-side budget termination

- killSwitch, repoMatch, protection, verifier, agentDeclined, budget (locked order)
- wall always terminates on the tick; spent budget waits only while a turn is live or CI pending
- selectBudgetOutcome + frozenFromRun (owner/repo from the run row)
- guard shares one evaluator ctx so the verifier observation reaches later evaluators

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(PTYCAP-05-06): inject-outcome mapping, real evaluator wiring, counter-key pin

- observeInject maps refusals onto the closed nothing:/terminated: sets; recoverable ones are recorded only
- hook seam now receives the full inject outcome and guard input (reason was previously dropped)
- realProofHooks wires defaultProofEvaluators over the real DAL, kill switch, GitHub adapter and token ledger
- pin test: runMacroCycle threads taskId; real injectOrchestratorPrompt builds task:<taskId> online + autospawn

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(PTYCAP-05-06): multi-tick proof cycle scenarios, final-prompt grep, no-scrub scan

- 11 scenarios over runMacroCycle + real evaluators + shared fake GitHub, exactly-once side effects
- final injected string: no banned token, push form pinned, only the run branch ref
- no-scrub scan with negative fixture
- terminal notification now carries the PR url when known

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(PTYCAP-05-06): complete evaluators and inject-outcome mapping plan summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(PTYCAP-05-07): ordered fail-closed armProof core with read-only dry run

- 13 refusal codes, first failure wins, zero writes on refusal
- budgets frozen from flags then deps.env then defaults; garbage refuses
- writes arm_preconditions.bypass_verification = 'verified' (05-04 key)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(PTYCAP-05-07): disarm (tx then kill switch) and enable cores

- disarm transaction runs first; session kill switch best-effort after, never throws
- enable only on an armed run (proof_not_armed otherwise)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(PTYCAP-05-07): data-only operator CLI for arm/dry-run/enable/disarm with static guard

- refuses before importing the DAL without DATABASE_URL
- read-only installation/session lookups live in a DAL file (script holds no SQL)
- static scan: no env assignment, no Coolify, no network, no SQL text, no cap setter

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(PTYCAP-05-07): complete arm/disarm/enable mechanism plan summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(PTYCAP-05-08): flag-OFF differential matrix over the three-flag stack

- 7 OFF combinations: zero sql, zero fetch, no proof guard/verifier/github, identical inject args
- gates pass through with zero dep calls; merge routing unchanged

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(PTYCAP-05-08): real-Postgres proof helper wired into an existing e2e body

- proof-checks.ts: 8 sections (DDL x2, 5-way arm single-flight, partial unique indexes,
  CHECKs, exactly-once claim/terminalize, attribution survives session delete,
  budget gate on real ledger, exact-row disarm); own synthetic users, cleanup by id
- called from the first autospawn e2e test body: zero new test() calls, zero skips

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(PTYCAP-05-08): plan 08 summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(PTYCAP-05-09): owner arming and rollback runbook for the throwaway-repo proof

- ordered rollback (kill switch or disarm first, then flags, then redeploy)
- GitHub App permission grant, ruleset and non-admin credential prerequisites
- correct autospawn runbook pr_url statement; point at the proof runbook

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(PTYCAP-05-09): document proof flag, budget knobs, invariants and permissions

- CLAUDE.md env entry, docs map row, gate-list invariant
- auto-dev-orchestrator and usage-cost proof sections
- HANDOFF: extra read permissions the proof needs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(PTYCAP-05-09): pin runbook statements; roadmap delivery notes for Phase 5

- 10 tests: OWNER GO, rollback order, permissions, empty bypass list, refusal codes, no merge instruction
- ROADMAP: plans ticked, progress row 'live proof pending owner GO', Phase 5 stays unchecked

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(PTYCAP-05-09): complete owner runbook and docs plan summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05-qc1): proof mode is hub-exclusive (codex #1, adversary MAJOR 1)

Arm, the dry run and --enable refuse (other_orchestrator_task_enabled) while ANY other
orchestrator task is enabled, across all users, because the REMO_ORCHESTRATOR_* flags are
hub-global. At runtime, with the flag stack ON, the proof guard blocks and the budget gate
refuses every orchestrator dispatch that is not the claimed proof task
(proof_mode_non_proof_task); the old pass_through for a task without a proof row is gone.
Runbook prerequisite and refusal-table row added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05-qc1): proof dispatch requires an exact active-run match (codex #2, codex #3 recheck)

Proof dispatch requests now carry a server-only proofRunId (DispatchRequest, set by
runMacroCycle through injectOrchestratorPrompt on both the online and autospawn paths). The
budget gate and a new final pre-send check (finalHaltCheck, reached only by proof gate lists and
only with the flag stack ON) require it to equal the ACTIVE run, so an ordinary dev prompt queued
or parked before the arm - which carries the reusable task:<id> counter key - can never be
authorized as proof traffic or reach send, and a run that goes terminal after the gates still
stops the send. Arm now also halts the session (session kill switch) and cancels pending routine
cycles in the same transaction; --enable releases the halt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05-qc1): disarm engages the session kill switch before the terminal transition (codex #3)

disarmProofRunTx now inserts the session kill-switch row first, in the same transaction and
before the run UPDATE to disarmed, so a rollback undoes both and there is never a committed state
where the run is terminal but the session can still be dispatched to. The separate best-effort
post-transaction engage (and its dep) is removed; the script reports the in-transaction engage.
The pre-send proof-run identity recheck landed with the previous commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05-qc1): a proof-owned task never renders the dev macro under any flag combination (adversary MINOR 2)

The arm transaction marks the task scheduled_tasks.proof_owned (additive idempotent column,
set on both created and reused tasks). The marker rides the task row the cycle already loads
(getOrchestratorTaskForSession -> resolveCycleContext -> MacroCycleInput.proofOwned), so
runMacroCycle refuses (proofDecision blocked) before any reconcile or db work whenever the full
flag stack is not ON; with the stack ON the proof guard still decides. Non-proof tasks are
untouched, so flag-OFF stays a true no-op.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05-qc1): a usage_event that fails to persist terminalizes the proof as budget_attribution_lost (codex #4)

The agent ws handler logged and dropped a failed token_usage insert, so the proof's hard token
budget silently under-counted while the session row still existed. The handler now marks the
session in an in-process registry; sumSessionTokensSince reports attributionLost for any proof
window the loss falls in, and the budget gate and tick evaluator both fail closed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05-qc1): PR scope sees every PR and requires the success PR to come from the armed repo (codex #5)

The adapter dropped every off-prefix PR before the verifier could judge scope, and a fork PR
reusing the exact proof/<run-id> branch name could be reported pr_open_green. listPulls now returns
all recent PRs with head repository, author and creation time; the verifier terminates a PR created
after arming from any non-proof/ head, and a run-branch PR whose head repo is not the armed repo
(or is deleted), as pr_scope_violation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05-qc1): GitHub repo identity is canonical (lowercase) for allowlist, proof row, session match and merge refusal (codex #6)

owner/repo path names are case-insensitive, so github://Owner/Repo and github://owner/repo were two
idents for one repository and bypassed single-flight and the merge refusal. armProof and
armProofRunTx canonicalize through lib/repo-key.ts, findActiveProofRunForRepo canonicalizes the
lookup, and schema.sql adds an additive NOT VALID CHECK (repo_ident = lower(repo_ident)) so the
existing partial unique indexes are single-flight over the canonical value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05-qc1): merge refusal fails closed when the session has no repo key (lens-correctness MINOR 2)

With the proof flag stack on, runMergeToMain skipped the proof-repo refusal entirely when
ctx.repoKey was null, leaving the only auto-merge path unguarded for a keyless session. It now
refuses with proof_repo_never_merges:unverifiable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05-qc1): arm refuses an unverified agent permission and bounds the budgets (adversary MINOR 3, 6)

An admin agent identity can edit the ruleset and merge in one turn, yet arm only warned when
--agent-login was missing or unreadable; it now refuses agent_permission_unverified. The owner-supplied
"hard" budget had no upper bound; arm refuses above injects 50 / tokens 50M / wall 24h and schema.sql
adds matching additive NOT VALID CHECK ceilings. Runbook updated (agent-login required, ceilings,
canonical repo ident, attribution-loss and PR-scope behavior).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05-qc2): one hub-global advisory lock for proof arm, disarm and enable (codex r2 new #1)

The exclusivity count ran under a per-user lock, so two users could both see zero
enabled orchestrator tasks and both enable. All proof state changes now share one
global lock and recheck the count under it. The fake sql models real blocking
advisory-lock semantics so the race is exercised.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05-qc2): recheck proof identity and kill state at the wire-send boundary under the arm/disarm lock (codex r2 #2, #3)

buildSend persisted the prompt (awaited) after the pipeline's final halt check, so an
arm or disarm that committed in that window was followed by a stale send. With proof
mode ON the delivery now runs after persistence behind sendAtProofBoundary: a fresh
kill-switch + active-run identity recheck while holding the same global advisory lock
arm/disarm/enable take. Flag OFF is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05-qc2): proof owns exactly one session halt row; disarm removes allowlist case twins (codex r2 new #2, sonnet MINOR 1, MINOR 3)

Arm now refuses (session_halt_engaged) when a foreign session halt is engaged, releases
only stale halts left by the proof tooling, records the id of the row it engaged on the
run (additive kill_switch_id column) and --enable releases exactly that row, so an owner
emergency stop engaged after arm survives. Disarm deletes the allowlist row by
lower(repo_ident), so a mixed-case twin no longer survives. Runbook gets the new refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05-qc2): listPulls paginates until every PR since arm is inspected, fails closed otherwise (codex r2 #5)

The adapter read only the newest 50 PRs, so a post-arm scope violation on a later page
was invisible. It now pages newest-first until a page is short or its last PR predates
armed_at (the verifier passes it); hitting the page cap or any page error throws and the
verifier stays pending (never green).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05-qc2): derive budget attribution loss from the database, durable across restart (codex r2 #4)

sumSessionTokensSince now also compares completed assistant turns of the session since
arming (older than a 120s grace) with token_usage rows over the same window; fewer rows
than turns reports attributionLost, which the budget gate and tick evaluator already
terminalize as budget_attribution_lost. The in-process mark stays as an additional early
signal. No new DDL; nothing is evicted or forgotten on restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(PTYCAP-05): QC rounds 1-3 record + verdict (BLOCKED, 2 open MAJOR)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(PTYCAP-05): phase verification report (SC-1 PASS, SC-2/3 BLOCKED-owner, SHIP-AFTER-OWNER-GO)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05-repair): per-turn usage correlation (turn_id) + owner-tagged session halts

Budget attribution: chose the nullable additive turn_id column on messages and token_usage
(supervisor stamps one id on a turn's assistant_message and result/usage_event) over a usage
outbox: smaller, no new table, no backfill. The durable detector now anti-joins each completed
assistant message to a token_usage row of the SAME (session, turn_id); aggregate counts are gone
and a message without a turn_id fails closed.

Kill switch: session halts are unique per (session_id, engaged_by) while engaged, so a manual
emergency engage after arm is a separate row, effective on its own, and proof --enable releases
only its own row by id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(PTYCAP-05): repair round record (2 MAJOR fixed, 1 new false-positive MAJOR recorded)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05): e2e attribution-loss check uses a real proof identity (#515)

* fix(PTYCAP-05): e2e attribution-loss check uses a real proof identity

QC round-2 added proofIdentityRefusal ahead of the attribution check in the
proof budget gate. The e2e section 6 seeded a raw run with a synthetic counter
key and no proofRunId, so the gate now refused lifetime_counter_key_missing
instead of proof_budget_attribution_lost. Seed the run with the task:<id> key,
a wall budget the seeding cannot outlast, and pass proofRunId. Test-only; no
baseline change (the real failure was fail=1, not drift).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* ci: retrigger woodpecker (pull_request opened hook returned 204, no qc pipeline created)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05): attribution grace keys on message completion time; re-measure baseline; QC repair record

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05): verifier ignores proof/ PRs from earlier runs on re-arm; spawn tests get a realistic timeout; re-QC record

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(PTYCAP-05): retry proof arm race while another e2e holds an orchestrator task

The five-way single-flight check shares one database with the parallel e2e
suite. Arm refuses every caller while any other orchestrator task is enabled,
so a concurrent due-waves scan made all five arms lose. Wait out that
transient refusal, then still require exactly one winner and four
proof_already_active losses.

* fix(ptycap-05): wait out a peer enabled orchestrator task in CI

The proof arm is hub-global, and orchestrator:e2e runs the e2e files
concurrently. An 8s poll expired while a peer test still held an enabled
orchestrator task, so all five arms lost with other_orchestrator_task_enabled
and the single-flight assertion never ran. Wait up to 90s, inside the
enclosing test timeout.

Co-authored-by: Michael Smith <finedesignz@users.noreply.github.com>

* fix(ptycap-05): drop the leaked enabled orchestrator task and answer applied

stage-presets left its orchestrator task enabled, so the hub-global proof
arm waited out the whole quiet window and still refused. Delete that user
when the test ends. A concurrent AAF duplicate can take the notify claim
after the transition commits; the delivery that applied the transition
still answers applied.

Co-authored-by: Michael Smith <finedesignz@users.noreply.github.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
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