← Model losses

Head-to-head comparison

cursor / composer-2.5 / Composer 2.5 default / unknown effort preferred over xai / grok-4.7-efficient / low / low effort · close 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

Audit [REDACTED: private project name]'s lazy-video saved-position restore and editor-return seek lifecycle. Trace cold resume, target outside new native duration, metadata/seek stalls, unmount/inspection switch, and editor cancellation; identify only reproducible correctness defects, specify the smallest safe implementation and 0-3 targeted regression tests, preserving server watched-proof/certification boundaries.

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

## Evidence packet: lazy-video resume & editor-return seek audit

### 1. Conclusions (source-grounded)

**Cold resume lifecycle** — `begin()` sets `pendingRef`, stores `requestRef` `{ inspectionId, targetS, startedAt }`, pauses, `prepareVideo()`, `seek(targetS)`, and shows “Returning…”. The 100ms interval (lines 44–68, `useReviewResumePlayback.ts`) only completes when: same `inspectionId`, not `shouldCancel()`, metadata valid (`readyState >= 1`, finite `duration > 0`), video paused, not `seeking`, `|video.currentTime - targetS| ≤ 0.1`, then `|currentTime (React) - targetS| ≤ 0.1` and `canResume()`. Then it clears pending, clears request, clears message, calls `onReady()`. Test lines 23–47 confirm native seek + React `currentTime` are both required; `onReady` waits until `<Harness time={1026.793} />`.

**Metadata / seek stalls** — Missing metadata loops at line 55 until valid or 15s. After 15s (lines 50–53): `pause()`, error message, **does not** clear `pendingRef` or `requestRef`. Test lines 48–54 expect `pendingRef === true`, `onReady` never called. Same inspection: interval only hits timeout branch (no further seeks). **By design in tests**, not a defect vs. supplied tests.

**Inspection switch / unmount** — `useEffect` deps `[inspectionId]` (lines 41–70): on change, clears `pendingRef` and `requestRef` before new interval; cleanup does the same. Render-time `notice.inspectionId !== options.inspectionId` → `setNotice(null)` (lines 21–23). Tests 48–57, 74–85: switch to inspection 2 clears pending/message/`getTarget()`; A→B→A does not revive notice or `onReady`.

**Editor cancellation** — Interval checks `shouldCancel?.()` → `pause()`, `cancel()` (lines 47–48). Test 60–71: `editing` clears pending; later metadata + `time=900` does **not** call `onReady`.

**Editor-return seek** — `useReviewReturnSeek.ts`: reads `seek_s`, `resume_scan`; skips if `parseCoverageRecoveryParams(searchParams) != null` or `resume && !ready` (line 20). One-shot via `consumedRef` key `inspectionId:pendingSeekS:resume` before `setSearchParams` strip (lines 21–31). `resume` → `beginResume(time)`; else `pauseManualReview()` + `seek(time)`. Test 88–110: repeated renders with same params → single navigate/prepare/seek; fresh params after clear → second consume.

**Server watched-proof / certification** — Packet is client hooks + tests only. No API, proof, or certification logic. Safe fixes stay in these hooks (clamp/timeout UX); do not move resume proof to server based on this evidence.

---

### Reproducible correctness defect (high confidence)

**Saved target beyond native `duration` after lazy load**

When metadata is valid but `targetS > video.duration`, browsers typically clamp `video.currentTime` to `duration`, so `|video.currentTime - targetS| > 0.1` stays true (lines 58–60). The hook calls `seek(targetS)` every 100ms while not `seeking`, until the 15s timeout, then shows “Could not restore…” with `pendingRef` still true (same as metadata stall). No branch clamps or compares `targetS` to `duration`.

- **Repro**: `begin(T)` with `T` > eventual `video.duration` after `prepareVideo` / replacement media.
- **Impact**: Seek thrashing until timeout; misleading “could not restore” vs. “bookmark past end of video”; user blocked with `pendingRef === true` until inspection change or external cancel (if any—consumers not in packet).
- **Confidence**: High on loop + timeout; medium on product severity (shorter re-encoded asset is plausible).

**Smallest safe implementation** (client-only, `useReviewResumePlayback.ts` interval, after line 55):

- Compute `boundedTarget = Math.min(request.targetS, Math.max(0, video.duration - ε))` (small ε, e.g. 0.05).
- Use `boundedTarget` for `seek` and both time comparisons (lines 58–63).
- Optionally: if `request.targetS > video.duration + 0.1`, set a one-shot notice (“Saved position was past the end of this video; resumed at end.”) without touching server proof.

Preserves: dual gate (native + React `currentTime`), `shouldCancel`, inspection discard, 15s metadata timeout semantics, return-seek consumption unchanged.

---

### Alternatives / discarded / false positives

| Hypothesis | Verdict |
|------------|---------|
| Timeout should clear `pendingRef` | **Discarded** — test lines 52–53 require `pendingRef === true` after timeout. |
| `useReviewReturnSeek` double-consume on stale route | **Discarded** — `consumedRef` + test 88–110. |
| Render-phase `setNotice` on inspection change is a resume bug | **Low** — matches “discard notice” comment; tests 74–80. |
| Non-`resume_scan` return doesn’t call `prepareVideo` | **Uncertain** — line 35 only `pause` + `seek`; lazy-load gap possible, not covered by tests. |
| Invalid `seek_s` after consume | **Minor** — lines 32–33: URL stripped, `consumedRef` set, no `beginResume`; silent no-op (no test). |

---

### 2. Targeted regression tests (0–3)

