Skip to content

Burn the current title in as the hook on re-render - #183

Merged
A21-devs merged 2 commits into
mainfrom
fix/rewritten-title-hook
Dec 5, 2026
Merged

A21-devs merged 2 commits into
mainfrom
fix/rewritten-title-hook

Conversation

@A21-devs

@A21-devs A21-devs commented Dec 5, 2026

Copy link
Copy Markdown
Owner

Closes #114.

What

With --hook and --copy, the AI title is also the hook text burned into the first 3 seconds of the clip (and drawn on the cover since #173). Rewrite title only updated the manifest and the .txt, and rerender_clip reused entry["hook"], so the video kept showing the old title even after a re-render.

  • pipeline.clip_hook(entry): the clip's copy.title when it has one, otherwise the hook it was rendered with. That's the same rule run() uses (title if there is one, else hook_text from the transcript). It's used for the .ass and the cover when the run has render.hook on, and saved back as the clip's hook. Clips without a title keep their transcript hook. A run without --hook still has no hook.
  • Review page: when the run has render.hook and a clip's hook differs from its title, the card shows "the hook in the video is out of date" with a Re-render button that renders the clip's current range (layout and trim unchanged). It's checked when the card is built and again after Write title, so a rewrite shows it right away. The Re-render code is shared with the existing Re-render button (renderWith), so busy state, releasing the video and errors work the same.
  • The MCP server's re-render goes through rerender_clip too, so it picks up the current title the same way.

Testing

  • uv run ruff check src tests, uv run mypy, uv run pytest -q tests/test_rerender.py tests/test_write_title.py: 52 passed.
  • New tests: a re-render of a clip with a rewritten title passes the new title to build_ass and to the cover and saves it as hook. A clip without a title keeps its transcript hook. A run without --hook gets no hook even with a title. clip_hook covers a title, no copy and copy: null. A check on index.html that the note is only for render.hook runs when clip.hook !== clip.copy.title, re-renders {start, end} of the clip as it is, and is refreshed after Write title.
  • Real run: clipwright serve with a local stub backend that answers "Title number N" with a counter, job on a 240 s synthetic video (TTS speech over Roblox gameplay) with hook: true, copy: "openai", 2 clips. Driven in headless Edge over the DevTools protocol:
    • on load: titles 1 and 2, no note on either card
    • Rewrite title on clip 1: it now says "Title number 3" and shows "the hook in the video is out of date" + Re-render; clip 2 has no note
    • clicking that Re-render: the button says "Rendering...", then the cards are rebuilt and the note is gone
    • manifest: clip 1 hook = copy.title = "Title number 3", clip 2 unchanged
    • frame at 1 s of talk_clip01.mp4: "Title number 1" before, "Title number 3" after

@A21-devs A21-devs added bug Something isn't working ui labels Dec 5, 2026
With --hook and --copy the AI title is the hook in the first seconds of
the clip, but a re-render reused the hook it was first rendered with,
so a rewritten title never reached the video. rerender_clip now uses
the clip's title when it has one (clip_hook) and saves it as the hook.
The review page says when a clip's hook is out of date and offers a
re-render over its current range.

@A21-devs A21-devs left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked:

  • clip_hook follows the same rule as run(): the title when there is one, else the stored hook. A run without --hook passes None regardless of the title (the test covers it). The cover gets the same hook, so #173's cover title updates too.
  • A same-range re-render keeps edited as it was (moved is false), so the score note doesn't flip just because the hook was refreshed.
  • Moving the old Re-render body into renderWith changed nothing for the main button: it still validates the length and builds the body with editBody first, and the error path restores the label of whichever button was pressed.

One real problem with the new button, inline.

@@ -418,6 +425,16 @@ <h1>clipwright</h1>
}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This always sends the saved range, {start: clip.start, end: clip.end}, but the card can have unsaved nudges or a layout change waiting in pending (the times line says "edited"). Press -1s on start, then this Re-render: the clip is rendered over the old range, renderWith does pending.delete(key), the cards are rebuilt, and the trim is gone without a word. Both buttons say "Re-render", so a user would expect this one to render what the card shows. It should send editBody(clip, start, end, layout, saved) ?? { start: clip.start, end: clip.end } (with the same 1 s length check), so pending edits go along and an untouched card still re-renders as it is.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction: this comment landed on the wrong line. It is about line 434, const again = button("Re-render", () => renderWith({ start: clip.start, end: clip.end }, again));, in showHookNote.

@A21-devs

A21-devs commented Dec 5, 2026

Copy link
Copy Markdown
Owner Author

Fixed in 35cf6a2. The note's Re-render now sends editBody(clip, start, end, layout, saved) when the card has pending edits and falls back to the clip's current range when it doesn't. It does the same 1 s length check as the main button.

Verified with the same headless Edge run as in the description (stub backend that counts titles, hook: true, copy: "openai"):

  • clip 1 was 107-127 with hook "Title number 1"
  • Rewrite title gave "Title number 3", and the note appeared
  • pressed -1s on start: the card shows 1:46.0 - 2:07.0 (21.0s) edited
  • the note's Re-render: after the rebuild the card shows 1:46.0 - 2:07.0 (21.0s) with no note
  • manifest: clip 1 is 106-127, hook "Title number 3", edited: true. The mp4 is 21.000 s (ffprobe). Clip 2 is untouched.

On the previous commit the same steps would have rendered 107-127 and dropped the trim. The page check in tests/test_write_title.py now pins the editBody(...) ?? {...} body. ruff clean, 21 passed in that file.

@A21-devs A21-devs left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second pass over 35cf6a2. Fixed: the note's button builds its body from the card's start/end/layout like the main Re-render, and falls back to the saved range only when nothing is pending. start, end and layout are the same let variables the nudge buttons change, so it reads them at click time, not when the note was drawn. A layout-only change goes as {layout}, which the server's relayout path renders over the clip's range with clip_hook too. The real run in the reply shows the trim kept (106-127, 21.0 s) and the new title burned in. Clean.

The note's Re-render always sent the saved range, so a trim or layout
change waiting on the card was rendered over and then dropped.
@A21-devs
A21-devs merged commit 35a6081 into main Dec 5, 2026
4 checks passed
@A21-devs
A21-devs deleted the fix/rewritten-title-hook branch December 5, 2026 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rewriting a title leaves the old hook burned into the clip

1 participant