← Model losses

Head-to-head comparison

xai / grok-4.7-efficient / high / high effort preferred over deepseek / deepseek-flash / none / unknown 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

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.

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

The cold-resume hold, the inspection-switch cleanup, and the unmount cleanup are correct. Two defects in the resume poller are reproducible, and one in the return-seek consumption is reproducible. The success gate must stay unchanged so a clamped or unmatched position cannot certify a watched resume.

## Defects

**1. A bookmark outside the current native duration seek-livelocks.** High confidence. In `useReviewResumePlayback.ts:55-60`, once `readyState >= 1` and `duration` is finite, any `|currentTime - target| > 0.1` calls `seek(target)` again. The media element clamps `currentTime` to `duration` and then clears `seeking`. If `target > duration + 0.1`, the difference never closes, so the poller seeks every 100 ms until the 15-second watchdog. That storm can interrupt lazy duration growth. `onReady` is not called, which is the right certification outcome, but only because the mismatch never clears.

**2. The 15-second failure is not terminal.** High confidence. `useReviewResumePlayback.ts:50-53` pauses and calls `setMessage`, then returns without clearing or flagging the request. `setMessage` always does `setNotice({...})` with a new object (`useReviewResumePlayback.ts:24-26`), so every later tick re-renders and calls `pause()` again for the rest of the inspection. The existing timeout test requires `pendingRef` to stay true and `onReady` not to run. Those must be preserved. What is wrong is the non-idempotent pause and notice rewrite, including after an unreachable target finally times out.

**3. A lingering return token is applied again when `inspectionId` changes.** Medium-high confidence. `useReviewReturnSeek.ts:21-34` consumes `` `${inspectionId}:${pendingSeekS}:${resume}` ``. The file’s own comment says the old route can still render after `setSearchParams`. An inspection switch in that window produces a new key, so `beginResume` runs for the new inspection at the previous bookmark. That can start a certified resume on the wrong asset. The same-inspection re-render guard does not cover this.

Editor cancellation after a resume has already started is correct: `shouldCancel` is checked before `onReady`, and the existing test holds. Two adjacent holes should be closed in the same patch, not treated as separate lifecycle bugs. `begin` (`useReviewResumePlayback.ts:32-39`) does not consult `shouldCancel`, and the cancel branch at line 48 pauses media the editor now owns.

## Smallest safe implementation

Keep the initial `begin()` seek. Do not treat a clamped time as success. Do not call `onReady` unless both cursors are within 0.1 seconds of the original finite target, `canResume()` is true, and `shouldCancel` is false. Do not clear `pendingRef` on failure.

In `begin`, return immediately when `shouldCancel()` is true, or when `targetS` is non-finite or negative. Do not arm, pause, prepare, or seek. Store `failed: false` on the request.

In the interval:

- On `shouldCancel`, call `cancel()` only. Do not pause.
- On timeout, if `failed` is not already set, pause once, set the existing failure string once, and set `failed`. Then return. Leave `pendingRef` true and do not call `onReady`.
- After `readyState >= 1`, if `duration` is finite and `target > duration + 0.1`, return without seeking and without `onReady`. A later larger duration can still complete through the existing success path. If `duration` is not yet finite, keep waiting as today.
- Leave the success block at `useReviewResumePlayback.ts:62-67` unchanged.

In `useReviewReturnSeek.ts:21`, consume `` `${pendingSeekS}:${resume}` `` only. Still clear `consumedRef` when `seek_s` is empty, so a later real edit of the same bookmark works.

## Regression tests

Add these three tests next to the existing ones. Do not change the current assertions.

1. **Outside duration, then growth.** `begin(900)` with `duration` 100, `readyState` 2, and `currentTime` 100. Advance several ticks. `seek` must not be called again, and `onReady` must not run. Then set `duration` to 1600 and advance one tick. `seek(900)` must run once. After native and React times match, `onReady` runs once. This proves a clamped playhead is not certified and a provisional short duration can still recover.
2. **Timeout is idempotent.** With no metadata, advance past 15 seconds. The failure notice appears, `pendingRef` stays true, and `onReady` does not run. Advance another second. `pause` call count and the notice string must stay unchanged. `pendingRef` must stay true.
3. **Lingering token, other inspection.** Render the guided-return harness with `seek_s` and `resume_scan=1`, then render again with another `inspectionId` and the same params. `prepareVideo` and `begin`/`seek` must run only for the first inspection. Clearing the params and returning the same token later must still run a second time.

