# Proof audit pass 1

Scope: full `origin/main...441ade6ed1` in `/home/ubuntu/wt/issue-24743`, branch `fix/issue-24743`. Audited HEAD is [441ade6ed1](https://git.cafe/pingdotgg/t3code/commit/441ade6ed192ac67bf5753a06ef30c6a2cde0f55); local origin/main resolves to [dd5b5401e1](https://git.cafe/pingdotgg/t3code/commit/dd5b5401e1f240f4314af29edf431369d182f386). No fetch or forge-state lookup performed. Read worktree AGENTS.md. Checkout was clean; no repository edits, pushes, comments, children, browser launches, or server launches performed.

## Visual fixture matrix

**Empty (0 rows).** The complete diff changes only `apps/server/src/orchestration-v2/EventSink.ts`, `Orchestrator.ts`, and `DelegatedCompletionDelivery.test.ts`. No render path, component caller, visual conditional, layout, theme, responsive rule, client contract, or client interaction implementation changes. Existing clients display the corrected server state through existing paths; this does not create a changed render fixture.

Affected visual rows: none. Collapsed visual fixtures: none. Minimum capture viewport set: empty. Minimum theme set: empty. Screenshots: 0. Recordings: 0. The interaction/time recording rule has no visual rows to apply to here; the server event-order race is proved by deterministic integration tests, per the server-only exception.

## Code-derived backend coverage (not visual capture rows)

| Path / conditional | Collapsed fixture / expected behavior | Evidence and limits |
| --- | --- | --- |
| Acknowledge via MCP terminal result read (`task_status` and other result-read callers through the shared result builder) | Read old running run → provider settlement commits failed → acknowledge commits; retain failed/completedAt | New parameterized failed case passes. Calls orchestrator directly rather than MCP transport. |
| Acknowledge racing checkpoint | Read old waiting run → checkpoint completion commits → acknowledge commits; retain completed/completedAt/checkpointId | New parameterized completed case passes. Same ordering fixture, separate terminal-state assertion. |
| Disabled-provider continuation acknowledgement | Same acknowledge command and commit path; observedByRunId may be null | Collapses into same server race mechanism. No live disabled-provider reproduction required for this diff. |
| Dispose via MCP task_cancel | Same resolution function and parent-run-only merge; task state becomes disposed | Existing repeated acknowledge/dispose test passes. No new forced-settlement dispose case; covered by shared implementation, not an independently demonstrated race. |
| Already acknowledged/disposed; acknowledge after dispose | Emit existing subagent row only, no parent run merge option | Existing idempotence case passes; unchanged early return. |
| Missing app-owned task | Dispatch error; no merge | Unchanged validation branch; no visual fixture. |
| Missing parent/cohort/delivery or task absent from delivery taskIds | Only subagent update; no parent run merge option | Unchanged early-return branches. |
| Queued delivery, last task removed | Clear cohort delivery, cancel distinct queued delivery run, return parent id so only parent gets merge protection | Code inspection confirms selector uses parent payload id. Other run updates are intentionally not merged. Full delivery suite passes; no new isolated target-selector assertion. |
| Queued delivery, remaining siblings | Keep remaining taskIds; update wake message if found; return parent id | Same parent merge fixture. Unchanged message branch. |
| Nonqueued/missing delivery run | Update parent cohort, return parent id | Same parent merge fixture. |
| EventSink commitCommand, option absent | Normalize original events | Existing behavior retained for unrelated commands. |
| EventSink commitCommand, option present | Within SQL transaction, re-read current selected run; preserve current fields and replace delegatedCompletion only, before append/projection/publication | New forced-order tests exercise the real orchestrator, sink, and in-memory SQLite projection. Assertions check final status/completedAt/checkpointId, not the complete committed payload. |
| Helper: non-run event, other run, or missing current run | Return input event; merge only matching existing run | Code inspected. No new dedicated exhaustive helper test. |
| Existing writeWithEffects updateDelegatedCompletionOnly path | Extracted helper applies to every run.updated, retaining prior behavior | Existing “keeps a checkpoint completion committed between finalize's read and write” test passes in full file. |
| Repeated command receipt | Return prior committed result before merge work | Unchanged receipt guard; no additional capture fixture. |

Web (hosted and local), desktop, and mobile consume the same server projection; none has changed client code. Local, remote/relay, tunnel, multi-device, and multi-environment transport paths introduce no alternative merge implementation. The correction is provider-independent after a settling run.updated event reaches the sink; no adapter is changed. Codex/Claude/Cursor/Grok/OpenCode/Antigravity therefore collapse into the shared sink fixture, without claiming live verification of any provider. No new entry point, permission, scheduled-task behavior, schema, or reverse-state control is introduced.

## Proof inspected and reproduced

1. [Published before/red report](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/a63e142152844901/issue-24743-before.txt), also read at `/tmp/issue-24743-red-report.md`: reports both new assertions failing with failed→running and completed→waiting (checkpoint lost). The regression-only commit [2bcb5517dc](https://git.cafe/pingdotgg/t3code/commit/2bcb5517dce68f352479e71f3e51c072e2170c3d) changes only the test file. This pass inspected the report and commit; it did not independently check out and rerun that historical red commit.
2. [Published focused runtime test output](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/7ed9751a452be493/issue-24743-runtime.log), also read at `/tmp/issue-24743-runtime.log`: 2 passed, 28 filtered/skipped. These are runtime integration tests, not a production-provider transcript.
3. Independent pass-1 execution at audited HEAD:

```text
$ vp test run apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts
RUN v5.0.5 /home/ubuntu/wt/issue-24743
Test Files  1 passed (1)
Tests       30 passed (30)
Start at    21:42:44
Duration    16.22s
exit code   0
```

The new tests deterministically insert the settlement commit after the acknowledge handler read and before its commit, and assert that insertion happened. No sleep, polling, timing threshold, or retry controls that ordering. The runtime uses the real orchestration/event-sink layers and in-memory SQLite, with a test provider registry and hand-built settling run.updated events. Provider sessions are deliberately unused by this fixture. It does not execute a provider CLI, receive an actual 429, traverse the MCP transport, or independently demonstrate the reported Stop hang / queued-turn recovery.

## Minimum remaining proof

**None required for the scoped server race fix under the user's explicitly authorized code-path/event-order fallback.** The supplied historical red evidence plus independently green full focused test file and short transcript above meet that proof scope. No viewport/theme captures or recording is needed.

Do not describe this as a real-provider reproduction or claim that Stop/queue recovery was independently verified. A stronger claim would require a real provider turn settling during terminal task-result acknowledgement, followed by observing the settled run and subsequent queue/Stop behavior. That is outside the minimum proof accepted here. A dedicated forced-order dispose case or parent-versus-delivery-run selector test would increase coverage, but is not a missing visual fixture or a requirement to reproduce the acknowledged bug.

## FRICTION

- User reports real dev server boot healthy but preview_status available:false; this pass did not attempt browser use, and no browser evidence is claimed.
- Existing runtime.log is test-runner output, not a live-provider/server event transcript; the distinction must survive PR wording.
- Historical red execution is available as a report with assertion excerpts, not independently rerun in this read-only pass.
- No blocking friction. No repository changes made. Report is outside the repository and uploaded with ghdrop.
