Skip to content

Drive Google Flow from Claude, Codex or a local control panel, on Mac or Windows — using your Google AI subscription credits instead of the pay-per-use video API. No browser extension.

Videos: wait until Flow has really finished a clip before taking it

GTAI-1660d655738b5
diff --git a/CLAUDE.md b/CLAUDE.md
index 71df09a..7bc06ce 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -404,3 +404,11 @@ The preview tool could not read the project while it lived in ~/Desktop; check t
for the OLD title, which no longer existed. The clip was finished and renamed in Flow (credits spent, file not
downloaded). Now the handle follows the rename, and a tile that cannot be found again says so in words and points at
flow_download. Not re-run on a paid clip yet; images are unaffected (they carry data-media-id).
+ SAME USER, AFTER UPDATING (2026-10-16): "could not be found again in the grid (looked for "<the prompt>")". The
+ real cause: right after "NN%" disappears Flow is still finishing the video - the tile is titled with the PROMPT and
+ has no thumbnail; finished, it gets a short title of Flow's own (live grid: "3D motion graphics animation guide",
+ aria-label cut with "…") plus img[alt="Generated video thumbnail"]. The tool took the tile at the provisional
+ stage, the rename failed on the unfinished tile, and the provisional title then vanished. freshMedia now counts a
+ video tile without its thumbnail (or a <video>) as busy, and waitForNewMedia takes title-tracked tiles only once
+ the same titles show on two polls running. Finished tiles still pass (6/6 in the live grid). The provisional state
+ itself has not been watched live (needs a paid clip).
diff --git a/src/flow.ts b/src/flow.ts
index 3413fd8..33598ce 100644
--- a/src/flow.ts
+++ b/src/flow.ts
@@ -243,7 +243,12 @@ export async function freshMedia(page: Page, before: string[], kind?: MediaKind)
id: idOf(t),
kind: t.querySelector("flow-video-tile") ? "video" : t.querySelector("flow-image-tile") ? "image" : "other",
label: t.getAttribute("aria-label") ?? "",
- busy: /\d+%/.test((t as HTMLElement).innerText),
+ // After 100% Flow is still finishing a video for a moment: the tile is titled with the prompt itself and has
+ // no thumbnail yet; finished, it gets a short title of Flow's own ("3D motion graphics animation guide") and
+ // its thumbnail. Until then it counts as busy (2026-10-16, a user's clip was lost to this).
+ busy:
+ /\d+%/.test((t as HTMLElement).innerText) ||
+ (!!t.querySelector("flow-video-tile") && !t.querySelector('img[alt="Generated video thumbnail"], video')),
}));
},
TILE_ID_JS,
@@ -256,11 +261,21 @@ async function waitForNewMedia(page: Page, before: string[], count: number, time
const deadline = Date.now() + timeoutMs;
let retriesLeft = job?.params.retries ?? 1;
let failures = 0;
+ let seen = "";
while (Date.now() < deadline) {
await pause(page, 2000);
const fresh = await freshMedia(page, before, kind);
// New tiles are listed first, so anything beyond the requested count is not ours.
- if (fresh.length >= count) return fresh.slice(0, count);
+ if (fresh.length >= count) {
+ const picked = fresh.slice(0, count);
+ // A video has no media id and is tracked by its title, which Flow may still change right after finishing: take
+ // it only once the same titles show twice running, or the download looks for a name that no longer exists.
+ const settled = !picked.some((id) => id.startsWith("title:")) || picked.join("|") === seen;
+ if (settled) return picked;
+ seen = picked.join("|");
+ if (job) job.progress = "Flow is finishing the video";
+ continue;
+ }
const progress = await page.evaluate(() =>
[...document.querySelectorAll("flow-grid-tile-container")].slice(0, 8).map((t) => (t as HTMLElement).innerText.match(/\d+%/)?.[0]).filter(Boolean),
);