← Model losses

Head-to-head comparison

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

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

## Findings

### 1. Saved targets beyond native duration can never finish restoring
**High confidence.** In `useReviewResumePlayback.ts:55–63`, native duration is checked for validity but never bounds `request.targetS`. For example, restoring `900` into a video whose duration is `600` repeatedly seeks to `900`; a browser-clamped cursor at `600` cannot satisfy either completion check. After 15 seconds, restoration remains pending with the failure notice (`50–53`). Retrying the same bookmark repeats the failure.

**Smallest safe fix:** Once valid metadata exists, bound the request target to native duration before comparing or seeking. Use that effective target consistently for native completion, React-cursor completion, and `getTarget()`. Keep `canResume()` gating intact. Clamping a navigation cursor must not create watched coverage or certification evidence.

### 2. Brief editor ownership does not cancel a pending resume
**High confidence.** Cancellation is checked only by the 100-ms interval (`48`). An editor can open and close in separate committed renders between ticks. `latest.current` then contains the closed-editor state, so the pending request survives and can subsequently call `onReady()`.

The existing cancellation test waits a full polling interval while editing (`useReviewResumePlayback.test.tsx:63–65`), so it misses this case.

**Smallest safe fix:** Also check cancellation in an effect after committed options update. When a same-inspection request exists and `shouldCancel()` is true, pause and cancel immediately. Retain the polling check as a backstop.

## Lifecycle assessment

- **Cold resume:** Correctly waits for valid metadata, native seek completion, the matching React cursor, and `canResume()` (`55–67`). The existing cold-resume test exercises these gates.
- **Metadata/seek stalls:** After 15 seconds, the hook pauses, shows a failure notice, and retains pending ownership. A fresh `begin()` resets the deadline. This is deliberate, fail-closed behavior—not independently a defect.
- **Unmount/inspection switch:** Cleanup clears the interval and request (`69`); inspection changes also reset pending state. Notice invalidation prevents A→B→A resurrection (`20–23`). No ordinary post-unmount playback defect is established.
- **Editor-return consumption:** Marking the key before navigation/playback (`useReviewReturnSeek.ts:21–35`) prevents repeated consumption while Router still renders the old parameters. The supplied test covers this.

### Conditional lifecycle issue: StrictMode effect replay
With React StrictMode’s initial effect replay, the return effect can consume the URL and start restoration; the playback effect’s cleanup then clears that request. On replay, `consumedRef` suppresses another start. The result is a “Returning…” notice with no pending request.

This is reproducible from these hooks under StrictMode, but the packet does **not** establish whether [REDACTED: private project name] enables it. If applicable, make playback effect re-setup rearm an interrupted same-inspection request without repeating URL consumption; preserve real unmount timer cancellation and inspection/editor cancellation.

## Targeted regressions — at most three

1. **Shortened video:** Bookmark exceeds duration; restoration uses the bounded target and calls `onReady()` only after both cursors match and `canResume()` permits it.
2. **Brief editor session:** Commit editor-open and editor-closed renders without advancing timers; subsequently satisfy both cursors and verify `onReady()` never fires.
3. **If StrictMode is supported:** Mount the integrated guided-return harness under StrictMode; verify restoration survives replay without duplicate URL consumption.

## Limits and next action

`coverageRecovery` is outside this packet, so recovery-parameter precedence cannot be validated. The implementations of `seek`, `onReady`, and server watched-proof/certification are also not supplied. Do not weaken those boundaries or treat restored position as watched evidence.

Next: implement the two confirmed fixes and their focused tests; validate StrictMode applicability before expanding the lifecycle change. Analysis was direct and limited to the supplied snapshot.

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

A provides a materially more reliable audit and safer implementation direction: it preserves intentional timeout ownership, supplies bounded-target and editor-cancellation fixes, proposes three targeted regressions, and explicitly preserves watched-proof boundaries. B recommends changing tested fail-closed behavior based on an impossible late-success trace. This supports a clear preference, not merely a forced slight preference; external integration behavior remains unverified.

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