← Model losses

Head-to-head comparison

cursor / composer-2.5 / Composer 2.5 default / unknown effort preferred over openai / gpt-6-luna / low / low effort · clear win.

Primary judge: Sol 6.1, requested Low. Effective provider effort and internal attempts were not verified. A close win is still a scored preference; it does not establish a material defect.

Reviewed public evidence

Task goal

Review [REDACTED: private project name]'s persisted reviewer-progress lifecycle as a client-side concurrency/state problem. Trace hydration and stale-response guards, in-flight checkpoint serialization and latest-tail draining, unmount/stop flush, failure and retry, restart, and transitions when reviewer, inspection, review revision, or coverage epoch changes. Use the hook and tests as primary evidence, then verify the exact InspectionContext/V3LayoutShell/store/API/attestation callers named in the supplied paths. The backend test is corroborating evidence only for reviewer-scoped revisions and persistence; do not expand this into a backend audit. Identify only concrete source-proven correctness defects or explicitly conclude that the supplied evidence shows no defect; distinguish a real user-visible data-loss/stale-state scenario from expected disposal and epoch-reset behavior. Explain the shortest triggering sequence, affected state and persistence outcome, and the smallest safe correction with focused regression cases. Do not edit files, run tests, make API calls, or infer acceptance/certification from partial progress. Preserve reviewer isolation, inspection scoping, revision/409 semantics, server-owned completion, and the no-gap watched-range union.

cursor / composer-2.5 / Composer 2.5 default / unknown effort answer

## Evidence packet: persisted reviewer-progress lifecycle (client concurrency)

### 1. Conclusion (confidence: **high** for “no proven persistence defect**; **medium** for transient UI-only edge)

The supplied hook, store, shell wiring, merge helper, attestation path, and tests describe a **coherent, fail-closed** client lifecycle for reviewer-scoped partial playback. I do **not** find a **source-proven** defect that causes **silent server data loss**, **cross-reviewer leakage**, **stale revision writes (409 bypass)**, or **gap-filling in watched-range unions**. What remains is mostly **expected disposal / epoch-reset behavior**, plus one **asymmetric local-store policy** on load failure vs 409 that is **mitigated by UI gating and visible error state**, not shown to corrupt server state.

---

### Lifecycle trace (evidence-grounded)

#### Activation and scoping (`useReviewProgress.ts`)

The persistence effect runs only when:

- `enabled`, `inspectionId`, `reviewerId` (auth), `sessionId === inspectionId`, `reviewStateHydrated`, and pack `sha` (`inspection_json_sha256`) are all present (lines 33–37).

That ties checkpoints to **one inspection**, **one reviewer**, and **one pack identity** before any `revision` exists.

#### Hydration + stale guards

1. On mount/dep change: local UI state resets (`hydrated`, `hasStarted`, `resumePositionS`) (lines 33–36).
2. `GET` via `fetchReviewProgress`; **pack gate**: `saved.inspection_json_sha256 !== sha` throws (lines 161–163) → catch shows restore error; **`revision` is never set**, so **flush cannot PUT** (lines 104–106, `!revision`).
3. On success: `revision`, `endS`, bookmark; **`acknowledged`** signature seeded from server `played_ranges` (lines 164–168).
4. **Same-revision local reuse**: if `playedCoverageRevision === revision` and coverage is for this `inspectionId`, merge local ranges before server merge (lines 170–171); else start from `[]` and, if revision changed, clear `fullVideoReviewPass` / `fullVideoReviewSubmission` (lines 172–176).
5. `mergeSaved` unions server intervals with in-memory ranges via `mergeReviewProgress` (no positive-gap bridge) (lines 95–102, `mergeReviewProgress.ts` lines 1–25).
6. **`mergeSaved` / `sameInspection()`**: updates store only if `reviewSessionInspectionId === inspectionId` (lines 49, 96–97).

**Inspection / session boundaries** (`InspectionContext.tsx`, `useV3SessionStore.ts`):

- `beginInspectionReviewSession` (layout effect, lines 181–183) clears scan/coverage maps and bumps `coverageEpoch` when the inspection changes (store lines 844–892).
- `hydrateInspectionReviewState` for a **different** `inspectionId` atomically resets coverage and scan atoms (store lines 913–946); **same inspection** re-hydration keeps the live scan cursor (lines 948–956).

#### In-flight serialization + latest-tail drain

- Single-flight: `if (inFlight) { await inFlight; return flush() }` (lines 104–107).
- After save: `acknowledged = signature`; `mergeSaved(response)`; state `'saved'` only if post-merge signature matches (lines 115–118).
- **Pagehide during save**: test proves second PUT with tail `[[0,6]]` after first completes with `[[0,5]]` (`useReviewProgress.test.tsx` lines 230–243).

#### Unmount / stop flush

- Cleanup: `void flush()` then `disposed = true`; timers/listeners removed (lines 194–204).
- Pause: `useEffect` calls `flushRef` when `!isPlaying` (line 207).
- `visibilitychange` / `pagehide` call same `flush` (lines 191–193).