## Discarded

- The cold-resume dual cursor hold, the re-seek when a competing zone moves an in-range playhead, the unmount interval cleanup, and the A-to-B-to-A notice drop all match the tests. No change is needed.
- Clearing the request in the interval effect setup is required on inspection change and does not wipe `begin()` in production effect order. A Strict Mode double-invoke can drop an already-consumed resume in development only. That is not a production defect.
- Updating `latest` in an effect is safe for this composition: the resume hook is declared first, so `begin()` sees the current options.
- A `NaN` target would skip both `>` checks and reach `onReady`. The return-seek caller already rejects non-finite times. The `begin` guard above closes the public entry without a separate scenario.
- Clamping and then calling `onReady` would violate watched-proof and certification. It was rejected.
- Clearing `pendingRef` on timeout would contradict the existing hold-visibly test and could release the scanner. It was rejected.
- The non-resume `seek(time)` path ignores `ready`. Whether that drops the seek depends on the injected `seek`, which is not in the packet.

## Missing evidence

`coverageRecovery.js` is outside the packet. If `parseCoverageRecoveryParams` stays non-null while `seek_s` is present, the return effect never consumes that token. Do not change that deferral until that helper is read. The parent that honors `pendingRef` and `onReady` is also outside the packet, so this patch must keep failure as pending, not ready.

## Next action

Patch only those two hooks as above, add the three tests, and re-run the existing resume and return-seek tests. Do not certify a position the native and React cursors did not both reach.

deepseek / deepseek-flash / none / unknown effort answer

I'll analyze the supplied evidence directly (no team tools needed — this is a read-only independent assessment lane).

## Conclusion

The lazy-video resume/return-seek lifecycle has **three reproducible correctness defects** in the supplied hooks. All three are visible purely from the snapshot; there is also one dependency-level uncertainty (the omitted `coverageRecovery.js`) that is relevant to the return-seek path.

---

### Defect 1 — Timeout path leaves a live request, so it can fire after "Could not restore"

`useReviewResumePlayback.ts:50-54`:
```ts
if (Date.now() - request.startedAt > 15000) {
  current.pause()
  setMessage('Could not restore the review position. Select Resume to try again.')
  return
}
```
The timeout branch does **not** clear `pendingRef.current` or `requestRef.current`. Compare the success branch (`:64-65`), which clears both, and `cancel()` (`:27-31`), which clears both.

Implications:
- `pendingRef.current` stays `true` at timeout. The test at `useReviewResumePlayback.test.tsx:48-53` **asserts this as correct** (`expect(result.pendingRef.current).toBe(true)` after 15.1s) — so the test codifies the behavior rather than catching it. That means the "bug" is at least intentional-looking in the test, but the *downstream* consequence is still a defect.
- Because `requestRef.current` is still set, the 100 ms interval keeps running. Once metadata arrives (after the notice is shown), the loop proceeds to `:55-67` and can call `current.onReady()` — i.e. the video can resume **after** the user was told restoration failed, with no `begin()` retry. The only guards are the target/duration comparison and `currentTime` convergence; a late-arriving metadata event satisfies both.
- Cold-resume trace: `begin()` → seek issued → no metadata → 15 s timeout → notice shown → metadata finally loads → seek converges → `onReady()` fires → scanner/playback takes ownership although the notice still says "Could not restore."

Smallest safe fix: in the timeout branch, clear both refs before/after setting the message:
```ts
if (Date.now() - request.startedAt > 15000) {
  pendingRef.current = false
  requestRef.current = null
  current.pause()
  setMessage('Could not restore the review position. Select Resume to try again.')
  return
}
```
This also means the existing assertion at test line 53 should be inverted. Confidence: **high** (control flow is fully contained in the snapshot).

---

