commit 1dde98ef268fa7aafa7a8f4c5f249c8f724524f0
parent 9b3d0cc52586add89dbf9c7d9ab024e7f0d304f5
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sat, 21 Nov 2026 14:39:18 -0500
clean audio: each retry says what it started with and added; docs
- cleanAudioFromTranscribed logs, and returns, the verdicts a run started
with (cached gone verdicts and stored evidence) and those it added by
asking the source; a rate-limit retry's job log says "Retry N of 2:
started with S verdict(s) ..., added A; U unverified remain".
- verifyBeforeClean logs the platform's current request pace before it
asks anything: the adaptive --sleep-requests a recorded rate limit
widens (kept as it is; documented).
- OPERATING.md: what a checked clean accepts as still there, the resume
per platform, the few-candidates rule, the pace. editor CHANGELOG.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
6 files changed, 108 insertions(+), 1 deletion(-)
diff --git a/OPERATING.md b/OPERATING.md
@@ -1153,6 +1153,33 @@ pnpm ops channel-config --json '{"slug":"example","cleanAudioWithoutChecking":tr
retries the next rate limit ends the job **failed**: "Gave up: rate-limited … It needs a person". A failure that is
not a rate limit (a network error, an extractor break) ends failed, "Could not verify availability …", and retries
nothing.
+- **What a checked clean accepts as "still there"**, cheapest first. A video is cleaned only when one of these vouches
+ for it; anything else keeps its audio and is "unverified":
+ - **Stored evidence, nothing asked**: a listing that returned the video within `verifyBeforeCleanMaxAgeHours` (24
+ by default; 0 = always ask). That is Sync's full sweep or paged walk, Store playlist, the Quick check, or an earlier
+ clean's listing, including the entries a rate-limited listing returned before it stopped. A per-video probe that
+ found the video public or unlisted in that window counts too (`availability.json`, `checkedBy: "check"`). The
+ listings are kept in `channels/<slug>/listing-evidence.json`: each id with the time of the newest listing that
+ returned it, and the shape of the last 20 listings. `roster.json`'s `lastListedAt` is not used, because its seed
+ stamps the stored `playlist` as listed. If a complete listing in the window does not name a video, the video is
+ asked about by itself, with no second listing.
+ - **A listing**: the videos it returns are verified. If the source rate-limits it part-way, the videos among the
+ entries it did return are still cleaned, and the job says "verified N from a partial listing of M entries; K
+ unverified remain". A video the partial listing did not reach is not judged and keeps its audio.
+ - **Where the next listing starts**: on Odysee and BitChute, the next attempt continues two pages before where the
+ last one stopped (`-I <start>:`). yt-dlp's extractor there pages by offset, so the pages before are not fetched
+ again. Rumble, YouTube, Twitch and Kick list page after page from the top, so `-I` cannot skip anything; there a
+ retry starts at entry 1 again and keeps what the earlier attempts verified. A listing that moved by more than the
+ overlap between attempts is noted in the log. A video neither attempt returned is never cleaned on the listing.
+ - **Few candidates**: when asking each remaining video costs fewer requests than listing the channel would (the
+ channel's size divided by its page size, e.g. ~320 pages for 8,000 Rumble videos), each video is asked by
+ itself, paced, and no listing is made. Every answer is kept, so a rate limit part-way loses nothing and the next
+ attempt asks only the rest. This needs every candidate to have a `webpage_url`; otherwise the listing is used.
+ - **The pace**: every request runs at the platform's adaptive pace (yt-dlp `--sleep-requests`), which a recorded
+ rate limit widens (a Rumble 429 took it from 1.05 s to 4.59 s). The job log states the pace in use. Probes also
+ wait `AVAILABILITY_PROBE_GAP_MS` (3 s, plus jitter) between them.
+ - **Each retry makes progress**: its log says "Retry N of 2: started with S verdict(s) earlier attempts and stored
+ listings had earned, added A; U unverified remain".
## Record a live stream; import a file
diff --git a/common/controller/cleanAudioFromTranscribed.ts b/common/controller/cleanAudioFromTranscribed.ts
@@ -113,6 +113,11 @@ export type CleanAudioResult = {
// The gate was rate-limited part-way through the listing and cleaned the
// candidates the partial listing named (CleanVerdicts.partial).
partial?: { verified: number; entries: number; unverified: number };
+ // THE CHAIN'S PROGRESS (lane verify-resume): verdicts this run started with
+ // (cached gone verdicts and stored evidence — earlier attempts' work) and
+ // verdicts it added by asking the source. Absent when nothing was asked.
+ verdictsAtStart?: number;
+ verdictsAdded?: number;
};
type CleanCandidate = {
@@ -281,6 +286,7 @@ export async function cleanAudioFromTranscribed({
let unverified = 0;
let stopped: CleanVerifyStop | undefined;
let partial: CleanAudioResult["partial"];
+ let chain: { verdictsAtStart: number; verdictsAdded: number } | undefined;
if (verify && candidates.length > 0 && !signal?.aborted) {
const verdicts = await verifyBeforeClean({
channelSlug,
@@ -295,6 +301,15 @@ export async function cleanAudioFromTranscribed({
unverified = verdicts.unverified.size;
stopped = verdicts.stopped;
partial = verdicts.partial;
+ if (verdicts.fromEvidence !== undefined) {
+ const atStart = (verdicts.fromCache ?? 0) + verdicts.fromEvidence;
+ const resolved = candidates.length - verdicts.unverified.size;
+ chain = { verdictsAtStart: atStart, verdictsAdded: Math.max(0, resolved - atStart) };
+ log(
+ `Verify before clean: of ${candidates.length} candidate(s), started with ${atStart} verdict(s) (cached or stored evidence), ` +
+ `added ${chain.verdictsAdded} by asking the source; ${verdicts.unverified.size} unverified remain.`,
+ );
+ }
// A video already pinned by someone else is protected, not newly pinned.
protectedCount += verdicts.alreadyGone.size;
}
@@ -374,6 +389,7 @@ export async function cleanAudioFromTranscribed({
...(notInPlan !== undefined ? { notInPlan, planNoLongerEligible } : {}),
...(stopped ? { stopped } : {}),
...(partial ? { partial } : {}),
+ ...(chain ?? {}),
};
}
diff --git a/common/controller/cleanAudioJob.ts b/common/controller/cleanAudioJob.ts
@@ -269,6 +269,13 @@ export async function runCleanAudioJob({
...(deps.assertReachable ? { assertReachable: deps.assertReachable } : {}),
});
if (signal?.aborted) return { end: "cancelled" };
+ // The chain makes progress each attempt, and says how much.
+ if (retry && result.verdictsAtStart !== undefined) {
+ onLog(
+ `Retry ${retry.attempt} of ${CLEAN_RATE_LIMIT_MAX_RETRIES}: started with ${result.verdictsAtStart} verdict(s) earlier attempts and stored listings had earned, ` +
+ `added ${result.verdictsAdded ?? 0}; ${result.unverified} unverified remain.`,
+ );
+ }
const stop = result.stopped;
if (!stop) return { end: "done", result };
diff --git a/common/controller/verifyBeforeClean.ts b/common/controller/verifyBeforeClean.ts
@@ -26,6 +26,7 @@ import {
import { readAvailabilityVerdict } from "./availabilityVerdict";
import { loadAvailability, resolveEffectiveAvailability } from "../lib/availability-server";
import { getSettings } from "../lib/settings";
+import { channelPaceSeconds } from "../ytdlp/channelArgs";
// Availability gate for the transcribed-audio cleanup sweep.
//
@@ -80,8 +81,10 @@ export type CleanVerdicts = {
// 429 and are cleanable; `unverified` remain (also in `unverified` above).
partial?: { verified: number; entries: number; unverified: number };
// How many candidates stored evidence verified before anything was asked
- // (tier E): a retry's starting point.
+ // (tier E): with `fromCache` (tier A's cached gone verdicts), a retry's
+ // starting point. Absent when no source could be asked (a URL-less channel).
fromEvidence?: number;
+ fromCache?: number;
};
export type CleanVerifyStop = {
@@ -251,6 +254,7 @@ export async function verifyBeforeClean({
}
remaining.push(id);
}
+ verdicts.fromCache = verdicts.pinned.size + verdicts.alreadyGone.size;
if (remaining.length === 0 || signal?.aborted) return verdicts;
// A channel with no URL is structurally unverifiable — there is no source to
@@ -298,6 +302,12 @@ export async function verifyBeforeClean({
);
}
if (needed.length === 0 || signal?.aborted) return verdicts;
+ // THE PACE (kept, not changed here): every request below — the listing's
+ // pages and each probe — runs at the platform's ADAPTIVE pace, yt-dlp's
+ // --sleep-requests, which a recorded rate limit widens (lib/pacing,
+ // channelArgs.channelPaceSeconds: a Rumble 429 took it from 1.05 s to
+ // 4.59 s), plus the probe gap between probes (AVAILABILITY_PROBE_GAP_MS).
+ log(`Verify before clean: asking at ${channelPaceSeconds(config).toFixed(2)} s between requests (${platform}'s current pace).`);
// A COMPLETE listing inside the window already says which candidates it does
// not name: those are suspects to confirm one by one, with no new listing.
diff --git a/common/controller/verifyPartialListing.test.ts b/common/controller/verifyPartialListing.test.ts
@@ -172,3 +172,36 @@ test("the job: a partial listing ends deferred and says what it verified, cleane
assert.equal(await hasAudio(paths, "v1bbbb"), true);
assert.equal(scheduled.length, 1, "the unverified remainder is retried");
});
+
+test("a retry says how many verdicts it started with and how many it added", async () => {
+ const { recordListing } = await import("./listingEvidence");
+ const paths = await corpus(["v1aaaa", "v1bbbb", "v1cccc"]);
+ // The attempt before this one listed v1aaaa before the source stopped it.
+ await recordListing(paths, "ch", { at: new Date(Date.now() - 3_600_000).toISOString(), source: "quick-check", urls: [watch("v1aaaa")], complete: false, platform: "rumble" });
+ const { calls, probes } = rateLimitedAfter([watch("v1bbbb")]);
+ const lines: string[] = [];
+ const out = await runCleanAudioJob({
+ channelSlug: "ch",
+ paths,
+ jobId: "job-2",
+ retry: { attempt: 1, of: "job-1", notBefore: T0 - 1, platform: "rumble", id: "job-1.retry1" },
+ onLog: (m) => lines.push(m),
+ deps: {
+ probes,
+ assertReachable: async () => {},
+ now: () => T0,
+ cooldownRemainingMs: async () => 0,
+ scheduleRetry: async () => ({ ok: true as const, id: "job-1.retry2" }),
+ },
+ });
+ assert.equal(calls.quick, 1);
+ assert.equal(out.end, "deferred");
+ assert.equal(await hasAudio(paths, "v1aaaa"), false, "verified by the earlier attempt's entries");
+ assert.equal(await hasAudio(paths, "v1bbbb"), false, "verified by this attempt's");
+ assert.equal(await hasAudio(paths, "v1cccc"), true);
+ assert.ok(
+ lines.includes("Retry 1 of 2: started with 1 verdict(s) earlier attempts and stored listings had earned, added 1; 1 unverified remain."),
+ lines.join("\n"),
+ );
+ assert.ok(lines.some((l) => /asking at \d+\.\d\d s between requests \(rumble's current pace\)/.test(l)), lines.join("\n"));
+});
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -9,6 +9,20 @@
- Matching is by id, the same way the full check matches, never by part of a name. On Rumble a video's embed id
counts too, and only against embed entries.
- The job says "verified N from a partial listing of M entries; K unverified remain".
+- **A rate-limited Clean audio keeps what it learned, and its retry continues instead of starting over.**
+ - Before, every retry listed the whole channel again from entry 1 and threw away what the earlier attempt had read.
+ After 3 attempts the chain gave up with 350 audio files unverified.
+ - What each listing returned is now kept in `channels/<slug>/listing-evidence.json`. That covers Sync's full sweep
+ and paged walk, Store playlist, the Quick check, the clean's own listing, and the entries a rate-limited listing
+ returned before it stopped.
+ - A candidate listed within `verifyBeforeCleanMaxAgeHours` is cleaned without asking the source. So is one a
+ per-video probe found in that window. The setting is new: 24 h by default, 0 = always ask (SETTINGS.md).
+ - On Odysee and BitChute the next listing continues two pages before where the last one stopped. Elsewhere yt-dlp
+ cannot skip pages, so a retry keeps the earlier verdicts and asks only for the rest.
+ - When few candidates remain against a large channel, each one is asked about by itself (paced, every answer kept)
+ instead of listing the channel.
+ - Each retry's log says how many verdicts it started with and how many it added. The log also states the
+ request pace in use.
- **A clip window past the end of a saved recording is cut from the saved video, clamped at the end.**
- Before, the last clip of a recording asked for a window that ended past the saved container (its cut plus a
3 s pad). The window was "not-covering" and went to the platform's download queue: a network fetch for footage