Late responses: `mergeSaved` and state updates guard on `disposed` / `sameInspection()`.

#### Failure, retry, 409

- Save error: `blocked = true`; **409** additionally `setHydrated(false)` and clears `queueScanPlayedTimeCoverage`, `fullVideoReviewPass`, `fullVideoReviewSubmission` (lines 119–124).
- Test: after 409, `retry()` refetches new revision and **does not relabel** old samples onto new revision (test lines 216–228).
- `retry()` = `setAttempt` → full effect re-run (line 214).

Backend corroboration (not audited here): stale `revision` → **409**; restart bumps revision; reviewer isolation (`test_review_progress.py` lines 44–57, 19–33).

#### Restart

- `restarting` blocks normal flush; awaits `inFlight` first (lines 131–135).
- `PUT` with `restart: true`; on success: new `revision`, cleared coverage in store, `acknowledged` for empty ranges (lines 137–148).
- Test: during in-flight restart, **old coverage retained** until ack; no extra non-restart saves after success (test lines 245–262).
- Shell: `handleRestartFullReview` pauses, `await reviewProgress.restart()`, then `startFreshReview()` (`V3LayoutShell.tsx` lines 981–984) — chains **server restart** with **new queue pass** (`startQueueScanFromBeginning`, store lines 1396–1440).

#### Revision / pack / coverage epoch transitions

| Event | Review-progress hook | Store coverage / pass |
|--------|----------------------|------------------------|
| Inspection change | Effect deps `inspectionId`; new fetch | `beginInspectionReviewSession` clears coverage; epoch++ |
| `sha` change | Effect re-runs (`sha` dep) | Successful fetch with **new** `revision` resets local tail when `playedCoverageRevision !== revision` (lines 172–176) |
| `coverageEpoch++` | Re-fetch only if `fullVideoReviewPass == null` (lines 208–213) | `startQueueScanFromBeginning` clears local coverage, new pass id, epoch++ (store 1425–1439) — **by design**: durable server union unchanged until explicit `restart` |
| Queue scan stop | N/A | `setQueueScanMode(false)` **preserves** `queueScanPlayedTimeCoverage` (store 1356–1358); test lines 52–61 |

**Not acceptance from partial progress**: `buildFullVideoReviewSubmissionCandidate` requires `isFullInspectionQueueComplete` (`fullVideoReview.ts` lines 143–177); shell passes `reviewProgress.hydrated && overridesReady` into attestation (`V3LayoutShell.tsx` 1009–1018; `useFullVideoReviewAttestation.ts` 57–81).

#### Shell integration (`V3LayoutShell.tsx`)

- `useReviewProgress` with `capturePosition` gated by `canCaptureReviewPosition` (queue, recovery, edit routes) (lines 641–647, 659–660).
- Full review start/restart/coverage recovery **blocked** until `reviewProgress.hydrated` (e.g. 872, 950, 982, 686).
- Resume seek waits `overridesReady && reviewProgress.hydrated` (663–666).
- Error UI with retry (2155–2159).

#### API surface (`inspections.ts`)

- `fetchReviewProgress` / `saveReviewProgress` — typed `revision`, `played_ranges`, optional `restart`, `resume_position_s` (lines 975–995). No react-query cache race in this path; hook owns concurrency.

---

### 2. Alternatives / discarded hypotheses

| Hypothesis | Verdict |
|------------|---------|
| **Unmount flush writes into wrong inspection’s Zustand** | Discarded: `mergeSaved` requires `sameInspection()`; cleanup sets `disposed`. |
| **In-flight save drops tail** | Discarded: covered by test (pagehide + second save). |
| **409 leaves client writing stale revision** | Discarded: `blocked` + store clear + `hydrated false`. |
| **Restart races with periodic flush and wipes new playback** | Discarded: `restarting` blocks flush; test holds coverage until restart ack. |
| **Epoch bump should always re-hydrate review-progress** | **Expected behavior**: epoch bump with **non-null** `fullVideoReviewPass` intentionally does **not** bump `attempt` (lines 208–213); fresh scan clears **local** coverage only; server union still reviewer-scoped partial evidence until `restart`. |
| **Failed initial GET + continued playback loses watched proof** | **Partially true locally**, mitigated: without `revision`, flush no-ops; user sees error; full-review paths require `hydrated`. Manual play could grow store ranges without PUT until `retry()` — **fail-closed persistence**, not silent server corruption. |
| **`mergeReviewProgress` bridges gaps** | Discarded: tests require positive gaps preserved (merge test lines 14–16; hook test lines 37–49). |

---

### 3. Missing evidence (consequence)

- **`usePlayedSpanAttestation` / `playedRangeAttestation`**: epoch invalidation referenced in store comments (lines 422–429) but not in packet — cannot fully verify attestation ↔ checkpoint ordering; shell still gates completion POST on `buildFullVideoReviewSubmissionCandidate`.
- **Backend review-progress handler** (beyond tests): revision/409/pack-reset semantics taken from tests only.
- **`canCaptureReviewPosition` implementation**: only exercised via tests importing it; shell gates align with test keys (test lines 210–214).