### Defect 2 — Inspection-change reset wipes state but does not pause the video

`useReviewResumePlayback.ts:41-43` (effect body, re-run on `options.inspectionId` change per `:70`):
```ts
pendingRef.current = false
requestRef.current = null
```
and the render-phase notice reset at `:21-23`:
```ts
if (notice.inspectionId !== options.inspectionId) {
  setNotice({ inspectionId: options.inspectionId, text: null })
}
```
Neither calls `current.pause()`. The `shouldCancel` branch (`:48`) **does** call `current.pause()` before cancelling, showing pause is the intended teardown action.

Implications:
- When the user switches inspection (A→B) mid-resume, the pending request is discarded and the notice cleared, but if the video element was (or becomes) playing — e.g. the earlier `begin()` issued `prepareVideo()`/`seek()` and the native `seek` completed just as the switch happened — the newly selected inspection inherits a potentially unpaused, mid-seek video. The test at `:48-58` covers the metadata-missing switch and only checks `pendingRef`/`message`, not `paused`, so this is unverified.
- The A→B→A trace (`:74-86`) is also only checked for `message`/`pendingRef`/`getTarget`; no pause assertion.

Smallest safe fix: on the inspection-change effect, call `latest.current.pause()` (or `cancel()`, which now also clears the refs and message) when the previous request was live. Using `cancel()` reuses the existing teardown and avoids divergence. Confidence: **medium-high** — the code shape is clear, but whether an unpaused video is reachable depends on `prepareVideo()`/`seek()` semantics outside the packet (see uncertainty below).

---

### Defect 3 — `useReviewReturnSeek` marks consumed before validating the time, permanently losing a malformed-seek retry

`useReviewReturnSeek.ts:25-35`:
```ts
consumedRef.current = key
setSearchParams(...)            // strips seek_s / resume_scan
const time = Number(pendingSeekS)
if (!Number.isFinite(time) || time < 0) return
if (resume) beginResume(time)
else { pauseManualReview(); seek(time) }
```
The effect marks the param consumed and strips it from the URL **before** validating `time`. If `seek_s` is non-numeric or negative, the params are removed and no seek happens. The consumed key is now fixed, and the URL no longer carries the seek, so the intent is silently and irrecoverably dropped. Note `pendingSeekS === ''` is handled at `:19`, but `seek_s=abc` or `seek_s=-5` is not.

Also, because `pendingSeekS`/`resume` are read during render (`:16-17`) and included in the dep array (`:36`), after `setSearchParams` strips them the effect re-runs with `pendingSeekS == null` and resets `consumedRef.current = null` (`:19`). That is *intended* for the "later genuine edit returns to the same bookmark" case (test `:105-109`), but it also means the consumed guard is only as durable as the URL and cannot be used to force a retry.

Smallest safe fix: validate before mutating:
```ts
const time = Number(pendingSeekS)
if (!Number.isFinite(time) || time < 0) {
  consumedRef.current = null
  return
}
consumedRef.current = key
setSearchParams(...)
...
```
Confidence: **high** for the malformed-input loss; **medium** that a producer ever emits malformed `seek_s` (no evidence in the packet about the writer).

---

### What is correct (discarded hypotheses)

- **Guided-return one-shot consumption** (`:22` guard + mark-before-navigate, `:23-31`) correctly survives the deferred route commit and repeated renders with stale params. Test `:88-110` verifies exactly this, including the legitimate second return. No defect.
- **"React cursor must catch up" gate** (`:63`) is a deliberate, correct guard: native `seek` completion alone does not settle the scanner. Test `:36-45` exercises it.
- **Competing initial-zone writ

Primary judge's stated reason

B offers the more useful and safer audit basis: its timeout fix addresses observable repeated work without removing the pending guard, and its tests exercise duration growth, timeout idempotence, and return consumption. The preference is clear because A's central claimed late-resume failure is impossible under the shown deadline branch and motivates changing an explicitly tested hold. This does not establish that all of B's findings or proposed changes are justified.

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_b247edd14cf9f6db389e578e082cd814e9829b5e803501ea2ae357814daf7a16. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.