# Proof audit PASS 2

Findings: none blocking; no required proof row missing or contradictory. Read-only audit of [#18359](https://git.cafe/pingdotgg/t3code/pulls/18359), [GitHub mirror #18359](https://github.com/pingdotgg/t3code/pull/18359). No repository edits, commits, pushes, comments, watches, children, browser operations or live userdata reads. Original evidence and worktree preserved.

Exact reviewed and rebuilt head: [394f9be](https://git.cafe/pingdotgg/t3code/commit/394f9be427e329ba0d353d3d6c879fe7dee7e939), full SHA `394f9be427e329ba0d353d3d6c879fe7dee7e939`; base [dd5b540](https://git.cafe/pingdotgg/t3code/commit/dd5b5401e1f240f4314af29edf431369d182f386), full SHA `dd5b5401e1f240f4314af29edf431369d182f386`. Checkout `/home/ubuntu/wt/pr-18359` clean before and after. Saved service and current source SHA256 both `549a72f7b0b2fe398909d150312294b1a4af7501d0247f504a6d285e158e37c2`. origin/main resolves to the supplied base. Original runtime report embeds head as metadata; corroboration is clean source, saved byte-identical service, the matching spans/source lines, and this independent rebuild from the unchanged current head. It is not a cryptographic attestation of historical process memory.

| Row | Status | Reviewed proof |
|---|---|---|
| R0 | PASS | Existing W at T, exact base/thread files, no recreation span, one real native turn and completed durable run. |
| R1 | PASS | W absent, stale/prunable registration and branch T retained; prune/recreate succeeds before root/native start, same T/files and crossed tags. |
| R2 | PASS + independent rebuild | Missing branch created at current named project C, exact base/project files; tag named project-current still T. |
| R3 | PASS | W and branch absent; detached project C; run/attempt/node failed with null startedAt; zero new provider turn, native start/resume, session event, openSession/root-start span. Persisted error confirmed. |
| R4 | PASS | Same thread/server/native conversation; named project branch repaired, new completed run at C. Prior failed run and identical error projection retained. |
| T1 | PASS | Source + exact green log: interruption escapes without events; retry returns typed error without settlement/start; final settles once, three create calls, sanitized durable message. |
| T2 | PASS | Existing 8-case managed-path table retained and green; valid managed/symlink-root paths recreate, invalid cases do not. |
| T3 | PASS | Original 32 tests preserved; red32/green34; source retains bypasses and command ordering. Bypass safety is source inspection, not a claim each bypass has a new dedicated test. |
| T4 | PASS | Driver uses refname:lstrip=2, exact local-head names despite tag collisions; consumers inspected. Runtime crossed tags agree. |
| T5 | OPTIONAL | Other typed Git failure phases not separately injected; not required by the matrix. |

## Original artifact audit

Read all supplied scripts: seed, launch, generic MCP caller, snapshot, rows, sequence, assemble, report, cleanup, server startup and redgreen. Seed uses only fresh fixture Git. Launch and caller use supported MCP/auth services with scoped revocation and NodeServices/Net layers. Snapshots use read-only SQLite against isolated state. Rows mutate only explicit fixture W/project, wait for CLI completion, then snapshot; sequence preserves preliminary evidence and resets only the fixture. Assembly correlates run intervals and computes assertions; it does not replace raw proof. Report is generated narrative with hardcoded IDs/head, checked against raw records. Cleanup records descendants before stopping dev runner. Redgreen temporarily substituted only the service then restored in finally; this reviewer did not repeat that repo mutation.

Inspected all 5 before/after snapshots, all 157 authoritative row event payloads, all 140 supplied service spans (including preliminary history) and all 153 native whitelist records. Independently recomputed selected event sets/spans/native starts from the raw snapshots and compared to runtime-trace rows. Native response turn IDs match durable provider-turn native refs and runAttemptIds; root/run/attempt links agree. The shared server trace ID alone is insufficient correlation; sequence boundaries, run/attempt/node IDs, native thread/turn IDs and ordered nonoverlapping intervals together establish it. Provider start follows successful recovery for R1/R2/R4. R3 has five failed recreation executions (worker retries) but one durable attempt and final settlement, no provider startup.

Exact original Git fixture tips:
- A: `a3a18cfa40202946fb9566b622a6737e43d7e3de`
- T: `a2818b8f25d83d678c089cd617a8ffff56729e96`
- C: `c1f511cc4e9da68b20a3334089f814c7f9e8f1a9`

Crossed tags stay feature/restore=C and project-current=T before and after every row. Fully qualified branch refs and rev-parse HEAD establish tips; Git symbolic-ref --short prints heads/feature/restore under ambiguity, which is legitimate and not confused with the driver's exact branch-name list. R0/R1 files are base.txt=`base\n`, thread.txt=`thread work\n`, project.txt absent. R2/R4 files are base.txt=`base\n`, project.txt=`new project code\n`, thread.txt absent. Project stays at C throughout, with detached symbolic-ref failure only for R3. R1 before-worktree porcelain explicitly marks stale registration prunable. R2/R3 before snapshots and action outputs establish branch deletion independent of tags.

R3 durable error is a turn-item.updated event and the turn_items projection, not only a server warning. Title `Couldn't recreate thread workspace`, class `provider_error`, message `Could not recreate branch 'feature/restore' at /tmp/ev-18359/worktrees/project/restore: the project workspace has no current branch to start it from (detached HEAD?).` Error item links to ordinal7 run/root node with providerTurnId null. R4 preserves the exact item and ordinal7 failure. The error item's own startedAt denotes writing the error; the run/attempt/node startedAt values are all null. No uncommitted-file restoration is claimed.

## Exact red/green evidence

Command: `vp test run apps/server/src/orchestration-v2/ProviderTurnStartService.test.ts`.
Red substituted service from origin/main (currently exact supplied base), retaining branch tests/testkit/Git driver. It fails assertion 852 (expected branch feature/restore, received empty detached branch) and 926 (expected typed failure, got success), with 2 failed/32 passed, exit1. These are behavioral failures, not import/setup failures. It does not prove the retained-only subcase independently failed. Green at full supplied head has 34 passed, exit0. Read both complete logs and substitution script; saved service bytes match current. Both prior code reviews report MERGE. check:changed log has format/lint/knip/graphql/affected typecheck/tests all pass and 197 tests; those are retained checks, not newly rerun by this proof audit.

## What else changed

Complete diff is four .ts files, 338 insertions/56 deletions: recovery helper chooses retained head or fresh current named project head after status invalidation; final typed recovery failure stops startup and persists a curated error while preserving interruption/nonfinal retries. Existing failure-settlement helper moved earlier and gained explicit message override; its other callers retain prior fallback formatting. Shared Git branch listing changed refname:short to refname:lstrip=2, also correcting unique-name/MCP consumers. Tests add real Git service layers plus recovery/failure cases and harness injection. No protocol/auth/mode/UI/migration changes or committed scratch. Branch-base metadata sharing is an existing createWorktree side effect activated by providing the base; no rollback of partial Git effects or remote/uncommitted-work recovery is promised. T5 breadth stays optional.

## Independent affected-row rebuild

Fresh scratch: `/tmp/ev-18359-audits28q35_z`; no original fixture/home overwritten. Parameterized copies of supplied seed.py, launch.mts, mcp-call.mts, rows.py and snapshot.py are retained under evidence/. Repo imports remain current head, dependencies linked read-only from owning package. First launch attempt had a duplicated scratch prefix and correctly failed validation before a thread was created; corrected script uses the true registered worktree.

Commands, in order:

```sh
vp run dev:server --no-seed --home-dir /tmp/ev-18359-audits28q35_z/home
python3 /tmp/ev-18359-audits28q35_z/evidence/seed.py
node apps/server/src/bin.ts project add /tmp/ev-18359-audits28q35_z/fixture/project --base-dir /tmp/ev-18359-audits28q35_z/home
git -C /tmp/ev-18359-audits28q35_z/fixture/project worktree add /tmp/ev-18359-audits28q35_z/home/worktrees/project/restore refs/heads/feature/restore
git -C /tmp/ev-18359-audits28q35_z/home/worktrees/project/restore symbolic-ref HEAD refs/heads/feature/restore
node /tmp/ev-18359-audits28q35_z/evidence/launch.mts
node /tmp/ev-18359-audits28q35_z/evidence/mcp-call.mts t3_thread_wait '{"threadId":"mcp:5f010c03-57ae-462c-bee4-b7182d7d91f8"}'
python3 /tmp/ev-18359-audits28q35_z/evidence/rows.py R2
```

Actual setup seeded before server startup; listed commands describe the dependent setup/runtime steps. Baseline launch used existing_worktree, real codex/gpt-6.1-sol; wait returned completed/timedOut false. R2 driver removed only fresh W, pruned registration and deleted heads/feature/restore; crossed tags remained. It then used supported CLI send --wait --json and read-only isolated DB snapshots. No DB writes by the audit.

Fresh Git tips:
- A: `368abb8f245db71de2a0435beccebc4c7337c80f`
- T: `ecca377c623295387a0429deb39aaea5f06f3bed`
- C: `ebe88637d3d72eb183d3d929000fcf4455014770`

Rebuilt run/ordering details:
```json
{
  "status": "PASS",
  "head": "394f9be427e329ba0d353d3d6c879fe7dee7e939",
  "run": {
    "id": "run:thread:mcp%3A5f010c03-57ae-462c-bee4-b7182d7d91f8:ordinal:2",
    "threadId": "mcp:5f010c03-57ae-462c-bee4-b7182d7d91f8",
    "ordinal": 2,
    "providerInstanceId": "codex",
    "modelSelection": {
      "instanceId": "codex",
      "model": "gpt-6.1-sol"
    },
    "providerThreadId": "provider-thread:provider:codex:native-thread:pending%3Arun%3Athread%3Amcp%253A5f010c03-57ae-462c-bee4-b7182d7d91f8%3Aordinal%3A1",
    "userMessageId": "message:mcp:client%3A17050171-3f91-42e0-a461-c214f1e75c2b:thread-send:38c349c6-54b8-439f-aa20-36010c1b5d9a",
    "rootNodeId": "node:run:run%3Athread%3Amcp%253A5f010c03-57ae-462c-bee4-b7182d7d91f8%3Aordinal%3A2:root",
    "activeAttemptId": "run-attempt:run:run%3Athread%3Amcp%253A5f010c03-57ae-462c-bee4-b7182d7d91f8%3Aordinal%3A2:attempt:1",
    "status": "completed",
    "queuePosition": null,
    "requestedAt": "2026-10-26T20:59:26.857Z",
    "startedAt": "2026-10-26T20:59:27.794Z",
    "completedAt": "2026-10-26T20:59:34.780Z",
    "checkpointId": "checkpoint:scope:checkpoint-scope%3Athread%3Amcp%253A5f010c03-57ae-462c-bee4-b7182d7d91f8%3Aname%3Aroot:name:2",
    "contextHandoffId": null
  },
  "nativeStarts": [
    {
      "timestamp": "2026-10-26T20:59:27.862Z",
      "provider": "codex",
      "protocol": "codex.app-server",
      "direction": "outgoing",
      "method": "turn/start",
      "id": 4,
      "params": {
        "threadId": "01a17a02-6ce2-7201-bc3b-83963845c253",
        "cwd": "/tmp/ev-18359-audits28q35_z/home/worktrees/project/restore",
        "model": "gpt-6.1-sol"
      },
      "result": {},
      "turnId": null,
      "nativeThreadId": null
    }
  ],
  "spans": [
    {
      "name": "ProviderTurnStartService.recreateMissingWorktree",
      "startTimeUnixNano": "1793048366986790937",
      "endTimeUnixNano": "1793048367764893833",
      "exit": {
        "_tag": "Success"
      },
      "spanId": "9948a3380e8fee57",
      "parentSpanId": "ccd6fe8fecf8e7a4"
    },
    {
      "name": "RunExecutionService.startRootRun",
      "startTimeUnixNano": "1793048367807620018",
      "endTimeUnixNano": "1793048367875354698",
      "exit": {
        "_tag": "Success"
      },
      "spanId": "2c1026604651a42b",
      "parentSpanId": "183858857c39a4d5"
    }
  ]
}
```

Exact driver output:
```text
R2-before snapshot saved 45 events
R2 snapshot saved 82 events
{"command": ["node", "apps/server/src/bin.ts", "thread", "send", "mcp:5f010c03-57ae-462c-bee4-b7182d7d91f8", "Read-only evidence R2. Run pwd, git rev-parse HEAD, git symbolic-ref HEAD; read base.txt thread.txt project.txt when present. Report exact contents and missing files. No edits, commits, branch changes or network.", "--base-dir", "/tmp/ev-18359-audits28q35_z/home", "--wait", "--json"], "exit": 0, "stdout": "{\"threadId\":\"mcp:5f010c03-57ae-462c-bee4-b7182d7d91f8\",\"runId\":\"run:thread:mcp%3A5f010c03-57ae-462c-bee4-b7182d7d91f8:ordinal:2\",\"status\":\"completed\",\"reply\":\"`pwd`:\\n```text\\n/tmp/ev-18359-audits28q35_z/home/worktrees/project/restore\\n```\\n\\n`git rev-parse HEAD`:\\n```text\\nebe88637d3d72eb183d3d929000fcf4455014770\\n```\\n\\n`git symbolic-ref HEAD`:\\n```text\\nrefs/heads/feature/restore\\n```\\n\\n`base.txt` (ends with newline):\\n```text\\nbase\\n```\\n\\n`thread.txt`: missing.\\n\\n`project.txt` (ends with newline):\\n```text\\nnew project code\\n```\\n\\nNo changes made; no network used.\",\"error\":null}\n", "stderr": ""}

```

Independent assertions checked missing before-directory/branch, final full HEAD=C, exact files and all crossed refs, unchanged project C, one native turn/start with real requested model/cwd, successful recovery span ending before root-start and native-start. Full Git, run, native and event detail is retained in rebuild-verified.json. This independently reconstructs one required affected row; original R0–R4 remain the complete matrix.

## Cleanup

Captured server socket owner PID and confirmed /proc cwd was this worktree's apps/server; walked only its ancestor chain to identify the just-started dev runner and recorded descendants before termination. SIGTERM to dev runner left watcher/provider children, so sent SIGTERM only to those previously recorded owned descendants. No pattern killing. Final check: no live recorded descendants and port15571 unbound. Scratch/evidence preserved. Repo clean at unchanged full head. All CLI/test commands have exited.

```json
{
  "devRunnerPid": 2119639,
  "serverPid": 2119692,
  "recordedDescendants": [
    2119639,
    2119651,
    2119686,
    2119692,
    2121455,
    2121467,
    2122104
  ],
  "explicitDescendantSigterm": [
    2119686,
    2119692,
    2121455,
    2121467,
    2122104
  ],
  "remainingLive": [],
  "portCheck": ""
}
```

## Independent original-artifact validation transcript

```text
R0: independently checked 36 event payloads, 3 spans, all refs/files, run/attempt/node correlation and native starts; PASS
R1: independently checked 37 event payloads, 13 spans, all refs/files, run/attempt/node correlation and native starts; PASS
R2: independently checked 36 event payloads, 15 spans, all refs/files, run/attempt/node correlation and native starts; PASS
R3: independently checked 11 event payloads, 46 spans, all refs/files, run/attempt/node correlation and native starts; PASS
R4: independently checked 37 event payloads, 18 spans, all refs/files, run/attempt/node correlation and native starts; PASS
Inspected all 140 supplied spans and 153 native protocol records; original rows are sequential and share thread/provider native ID.
seed.py SHA256 7884a6156b4553e55c83a65d9e48fb67aab9e15d6c3d6a0e47c2b5b362ac1adc
launch.mts SHA256 ad8f22a43d3a1dec6d745de0a2d94befafdb921d5cf61c216cee0cdd0b91b36b
mcp-call.mts SHA256 530f32b0751f39166d77344982db59ab33a84c46803fe2d3c144142c7f921ad3
snapshot.py SHA256 d298e416c03e93240e25d26d2adf58f8e2a35abafa144d8d9d49b65564a77e70
rows.py SHA256 841b750249b9f2d72faa895edc76df9fb0f54a408f3c31dae335a5f937aeab7d
sequence.py SHA256 b4303f9917e5d753c12bb40bc9eabed20e87fb43378aa2aaabffe8d9b9276307
assemble.py SHA256 6d0af9390e18c773367178e641d1224616ea9efd15e1f53315858e2c0e095831
report.py SHA256 b6bb97509f95f942f7e38a342dc6fbc0b338be1cdfa3c2cbcbb0ec0ee15cba68
cleanup.py SHA256 88647d73090226c03ec4d22c52317e31ff1e727ef1f70f55273454b2094853b6
server-start.sh SHA256 188aeef8f839723a8483f7710be267046bf9b64669ef97da7f726fb42f6573fb
redgreen.py SHA256 4c4e4a69b86429f8c600fa54f07f70df1cee05b8b1f53dedb81e97524dd40aa1
Red log: assertion failures at 852 branch name and 926 typed retry; 2 failed/32 passed exit1. Green: 34 passed exit0. origin/main currently equals exact supplied base; restored service hash matches current head.
R0 native response IDs match all provider-turn native IDs and attempt run-attempt:run:run%3Athread%3Amcp%253A2981d4ac-1873-45cd-a149-5bc3c6c02a3c%3Aordinal%3A4:attempt:1; count 4
R1 native response IDs match all provider-turn native IDs and attempt run-attempt:run:run%3Athread%3Amcp%253A2981d4ac-1873-45cd-a149-5bc3c6c02a3c%3Aordinal%3A5:attempt:1; count 4
R2 native response IDs match all provider-turn native IDs and attempt run-attempt:run:run%3Athread%3Amcp%253A2981d4ac-1873-45cd-a149-5bc3c6c02a3c%3Aordinal%3A6:attempt:1; count 4
R3 native response IDs match all provider-turn native IDs and attempt run-attempt:run:run%3Athread%3Amcp%253A2981d4ac-1873-45cd-a149-5bc3c6c02a3c%3Aordinal%3A7:attempt:1; count 0
R4 native response IDs match all provider-turn native IDs and attempt run-attempt:run:run%3Athread%3Amcp%253A2981d4ac-1873-45cd-a149-5bc3c6c02a3c%3Aordinal%3A8:attempt:1; count 4
```

## FRICTION

- fixture | First scratch path replacement duplicated the common /tmp/ev-18359 prefix | Use single-pass literal substitution; preserved corrected scratch scripts.
- Git | Crossed tags make symbolic-ref --short emit heads/feature/restore | Compare fully qualified refs and full tip SHA; distinguish CLI short spelling from listLocalBranchNames output.
- cleanup | Dev-runner exit left its watcher and Codex descendants alive | Capture owned process tree before stopping and terminate only recorded descendants; verify no survivors and no listener.

VERDICT: SUFFICIENT