Uncertainty does **not** establish a defect in the hook’s serialization or revision semantics.

---

### 4. Smallest safe correction (only if product wants stricter fail-closed UI)

**Not required to fix a proven persistence bug** in the packet. If product wants to remove **stale local coverage** after failed hydration (network or `Review revision changed`):

- On fetch failure (and optionally on sha mismatch before throw), clear `queueScanPlayedTimeCoverage` for `inspectionId` when `revision` was never bound — mirror 409 store hygiene (lines 121–123).

**Focused regression cases** (if implemented):

1. Fetch fails → store coverage cleared → `retry()` → server empty ranges hydrate correctly.
2. Fetch fails → user cannot start full review without `hydrated` (unchanged).
3. 409 path unchanged (test 216–228).

---

### 5. Next useful action

For the mixture-of-agents synthesizer: treat **supplied evidence as showing no user-visible persistence defect** under stated invariants (reviewer isolation, revision/409, server-owned completion, no-gap union). Label **fetch-fail vs 409 local-store asymmetry** as **UX/consistency**, not proven server data loss, unless an out-of-packet path allows full acceptance without `reviewProgress.hydrated`.

**No `MATERIAL_EVIDENCE_CONFLICT`** in the supplied snapshot.

openai / gpt-6-luna / low / low effort answer

## Conclusion

A concrete stale-checkpoint race is visible in `useReviewProgress.ts`: a successful in-flight save can overwrite a newer restart’s revision and coverage.

**Trigger:** begin a normal checkpoint save, then invoke `restart()` while that save is pending. After the first save resolves, `restart()` sends its reset and receives the new revision. But the first save’s continuation also runs `mergeSaved()` (lines 115–117), which merges its old-revision ranges into the store; `mergeSaved()` checks only inspection identity (lines 95–102), not whether the save still belongs to the current revision or restart. The restarted hook then sets `latest = []` and clears coverage (lines 139–147), but a late merge can repopulate old coverage after that reset.

This is more than expected disposal: if the late merge happens after the restart acknowledgement, the UI can show pre-restart coverage and the next checkpoint can try to save those ranges using the new revision. The server may reject or persist them, depending on ordering; either way the client’s acknowledged reset is not reliably reflected. The test at `useReviewProgress.test.tsx:245–263` covers a checkpoint arriving *during* restart, but not the old save response’s merge after restart acknowledgement.

**Smallest safe correction:** bind each async save response to the revision/reset generation that launched it, and ignore its merge/state effects if that generation is no longer current. Add a deferred-save regression that resolves the old save after restart succeeds, asserting coverage stays cleared and no old ranges are submitted under the new revision.

## Other lifecycle assessment

- Hydration is inspection-session guarded: fetch checks `disposed` and `sameInspection()` before applying results (`useReviewProgress.ts:161–179`). Revision mismatch through the 409 path clears hydration and coverage rather than relabeling old samples (`:119–125`); the corresponding retry test confirms this (`useReviewProgress.test.tsx:216–228`).
- In-flight checkpoints serialize through `inFlight`; subsequent flushes wait and recursively drain the latest tail (`useReviewProgress.ts:104–129`). Pagehide/visibility flushes use that path (`:190–204`), and the test verifies latest-tail draining (`useReviewProgress.test.tsx:230–243`). Unmount calls flush before marking the instance disposed (`:194–204`), so the request can continue, while its UI/store merge is still inspection-guarded.
- Non-409 failures block further writes until retry (`useReviewProgress.ts:119–125`); retry recreates the effect via `attempt` (`:205, 214`). This appears intentional fail-closed behavior, not silent acceptance.
- Inspection changes reset session-scoped state in `InspectionContext.tsx:181–183` and the store (`useV3SessionStore.ts:844–894`). Coverage epoch changes trigger a retry only when no full-video pass exists (`useReviewProgress.ts:208–213`); restart and session transitions intentionally invalidate coverage. The packet does not establish a separate reviewer-change teardown beyond the hook’s `reviewerId` effect dependency.
- Range merging preserves disjoint gaps (`mergeReviewProgress.ts:17–24`), and partial checkpoints do not mark completion; completion remains tied to the server-owned attestation path (`useFullVideoReviewAttestation.ts:18–25`, `fullVideoReview.ts:135–195`).

**Uncertainty:** the packet does not include API/backend implementation details beyond the corroborating backend tests, so the exact server outcome of a stale range submitted with a new revision cannot be determined. The client-side stale-state race itself is supported by the supplied hook and test paths.

Primary judge's stated reason

A avoids directing implementation toward an impossible restart interleaving, whereas B makes that interleaving its primary defect and correction target. This is a material correctness advantage, not a slight forced preference; it does not prove A’s entire lifecycle assessment exhaustive.

This reason is the judge's assessment. No independent factual-defect finding is asserted by this record.

Battle wave: 67ab98b0-26bb-40e8-b4d2-2ac3636a541c. Pair: brp1_5d5b9139526afc0ace7819e2923b1b03355325aeb540dda0f9245b73d8a5a422. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.