← Model losses

Head-to-head comparison

openai / gpt-6.1-sol / low / low 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.

openai / gpt-6.1-sol / low / low effort answer

## Findings

Independent, read-only assessment of the supplied snapshot.

### 1. Impossible bookmarks repeatedly seek an unreachable position
**Confidence: high.** `useReviewResumePlayback.ts:55–60` checks native duration but never reconciles it with the requested target.

Reproduction: begin at `900`; metadata subsequently reports duration `600`; native seeking clamps to `600`. Each settled poll requests `900` again until the 15-second timeout. The request then remains pending, with its original target, and cannot complete (`:50–54`). This is particularly relevant when a saved bookmark belongs to an older, longer video.

**Smallest safe fix:** once valid metadata exists, explicitly handle `targetS > video.duration`. Fail closed immediately with an actionable notice, pause, and stop retrying that impossible seek. Retain the pending hold if it protects scanner ownership; allow explicit retry/cancellation. Do not silently resume at a different position without a defined product policy. If endpoint clamping is intended, normalize the request target and require **both** native and React cursors to reach that normalized target.

### 2. `begin()` accepts invalid targets and can report successful restoration
**Confidence: high for the hook API; caller reachability outside this packet is unknown.**

`begin()` stores any number without validation (`:32–39`). With `NaN`, both distance comparisons evaluate false (`:58,63`); with valid metadata, `seeking === false`, and `canResume() === true`, the hook calls `onReady()` despite no meaningful target being restored.

**Smallest safe fix:** reject nonfinite or negative targets before setting pending state or invoking preparation/seeking. The editor-return hook already performs this validation (`useReviewReturnSeek.ts:32–33`), but other callers are not shown.

## Lifecycle conclusions—not additional defects

- **Cold resume:** metadata, settled native seek, React cursor, and `canResume()` are all required before ownership transfers. The existing test covers this.
- **Metadata/seek stalls:** after 15 seconds, playback is paused and restoration stays held with a retry notice. This is explicitly tested behavior, not evidence of unintended failure.
- **Unmount/inspection switch:** interval cleanup clears the request and pending flag (`:69–70`); notice handling prevents A→B→A resurrection.
- **Editor cancellation:** the next poll pauses and cancels before readiness checks (`:48`). Existing coverage confirms no later playback revival. Immediate cancellation between polls is not established as necessary by this snapshot.
- **Editor-return consumption:** marking the key before navigation/state updates prevents repeated consumption during deferred router commits. A subsequent parameter-free render permits a genuine same-bookmark return.

## Targeted regression tests—3 maximum

1. Bookmark exceeds newly loaded duration: assert the chosen fail-closed policy, no repeated impossible seeks, and no `onReady()`.
2. Parameterized `begin(NaN)`, `begin(Infinity)`, and `begin(-1)`: assert no preparation, seek, or readiness callback.
3. Unmount while seeking, then advance timers: assert no further seeks or readiness callback.

These fixes should affect only positioning and ownership. A restored or clamped cursor must never manufacture watched coverage or certification eligibility.

**Uncertainty:** `coverageRecovery` and implementations of `seek`, `canResume`, and `onReady` are outside the packet. Recovery-parameter parsing, native seek behavior in the application, and server watched-proof enforcement cannot be verified here.

**Next action:** establish the out-of-duration policy, then implement target validation and the two core regression cases above.

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 a materially better-grounded audit: it avoids the false timeout-revival diagnosis, covers the explicitly requested impossible bookmark, supplies bounded regression tests, and preserves watched-proof boundaries. Its recommendation to retain a protective ownership hold also avoids A's unsupported change to tested behavior. This is a clear preference, not merely a forced slight distinction, although B's proposed out-of-duration policy still requires product confirmation.

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