commit 1b438ce78e6e9d977b36c175ec785ce3e05317b0
parent 7ac4cc1898708139ff4bcec98bf53aa9c35d33df
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 19 Oct 2026 15:14:19 -0400
plans: release 36 lane A — the record (run while paused, fetch-chat, Find clips), gates
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 114 insertions(+), 0 deletions(-)
diff --git a/plans/release-36/find-clips.md b/plans/release-36/find-clips.md
@@ -0,0 +1,114 @@
+# Release 36 lane A — `r36/find-clips`: one button on the video page (as shipped)
+
+Release 35 ran the clip finder's chain from a shell, step by step, and forced two transcriptions through a PAUSED
+worker pool by hand. This lane makes the chain one job and one button: **Find clips** on the video page (`pnpm ops
+find-clips`), a run-while-paused path for one manual transcription, and a chat-replay fetch for one video. Rulings
+followed: the UI works with no model (nothing here calls one); every CLI operation added has a button; no yt-dlp or
+ASR by hand (every step is an editor job or a worker lease); paced YouTube requests; plain words, no lead paragraphs;
+synthetic fixtures only; commits end with the one Co-Authored-By trailer.
+
+## What
+
+1. **Run while paused** — `common/jobs/workerPool.ts`: `acquire(signal, {whilePaused: true})` may lease a worker the
+ pause-all ALONE switched off: the pool is paused, the worker is `disabled`, and its `pausedSnapshot` entry is
+ `enabled` (`pauseHeld`). Never one drained, degraded or disabled by hand (a hand control during a pause writes
+ `disabled` into the snapshot; a degrade mark fails eligibility on its own). The snapshot is only read: the lease
+ leaves the worker `disabled`, so when it releases the worker is still paused and `resumeAll` restores it exactly as
+ before. `pauseHeldIds()` lists them. The flag rides `transcribeWithWorker({whilePaused})`, the `transcribe-file`
+ body (`pnpm ops transcribe`; a NAMED worker the pause holds is not refused when the request is whilePaused) and the
+ `transcribe-one` body (both of its forms). Lane and batch acquires never pass it. The video page's Transcribe row
+ shows **Transcribe now (workers paused)** while the pool is paused.
+2. **Chat replay for one video** — `common/controller/fetchLiveChat.ts`, `pnpm ops fetch-chat {slug, id}`, Media
+ tools → **Fetch live chat**. `liveChatPlan` decides from the disk and the metadata: fresh cues → skip; the raw
+ replay here with stale cues → normalize only (no network); a platform other than YouTube → "no chat fetcher for
+ <platform>: only YouTube's chat replay is fetched"; `live_status: "not_live"` → never live. A fetch runs the
+ managed download's chat-only argv (`liveChatOnlyArgs`, now exported from `ytdlp/downloadOneManaged.ts`: the
+ channel's cookies and the platform's live pace) on the platform's DOWNLOAD queue, with the held-platform and
+ cooldown refusals, the cookie retry, the backoff record and the clean-pass settle the metadata refresh uses, then
+ `normalizeLiveChat`. The skips are `{ok: false, info: true}` before any job; a pass that writes nothing ends `done`.
+3. **Find clips** — `common/controller/findClips.ts`, job kind `find-clips` on its own `find-clips` queue. In order,
+ each step skipped when its output exists and named in the log (`skipped: <step> — why` / `running: <step> — why`):
+ persist the source (`persist-videos`), the corpus transcript (`transcribe-one`, whilePaused passed), word timings
+ (the file transcription with words IN the job, into `data/<id>/words.json`), the chat replay (`fetch-chat`; a
+ refusal or failure is logged and the chain goes on), diarization (the backfill lane's one-video run; past a held
+ lane only with whilePaused, in the job), then umtool: `POST ${UMTOOL_URL}/api/report/clips` with the worker token,
+ `{mode: "new", slug: <project>, from: "<slug>/<id>", target?, scope: "auto" | segment, wordsPath}`, and `GET
+ ?job=<id>` followed to the end with its log relayed. The editor steps go through the editor's own ops actions in
+ process (`findClipsEditor`, the research run's door) and are waited on; the job never sits on a queue a step needs.
+ What would park a step forever fails it at once with where to fix it: a paused pool without whilePaused (or with
+ no worker the pause alone holds), diarization switched off or unconfigured, a held backfill lane without
+ whilePaused. umtool down, refusing or failing fails the umtool step naming the URL or umtool's error. The log ends
+ `@@find-clips {json}`; `data/<id>/find-clips.json` keeps the project, its clip editor URL (umtool's `href`), the
+ segment (the one asked, else auto-scope's), the segments and the steps for the page. A `dryRun` answers each
+ step's plan. Lane B's final route: a 409 naming umtool's running job is asked again every 30 s (up to an hour);
+ any other 409 (the slug exists) refuses; its `notes` are logged. `pnpm ops get workers` marks the workers a
+ whilePaused job may take (`pauseHeld: true`).
+4. **The video page** — `FindClipsPanel`: a target length (minutes), **Run while paused (this video only)** when
+ something holds a step (the pool paused, the backfill lane held — named in a status line), **Find clips**
+ (disabled with "UMTOOL_URL is not set on the editor…" without one), and after a run the project linked and the
+ segments found, each with **Find clips in this part** (posts again with `segment`).
+
+## Interfaces
+
+- `WorkerPool.acquire(…, {whilePaused?})`, `WorkerPool.pauseHeldIds()`; `TranscribeWithWorkerOptions.whilePaused`;
+ `TranscribeFileRequest.whilePaused`, `TRANSCRIBE_FILE_BODY_KEYS` + `"whilePaused"`; `transcribeOneAction(…,
+ salvage, whilePaused)`, `whisperVideoAction(…, storedUrl, whilePaused)`.
+- `liveChatOnlyArgs(config, cookies, url, pace?)`; `liveChatPlan`, `fetchLiveChat`, `runFetchChatJob`,
+ `FETCH_CHAT_JOB_KIND`, `CHAT_PLATFORMS`, `noChatFetcherSentence`.
+- `parseFindClipsBody`, `inspectFindClips`, `planFindClipsSteps`, `runFindClips`, `enqueueFindClips`,
+ `projectSlugFor`, `umtoolProjectUrl`, `FIND_CLIPS_JOB_KIND`, `FIND_CLIPS_QUEUE`, `FIND_CLIPS_RESULT_MARKER`,
+ `FIND_CLIPS_BODY_KEYS`; `umtoolUrl()` (`common/lib/umtoolUrl.ts`); sidecars `words.json`
+ (`lib/wordTimings-server.ts`) and `find-clips.json` (`lib/findClipsRecord-server.ts`).
+- Routes: `POST /api/ops/fetch-chat`, `POST /api/ops/find-clips`; `transcribe` / `transcribe-one` take
+ `whilePaused`. umtool's clips route is lane B's; this lane calls it exactly as the plan's contract says.
+
+## Files
+
+common: `jobs/workerPool.ts`, `jobs/workerPool.whilePaused.test.ts`, `jobs/jobKinds.ts` (fetch-chat, find-clips),
+`controller/transcribeOne.ts`, `controller/transcribeFile.ts` (+ test), `controller/fetchLiveChat.ts` (+ test),
+`controller/findClips.ts` (+ test), `ytdlp/downloadOneManaged.ts` (the argv builder exported), `lib/umtoolUrl.ts`,
+`lib/wordTimings-server.ts`, `lib/findClipsRecord-server.ts`, `lib/sidecar-server.test.ts`, `lib/envVars.ts`.
+editor: `app/api/ops/{fetch-chat,find-clips}/route.ts`, `app/api/ops/_findClips.ts`, `app/api/ops/_researchEditor.ts`
+(findClipsEditor), `app/api/ops/{transcribe,transcribe-one}/route.ts`, `app/api/ops/_door.test.ts`, the video page
+(`page.tsx`, `videoActions.ts`, `mediaToolsActions.ts`, `findClipsActions.ts`, `components/FindClipsPanel.tsx`,
+`components/VideoMediaTools.tsx`, `components/VideoPanel.tsx`, `components/cards/PerFileTranscribeRow.tsx`),
+`e2e/find-clips.spec.ts`, `e2e/servers.ts` (E2E_UMTOOL_ORIGIN_FILE), `playwright.config.ts`.
+scripts: `archilyzer-ops.mjs` (+ test). Docs: COMMANDS.md, ENVIRONMENT.md (regenerated), OPERATING.md ("Find clips in
+a recording"), editor/CHANGELOG.md, plans/FACTS.md.
+
+## Gates
+
+All from the worktree root, through the session lock. Counts at the branch's start (main `0d471989`) → before the
+merge of main (lane B, `8938a5dd`) → after it:
+
+| Gate | Start | Before merge | After merge |
+|---|---|---|---|
+| tsc (`pnpm -r … exec tsc --noEmit`) | — | clean | clean |
+| common (`pnpm --filter yt-dlp-transcript-common test`) | 4657 (4655 pass, 2 skipped) | 4674 (4672 pass, 2 skipped) | 4688 (4686 pass, 2 skipped) |
+| editor unit (`pnpm --filter editor test`) | 346 | 346 | 346 |
+| test:scripts | 1255 (1251 pass, 4 skipped) | 1256 (1252 pass, 4 skipped) | 1264 (1260 pass, 4 skipped) |
+| docs cli / env / files, settings example `--check` | — | clean (COMMANDS.md, ENVIRONMENT.md regenerated) | clean |
+
+New unit tests: `jobs/workerPool.whilePaused.test.ts` (6), `controller/fetchLiveChat.test.ts` (6),
+`controller/findClips.test.ts` (9: every step run, every step skipped, umtool down / refusing / failing / slug taken,
+umtool busy then free, twitch chat skip + refused chat fetch, paused pool, diarization off / lane held / whilePaused
+inline / inline failure, dry run + refusals + the job's record and marker), `lib/umtoolUrl.test.ts` (1), three in
+`transcribeFile.test.ts` (whilePaused parse, the named pause-held worker, a paused pool running a whilePaused job),
+the sidecar enumeration (17), the door's traversing slug for fetch-chat and find-clips, the ops client's usage and
+marker.
+
+Editor e2e (start mode; the e2e build 894 s including the wait for the machine's heavy slot):
+`find-clips.spec.ts` 1 passed (17.5 s); `video-page.spec.ts` + `workers.spec.ts` 30 passed (57.6 s);
+after the merge of main (lane B) and the contract alignment, `find-clips.spec.ts` again: 1 passed (11.4 s; the
+rebuild took 2210 s, nearly all of it waiting for the machine's heavy slot).
+
+A common-suite run once hung over 11 minutes in `controller/seeder.test.ts` (webtorrent); it was stopped and the
+next run was clean. Not this lane's file.
+
+## Found and left
+
+- The word-timings transcription cuts its 16 kHz WAV under the OS temp dir (`runTranscribeFile`, as `pnpm ops
+ transcribe` always has): about 300 MB for a 2.5-hour recording, in RAM where `/tmp` is a tmpfs, for the length of the
+ transcription. Not changed here; the live editor's `TMPDIR` decides.
+- The backfill lane's one-video run (the diarization panel's Run) is held by the lane's gate like the sweep is; Find
+ clips says so and offers whilePaused rather than waiting. The panel's own Run is unchanged.