From 3d033c666dfdb5778c0c93b0e7668b31d34f8747 Mon Sep 17 00:00:00 2001 From: pallaoro Date: Mon, 12 Oct 2026 04:34:00 -0700 Subject: [PATCH] Highlights: the best are listed best scored first The model chooses which picks make the set, but lists the set as it read it, clip by clip, not by strength: on a real day the chosen 25 came back in the order of the prompt. The best now sort by score like the rest, with the model's order breaking ties (or by clip with sort=clip). Which picks are in, and which stand-in comes next after a drop, are unchanged. --- agent.md | 8 ++++---- src/server/index.ts | 6 ++++-- test/e2e/run.mjs | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/agent.md b/agent.md index 74f21b8..988eb2d 100644 --- a/agent.md +++ b/agent.md @@ -131,10 +131,10 @@ reading sees a dozen clips, so a count in the brief only holds for each dozen. With a number, every clip is still read, then one more model call goes over all the picks and puts them in order for the brief: the best set of that many first (the mix the brief asks for, one clip may give most of it, never the -same moment twice), then stand-ins. `pick=best` lists that set: kept picks -first (they count toward the number; when more are kept than wanted, the best -of them), then the model's order. Dropping one brings in the next with no new -call. A new number orders them again; picks from clips read later do too, at +same moment twice), then stand-ins. `pick=best` lists that set, best scored +first (or by clip with `sort=clip`): kept picks count first toward the number +(when more are kept than wanted, the best of them), then the model's choice. +Dropping one brings in its next stand-in with no new call. A new number orders them again; picks from clips read later do too, at most every 15 minutes while footage is still coming in. The list says where it stands: `wanted`, `counts.best`, and `ranking: { status: waiting | running | done | failed, error, due }`. diff --git a/src/server/index.ts b/src/server/index.ts index 3f1dd42..377b775 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -1404,7 +1404,9 @@ app.post("/api/projects/:id/highlights/stop", async (c) => { // min_score=2..5, pick=best|open|keep|drop|not_dropped|all (default all), // folder= (a folder and everything inside it), sort=score|clip. Pages of 100, // at most 1000. skipped=1 adds the clips judged not worth using, and why. -// pick=best is the project's best `wanted`, in the order the model put them. +// pick=best is the project's best `wanted`: which they are is the model's +// call; they are listed best scored first like the rest (the model's order +// breaks ties; it lists a set as it read it, not by strength). app.get("/api/projects/:id/highlights", async (c) => { const id = c.req.param("id"); const project = await get<{ @@ -1427,7 +1429,7 @@ app.get("/api/projects/:id/highlights", async (c) => { q("sort") === "clip" ? "f.folder, f.name, h.src_in" : pick === "best" - ? "COALESCE(h.rank, 1000000000), h.score DESC, f.folder, f.name, h.src_in" + ? "h.score DESC, COALESCE(h.rank, 1000000000), f.folder, f.name, h.src_in" : "h.score DESC, f.folder, f.name, h.src_in"; const rows = await query( `SELECT ${HIGHLIGHT_COLUMNS} diff --git a/test/e2e/run.mjs b/test/e2e/run.mjs index 024961a..1a0abc4 100644 --- a/test/e2e/run.mjs +++ b/test/e2e/run.mjs @@ -895,6 +895,7 @@ console.log("11g ok: a clip under a second is logged as too short, without an an assert.ok(kept.every((k) => best.some((h) => h.id === k)), "every kept pick is in"); const chosen = best.filter((h) => h.pick !== "keep"); assert.ok(chosen.every((h) => h.kind === "broll"), "the model's choice, not the score's"); + assert.ok(best.every((h, i) => i === 0 || best[i - 1].score >= h.score), "listed best scored first"); const ranks = db.prepare("SELECT rank FROM footage_highlights WHERE project_id = ? AND pick IS NOT 'drop' ORDER BY rank").all(pid).map((x) => x.rank); assert.ok(ranks.every((x, i) => x === i + 1), `every pick not dropped has a place: ${ranks}`); console.log(`11h ok: best ${wanted} chosen in one call, kept picks in, the model's order over the score`);