1. **Duration shorter than bookmark** — `begin(1500)`; set `duration=900`, `readyState≥2`, `currentTime=900`, `seeking=false`; drive React `currentTime` to 900; expect `seek` last called with clamped end (e.g. ≤900), `onReady` once, `pendingRef` false (no 15s error).
2. **Editor cancel invariant (optional)** — Already covered by test 60–71; only extend if clamp logic could call `onReady` after cancel.
3. **Invalid `seek_s` (optional)** — If product wants visibility: `seek_s=abc` → params cleared, `beginResume`/`seek` not called; document expected UX.

---

### 3. Missing evidence / consequences

- **`coverageRecovery.js` / `parseCoverageRecoveryParams`** — Return seek deferred when non-null (line 20). Cannot audit interaction with coverage recovery or duplicate seek.
- **Callers of `pendingRef`, `canResume`, `prepareVideo`, certification** — Cannot confirm global playback/certification gating or watched-proof boundaries beyond “don’t change server.”
- **Real browser seek clamping** — Clamp values (ε, behavior at exact `duration`) may need one manual/browser check.

---

### 4. Next useful action

Implement **duration-bounded target** in the resume interval (single site, ~5–10 lines), add **test (1)** above, run existing `useReviewResumePlayback.test.tsx` suite. If coverage recovery is in scope, admit `coverageRecovery.js` and trace `resume_scan` + recovery params together.

**Uncertainty summary**: One high-confidence client defect (bookmark past native duration). Timeout/`pendingRef` behavior is test-specified, not a defect relative to the packet. Return-seek one-shot consumption appears correct per tests.

xai / grok-4.7-efficient / low / low effort answer

The out-of-range bookmark is the only production correctness defect. Metadata stalls, inspection switches, unmount, and editor cancel match the tests. Do not treat a clamped end as a successful restore.

1. Conclusion
An unreachable saved position never settles and can disturb certification boundaries. In `useReviewResumePlayback.ts`, once `readyState >= 1` and duration is finite, any native time more than 0.1s from `request.targetS` calls `seek(request.targetS)` again (lines 55–60). If the bookmark is past the new duration, the element clamps and that difference stays above 0.1s, so the hook re-seeks about every 100ms until the 15s branch (lines 50–53). That branch pauses, sets “Could not restore…”, leaves `pendingRef` true, and does not call `onReady`. It does not latch, so every later tick calls `pause()` and `setMessage()` again. The first `begin()` seek (line 39) can already be past the end. Repeated end-seeks are the certification risk; `onReady` is the scanner handoff (file comment, lines 3 and 62–67) and must not run for a frame that does not exist. Confidence: high.

Cold resume, metadata stall, inspection switch, and editor cancel behave as the tests require. The interval waits for metadata, `seeking === false`, a native match, and a React `currentTime` match before `onReady` (lines 55–67). The 15s path keeps `pendingRef` true and does not call `onReady` (test lines 48–54). Inspection changes drop the notice during render (hook lines 21–23) and clear the request when the effect re-subscribes (lines 41–43, 69–70); A→B→A does not revive it. `shouldCancel` pauses and `cancel()`s, and a later ready frame does not call `onReady` (test lines 60–71). `useReviewReturnSeek` marks the key before navigation (lines 22–31), so stale `seek_s`/`resume_scan` renders do not double-fire (test lines 88–110).

Smallest safe fix, only in the interval after the existing cancel check: if duration is finite and `targetS > duration + 0.1`, or if the 15s deadline has passed, take one terminal failure. Pause once, set the existing failure message, keep `pendingRef` true, set `requestRef` to null so later ticks no-op, and do not seek again or call `onReady`. Do not clamp-and-complete.

2. Alternatives and discarded hypotheses
Discarded: clamping the bookmark to duration and calling `onReady` when both clocks match that end. That would release the scanner for media the saved frame is not in. Discarded: clearing `pendingRef` on that path. The timeout test requires it to stay true. Discarded: treating the 15s metadata hold itself as a bug. Late metadata must not auto-certify after the failure copy. Discarded: a Strict Mode wipe where effect setup and cleanup null `requestRef` (lines 42–43 and 69) after `useReviewReturnSeek` has consumed the key (lines 22–25), so a strict remount would not call `begin` again. Real unmount and inspection-id change should clear. Deps are stable, so this is dev-only, not a production defect. Discarded: the 100ms `shouldCancel` gap. An editor open and close inside one quiet interval could miss cancel. Not a realistic editor session.

3. Missing evidence
`parseCoverageRecoveryParams` is outside the packet (`../coverageRecovery`). If it returns non-null for `seek_s` plus `resume_scan=1`, the return-seek effect never consumes (hook line 20) and the guided-return test would not hold. Parent `onEnded` or watch-proof listeners are also outside the packet, so the certification risk of repeated end-seeks is inferred from this hook’s `onReady` gate, not from server code.

4. Next action
Add one regression: begin at a time past a finite duration, advance one interval, expect no further raw `seek` of that time, the failure notice, `pendingRef` still true, and `onReady` not called even after a React time equal to duration. Optionally add a second: after 15s without metadata, further 500ms advances do not call `pause` again. No third test.

Primary judge's stated reason

Forced, slight preference for A because its explicit boundary uncertainty better respects the request for reproducible findings without presenting an inferred certification consequence as established. B's fail-closed implementation may be preferable operationally. This is not an established material quality gap, and an independent review could reasonably prefer B.

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

Battle wave: e8b943ba-5475-4c9f-82d2-c82f9157debd. Pair: brp1_73401ff8a583cf8338dcc4dbee6f6416f7e1da10580ece6a512170e4f272d14f. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.