The scene classifier sends every face-less shot to GENERAL, and GENERAL scales
the content to 42% of the frame height. That ratio buys presence on a LANDSCAPE
source by overflowing the sides; on a 1080x1920 upload the same number is a
shrink, leaving a 453px sliver floating over a blurred copy of itself. A user's
already-vertical video came back with its screen-recording scenes rendered that
way while its talking-head scenes (TRACK, whose crop is the whole frame) looked
right, so a single clip alternated between correct and ruined.
source_already_fits() gates the whole thing: a source at or past the target
aspect has no width to buy back, so the classifier, the SPLIT detection and the
screencast/inset upgrades are all skipped and every scene renders TRACK. The
layout picker is skipped too, saving a Gemini call per upload that the render
would have ignored anyway.
general_filtergraph() additionally floors the foreground at the height where the
source fills the output width, so the editor's explicit GENERAL override on a
portrait clip cannot reproduce the shrink. A 16:9 source keeps the 0.42 ratio
untouched.
Two siblings of the same bug, both only reachable on a source TALLER than the
target: the TRACK crop pinned y=0 and threw away the bottom of the frame instead
of trimming both ends, and v1's create_general_frame indexed the output with a
negative offset, which raises rather than renders.
Claude-Session: https://claude.ai/code/session_01KeQYCfUX2E9Q2fDgZMKEaJ
'paid proxy DOWN: YouTube-URL jobs will keep failing' fired on a single
ReadTimeout while the three static proxies were fine, and read as an
outage. Severity now follows the actual impact: fallback down with the
statics up is informational (no impact), statics down is a cost warning
(jobs run on the per-GB proxy), both down is the red one. A route has to
miss two probes 30 min apart before anyone is paged.
The dashboard burns the AI hook line by default; API/MCP callers never
could because the field is off when absent. Exposed as an explicit opt-in
so existing integrations keep their output byte-for-byte.
PROHIBITED_CONTENT fired on the scoring batch of a plain software
walkthrough: windows 5+6 together blocked 3/3 on lite, 3.7-flash and
2.5-flash, each alone passed, and a neutral prompt over the same text
passed. The filter reacts to combinations, so it cannot be predicted or
sanitized. Both selection passes now run through _run_stage_split: on a
block the batch is halved until the combination is isolated, and only a
window that blocks on its own is dropped. The affected job now yields 2
clips instead of dying.
The ISP/paid proxies exist to dodge YouTube's ban on the server IP. A
direct mp4 (catbox, tmpfiles, a CDN, an R2 link) has nothing to dodge and
crawled at ~9 KB/s through the static proxy (6 MB in 11 min on 27-aug)
while the server's own IP pulls 17 MB/s. Non-YouTube hosts now download
direct, with one static proxy as the only fallback and never the per-GB
one.
Cloud metering probed the source with yt-dlp only; its generic extractor
never returns a duration for a plain mp4 URL, so every direct-file job
(agent uploads on tmpfiles/uguu, a CDN link) died at submit with 'Could
not determine the video duration'. On a generic hit the probe now stops
walking proxies and reads the container header over HTTP with ffprobe
(range requests, browser UA, 30 s timeout); tmpfiles links are refreshed
first. Reported by a user driving the MCP from claude.ai.
claude.ai's sandbox can upload to tmpfiles.org but their /dl/ links are
signed with a short-lived stamp and 302 to an HTML page once stale, which
yt-dlp cannot use. file_hosts.resolve() reads the page and takes the
fresh /dl/ link before download. create_upload now tells the agent to try
our upload_url first and fall back to tmpfiles.org. Unused slots expire
after 6 h (was 24) via _sweep_pending_uploads, and DELETE drops one early.
process_video now takes captions:false for sources that already carry
burned-in subtitles (maps to AUTO_CAPTIONS=0 for that job only) and
accepts upload_id as an alternative to source_url. create_upload reserves
a slot (POST /api/uploads) and returns a PUT URL the agent streams the raw
bytes to (curl -T works from any runtime); the owner recorded at reserve
time is checked at process time, files sit in UPLOAD_DIR under the usual
sweep, slots expire after 24 h. Tool count is 8 everywhere it is quoted.
Titles: transcript + 10 frames instead of uploading the whole video (an hour
was ~1M tokens), a brainstorm across fixed styles then a critic that scores,
dedupes by angle and pairs each title with a 1-4 word thumbnail hook. Mobile
rules: payoff inside 50 chars, keyword first. Text model moves to
GEMINI_MODEL_THUMBNAIL (default gemini-3.5-flash); flash-lite is the weakest
tier and this is the one creative step.
Thumbnails: a text call designs N different concepts, one image call each in
parallel. Default burns the hook text with PIL (Anton, black stroke) over
negative space the image model is told to leave, so accents are never wrong;
'AI painted' toggle keeps the old behaviour. Outputs cover-cropped to
1280x720 under YouTube's 2 MB. GET /api/thumbnail/frames/{session} picks
frames with a large, sharp face spread across the runtime and the dashboard
offers them as the person reference. Phone-size preview row in the UI.
JSON parsing now uses raw_decode: flash appended a stray ]} once.
claude.ai and ChatGPT connect to a remote MCP server by URL and expect the
server to run the login: RFC 9728/8414 discovery under /.well-known/,
dynamic client registration (public clients, PKCE S256 mandatory), an
authorization endpoint and a token endpoint. The consent screen is the
dashboard (#/oauth/authorize) because the session JWT lives in localStorage
on the frontend host; the API bounces there and mints the code on a
session-authenticated POST. Redeeming the code mints an ordinary osk_ API
key named after the client and returns it as the access token, so every
existing auth, quota and ownership rule applies unchanged and the user
disconnects an app by revoking that key. The /mcp 401 now carries
WWW-Authenticate: Bearer resource_metadata=... so clients find the flow.
Dashboard: a "Connect an agent" card (Account in cloud, Settings when
self-hosted) with copy-ready setup for claude.ai, ChatGPT, Claude Code,
Claude Desktop, Cursor, n8n and curl; the clip generator links to it. The
/mcp page, README and CLAUDE.md describe the URL-only connection.
- Advanced options gain "vertical layout": auto (server default, AI picks
per video), two speakers stacked, screen over presenter, or single crop
only. Only a deliberate choice travels as `layouts`; remembered in
localStorage like the hook settings.
- `layouts=none` switches the picker off for one job even though the
deployment runs AUTO_LAYOUT=1.
- The fast rerender (cut without reframe) wrote no layout sidecar, so a
stacked clip fell back to bottom captions after a trim. It now carries the
canonical clip's ranges through the new cut (layout_ranges.remap).
- PROXY_DRAIN_SECONDS (20): after the jobs are drained, keep the socket
open with /health/ready at 503 so Traefik pulls the instance out of
rotation while it can still answer. Coolify builds the container's
HEALTHCHECK from its own interval*retries, so closing earlier was up to
60 s of alternating 502/200 per deploy (retries lowered to 3 as well).
- HARD_EXIT_SECONDS (30): uvicorn finishing does not end the interpreter
while an executor thread hangs in a network probe (a /api/process cut
off mid-shutdown left yt-dlp running), which kept a drained container
alive for the full 900 s grace and the deploy in "Removing old
containers". Exit outright a little after handing uvicorn the signal.
On a stacked two-shot the seam between the halves is the one place the
text covers nobody (OpusClip does the same), so every word event inside a
SPLIT stretch is anchored mid-frame with an inline \an5; other layouts keep
the style's alignment, and the text moves with the cut.
The render records which stretches use which layout in a <clip>.layout.json
sidecar (layout_ranges.py). The job pipeline, rerender and manual reframe
copy it into the clip's metadata as layout_ranges, so /api/subtitle finds it
on a restyle too. auto_caption_clip reads the sidecar when not told, which
is how recut hands it over.
Only the ASS path can do this; SRT burns keep one alignment per file.
Checked on the 45-clip corpus with SPLIT on: 45/45 render, 0 caption
errors, 42 with no split at all, and the 3 that split are real two-shots.
- uvicorn --timeout-graceful-shutdown 15: after the drain, stop waiting
forever on open range downloads. The old container lived the full 900 s
stop grace with its port already closed, so Traefik alternated 502/200
for 15 minutes on 2026-08-25.
- /health/ready answers 503 once SIGTERM arrives, and a Dockerfile
HEALTHCHECK on it lets Traefik drop the instance within ~10 s while it
can still serve. Coolify's health check now waits on the same path
before stopping the old container. The marker drain does not flip it:
the new container is still booting at that point.
- ignore .worktrees
Coolify starts the new container before stopping the old one and both share
output/, so the new one used to re-enqueue at startup the very jobs the old
one was still rendering, and the old one had 30 s to live regardless.
- Each instance stamps output/.instance; an instance that sees another id
drains: finishes what it runs, starts nothing, leaves queued manifests.
- A running job heartbeats its manifest every 10 s; the resume scan (startup
and every 30 s) adopts only manifests nobody heartbeated for 60 s, so no
job runs twice and none is lost. Reservations of live-elsewhere jobs are
kept out of the orphan refund; poison jobs stay refundable.
- SIGTERM drains too (up to DRAIN_TIMEOUT_SECONDS, default 840) before the
signal reaches uvicorn, so the socket stays open and Traefik keeps getting
answers. The app's Coolify stop grace period is now 900 s.
- /api/status answers from disk for a job this instance never held, so a
poll landing on either container during the handover works.
Verified in the local stack: SIGTERM mid-job -> job finished its clips,
'Drained', exit 0; status polled 200 throughout an 8 min drain; a job
submitted during the drain was left for, and resumed by, the next instance.
The vision path only fired when the source had no audio track. A nursery
rhyme or a dashcam drive has audio, so it went through transcription, came
back as one segment, built one scoring window and Gemini returned no clips:
three failed jobs on 25-aug-2026, one user twice. Below 8 words or 5 words
per minute the transcript cannot drive selection, so route it like a silent
video (vision, no captions). Thresholds env-overridable.
A job interrupted by a container restart is re-enqueued from its resume
manifest and re-run from scratch in the same output directory. Transcription
is the slow, paid stage that had already finished, so main.py now leaves it
there as .transcript_checkpoint.json and the re-run picks it up (same shape
and validation as --transcript). Removed when the job completes so a later
run in a reused directory never inherits it.
Verified locally: run killed after transcription, re-run in the same
directory logged 'Reusing the transcript from the interrupted run' and
delivered both clips.
At every scene boundary the tracker kept the previous shot's speaker (sticky
bonus + 30-frame cooldown returning None) and the cameraman's jump damping
held the new face for JUMP_CONFIRM_FRAMES detections, so the frame started
on the old subject and slid across at pan speed. Seen on a two-camera
podcast as a headless torso for 1.5s after each cut.
Reset both at the cut, force a detection on the cut frame, and snap the
camera to the first target accepted in the new shot. SCENE_CUT_RESET=0
restores the old behaviour.
Measured on the 45-clip corpus plus the reported clip (123 TRACK scenes):
first-frame framing error 97 -> 34 px, frames to settle 18.9 -> 3.8,
in-scene reversals unchanged (0.02/s), camera travel 12 -> 7 px/s.
Eight findings from re-reading the erasure path, each one something that would
have shown up in production rather than in a test:
- The local purge missed two stores. SaaSShorts outputs (output/saas_<id>) and
generated thumbnails record ownership in their own in-memory dicts, not in
the .owner file, so neither was erased. Thumbnails are the serious half: the
hourly sweep deliberately skips their directory, so a deleted user's
generated images stayed on disk forever, publicly served at /thumbnails/.
- The purge ran on the event loop. rmtree over gigabytes of video stalled every
other request on the process; it goes through asyncio.to_thread now.
- Paths from those dicts are now resolved through _safe_under, so a session id
or output_dir containing ".." deletes nothing.
- Deleting a user made a webhook path reachable that never was: _apply_topup
takes the user id from Stripe metadata, so a top-up completing around the
deletion inserted a row pointing at a user that no longer exists. The FK
violation 500s the webhook, and since the event is only recorded after
handle_event returns, Stripe retries the same doomed insert for three days.
It confirms the row exists first.
- The "why are you leaving" box was free text stored in a record that
deliberately outlives the account, which is how personal data ends up in one
by accident. It is a closed list now, which also makes twenty deletions a
month countable instead of readable.
- Two concurrent deletes wrote two erasure records and sent two goodbye emails.
The DELETE's rowcount now decides which call is the real one; the UI holds a
ref so a double click doesn't fire a second Stripe cancel and R2 purge.
- The delete button armed itself when the confirm box was empty, if the page
ever rendered before /api/me resolved.
- The goodbye email claimed we keep "a one-way hash of your email and nothing
else", which was not true of the Stripe reference beside it. Fixed in the
email and in the privacy policy, EN and ES.
Also: skip the Upload-Post call when no managed key is configured, and say
plainly in the in-flight comment that it covers metered work only.
tests/test_account_local_purge.py covers tenant isolation across all three
stores and both traversal attempts; test_account_erasure.py gains the
confirmation gate, the API-key refusal, and the already-cancelled-at-Stripe
case that would otherwise trap a user forever.
The privacy policy already told users that "deleting your account from the
dashboard removes your content" — there was no way to do it. This adds one:
Account -> Delete account in the dashboard, DELETE /api/account on the server.
The endpoint refuses API-key auth (a leaked osk_ must not destroy the account
it was issued from) and requires the caller to retype the account email; the UI
does the same, collapsed behind a danger zone that itemises what actually goes.
Erasure is immediate and irreversible, because after it there is nothing left
to authenticate a recovery request against.
The order of the steps is the design, each one a failure mode:
- Stripe cancel first, aborting everything if it fails, so we never erase a
user we are still billing. An InvalidRequestError is treated as already
cancelled: a portal cancellation whose webhook never landed leaves our row
reading "active" forever, and the one account that could not be deleted
would be the one Stripe already stopped charging.
- R2 before the database, because those rows are the only index of which
objects belong to the user; dropping them first turns a failed purge into
permanent orphans.
- The DB delete is one transaction over an explicit table list, not the
declared ON DELETE CASCADEs: create_all never ALTERs an existing table, so a
constraint added after a table shipped lives in the models and not in
production. tests/test_account_erasure.py fails if a new table references
users.id without joining that list.
- A reserved usage_ledger row blocks the delete: erasing under a running job
would pull the output from beneath it and leave the reservation unsettled.
What survives, and why: the Stripe customer and its invoices (six years,
Spanish commercial law) and one account_deletions row holding a sha256 of the
email as proof the erasure happened, itself purged after five years by the
retention sweeper. app.py registers a callback so the working files in output/
and uploads/ go too instead of waiting for the hourly sweep.
Privacy policy sections 6 (EN + ES) now point at the button and name both
survivors; the Legal hub summary says the same in one line.
A job in flight published every clip as the clean reframe name, guessed by the
status poller. The hook and the captions live in derived files
(hooked_<ts>_<clean>, subtitled_<ts>_hooked_<ts>_<clean>), and only when the
WHOLE job finished did the result get rebuilt through _canonical_clip_file and
resolve to them. So a six-clip job showed clip 1 hook-less for the five clips
after it, which reads as the hook feature being broken.
main.py now prints CLIP_READY <index> <filename> at the end of each clip's
chain, after the caption step and carrying its result, so the name is the file
that will actually be delivered. app.py consumes the marker the way it already
consumes PROXY_BYTES: intercepted in enqueue_output, never shown as a log line.
The poller now serves only announced clips. That also closes the older hazard
in the code it replaces, whose own comment admitted it was guessing: presence
on disk was treated as done, so a clip could be served while ffmpeg was still
writing it. A clip whose marker never arrives (it failed) stays hidden until
the job ends and the result is rebuilt from disk, as before.
"canción" has two Unicode spellings: a precomposed ó, or an o followed by a
combining acute. yt-dlp hands over titles in either, and sanitize_filename let
the decomposed form through into the clip file, the R2 key and the URL path.
Measured against prod on 24-ago-2026, on a clip whose title carried the
combining form: a <video> element loads it fine, and fetch() of the very same
URL comes back 503, while curl gets 206 with the identical headers. So the
download button, which fetches, was broken on effectively every Spanish title,
and playback hid it.
Normalising at sanitize_filename fixes the whole chain at its source: one name
for both spellings, and a no-op for the ASCII names that already worked. Clips
already archived keep their decomposed name and still play.
The static ISP pool (dfa3124) moved downloads off the paid proxy but never
touched cloud/metering.py, so probe_url_minutes kept reading PROXY_URL alone.
Every managed YouTube submission still paid DataImpulse for 0.2-1 MB of yt-dlp
metadata (measured through a counting proxy) while the download itself went out
free over Decodo — and invisibly, because PROXY_BYTES only counts the bytes of
the winning download attempt.
The probe now walks the same cheapest-first chain as the download: direct when
DIRECT_FIRST=1, then the statics rotated per probe, then the paid proxy as the
last resort. Proxies are the outer loop and extractor strategies the inner one,
so the paid route is only reached after every free one has failed on both.
That also stops a drained paid proxy from taking YouTube ingest down on its own
("Could not determine the video duration") while the statics are healthy.
Two smaller cuts on the same path: a user with no minutes left now gets its 402
before the probe instead of after it, and a failed route no longer dumps a
yt-dlp ERROR block per proxy per strategy into the API log (the watcher is what
reports a dead route).
Cloud keeps every user's connected accounts as profiles inside one
Upload-Post account, so the profile string is the only thing separating
'schedule to my TikTok' from 'schedule to a stranger's'. All three call
sites read `forced_profile or <client-supplied profile>`, which honours
the client's value whenever the server fails to resolve its own — one
resolver bug away from a cross-tenant write, and invisible in review
because the happy path looks identical.
resolve_post_profile() now refuses in cloud mode instead of falling
back, and never consults the client value there; self-host keeps
picking its own profile, since it owns the account behind the key.
Tests pin both behaviours and the profile filter on the scheduled-post
list, which is what stops one tenant reading or cancelling another's
queue.
Prod 20-ago, 5 of 12 managed jobs failed and the alert said 'youtube
download' — no download had terminally failed. Three fixes:
- The quality probe now reports source duration, and /api/process rejects
sources under MIN_SOURCE_SECONDS (default 45, 0 disables) on all three
ingest paths with a clear message. A 24s YouTube Short cannot yield
15-60s clips; Gemini returns nothing and the job burns managed minutes
to die with 'no usable clips' (3 of the 5 failures, one user retrying
the same cat video).
- _job_error_text drops per-attempt download warnings when a later
attempt succeeded (HD-direct fails on every job since the server IP
ban; static proxies recover it), and gained an 'Error:' marker so
raised exceptions (RuntimeError:, GeminiBlockedError:) reach the alert
instead of a bare 'Traceback ... exit code 1'. The classifier names
'no clips found (user video)' as its own content-shaped category.
- (env, no code) DIRECT_FIRST=0 in prod: with the server IP banned the
direct attempt only added ~10s and the noise behind these alerts.
Issue #68: publishing a video to YouTube from the Studio now offers
'create clips from this video'. /api/process accepts a
thumbnail_session_id, hardlinks the session's source under the job's
name (so /api/source, the clip editor and retention treat it like a
normal upload) and forwards the session's transcript via a new
main.py --transcript flag, so the pipeline skips a second Whisper pass.
Any problem with the forwarded transcript (missing file, no segments,
silent source) falls back to transcribing normally, and empty
transcripts are not forwarded at all. Contract pinned by six endpoint
tests plus a fallback case; verified end to end locally against the
running app (speech video: 'Reusing precomputed transcript (4
segments)' in the job log).
The existing test's words all sat inside the removed ±45s window, so it
passed with or without the change. Add words starting 160s after the clip
ends: the old windowed code drops them, the new contract ships them. Also
assert the words arrive sorted by start time, which the editor's
follow-along binary search depends on.
Turns the clip editor into a three-point editing surface: mark in/out on
the source, send the range to the clip, and scrub the result — with the
timeline honest about which parts of the edit the last render can already
show.
- Chrome: the source track ignored drags entirely. Without preventDefault
the gesture became a text selection and then a native drag, which
swallows every later pointer event and shows the not-allowed cursor.
- The source track's block is draggable (body moves, edges trim) and every
gesture on it scrubs the source monitor, so a cut is chosen against the
picture rather than against numbers.
- Three-point editing: mark in / mark out (i / o) off the monitor's
playhead, then "replace #N" (.) or "insert after #N" (,). Dragging empty
track marks a range instead of silently appending a segment.
- /edl ships the whole source transcript instead of a ±45s window: a cut
can only be extended into words the editor was sent. The panel shows all
of it, follows playback, and seeks the monitor on click.
- Layout: source monitor + its track + transcript | clip preview + its
track | controls. Each track sits under the video it drives.
- The clip timeline works while edited. A cut that only removes material
keeps nothing but frames the last render already produced, so it stays
scrubbable and playable; only material the render never saw is marked
red, and the playhead — now a solid handle — stops at its edge.
Transcript words render in memoised 50-word slices: repainting a couple of
thousand of them costs ~66ms, and timeupdate fires four times a second.
New STATIC_PROXY_URLS env (comma-separated): dedicated ISP IPs with
unlimited traffic, tried after the direct attempt and before the per-GB
paid proxy. With it unset the chain is byte-identical to before.
- plan_download_attempts: pure, unit-tested attempt ordering. Cheapest
bandwidth first: direct -> statics (rotated per job, uncapped 1080p,
free bytes) -> paid HD (720p cost cap) -> fallback via paid.
- The 720p cap and the PROXY_BYTES monthly counter now apply ONLY to
attempts that actually bill per GB — static downloads come in at 1080p
and don't count toward the cost alert.
- alerts.py watcher generalized to multiple targets: the static pool
(down = ingest silently moves to per-GB billing, nag with a cost hint)
and the paid proxy (down = ingest at risk), each with its own
down/nag/recovered incident state.
Context: the server's IPv4 is hard-banned by YouTube (19-aug-2026), so
DIRECT_FIRST serves nothing and every download was going through
DataImpulse at $1/GB capped to 720p. Verified from prod: all 3 Decodo
dedicated IPs pass the bot-check with cookies+bgutil at 1080p.
The residential proxy ran out of traffic (407 TRAFFIC_EXHAUSTED,
19-aug-2026) and every YouTube-URL job failed with only easy-to-miss
one-shot alerts. Now:
- cloud/alerts.py: a background watcher probes the proxy every 30 min
(generate_204, a few bytes of paid traffic). On failure it alerts
immediately, re-alerts every 2 h while the proxy stays down, and sends
a recovery confirmation when it answers again — so exhaustion is caught
even before the next user job fails.
- record_job_outcome: a proxy-classified job failure also opens the
incident, so job-driven detection and the probe share one state.
- app.py: the watcher starts from the lifespan in managed mode.
- tests/test_proxy_watch.py: state machine (first alert, renotify window,
recovery + reset, job-error trigger).
- test_hooks.py: the 6-style contract the frontend mirrors (boxed vs
outline), fixed-bitmap emoji rescaling (_emoji_scale/_measure_width),
and create_hook_image rendering every style (emoji included) with the
unknown-style fallback.
- test_hook_layers.py: _strip_burned_hook walk-back (hooked_/legacy hook_,
missing-file stop), the two-step subtitled->hooked->clean strip /api/hook
replaces through, and _canonical_clip_file resolving hook chains with
newest-derivation-wins.
transcript_words() strips each word, so the remapped transcript handed to
the caption generators lost the leading-space convention the block
collector uses as its word-boundary signal — every recut/reframe with
re-applied captions burned the whole line glued together
("...creesycambiatodo"). Latent since the clip-editor merge; surfaced by
the first caption burn over a recut with real words.
- Meter the re-render: /api/clip/reframe now reserves/commits/releases
minutes exactly like a source-path /rerender — it is the same GPU work,
and it was free and uncapped.
- Re-apply captions by default (reapply_captions param to opt out): every
default clip ships with burned captions, and the reframe silently
returned caption-less files.
- Read metadata.json INSIDE the per-job lock (same _reframe_locked shape
as /rerender): the read-outside/write-inside window let a concurrent
rerender's recipe get clobbered by a stale write.
- Interplay with whole-clip framing: recipe.framing keeps forcing its
layout on the scenes the user did not hand-position (apply_crop_overrides
runs after force_strategy, so per-scene wins where named), and the
recipe is preserved through the reframe instead of being rebuilt bare.
- /rerender clears stale crop_overrides: scene indices only mean anything
against the cut they were made for, and the trim render does not apply
them — leaving them made /scenes reopen showing overrides that would
land on the wrong shots.
- /scenes: entitlement-gated (it cuts, scene-detects and encodes on every
open), serialized per job (stable output names tore under concurrent
opens), 400 on horizontal jobs, real aspect for square jobs, temp_
prefix on preview/thumbnails (kept out of the self-host S3 backup),
faststart + timeout on the preview encode.
- Tests for all of it plus the apply_crop_overrides math the PR described
but did not include (12 new, suite at 502).
The scene classifier only counts faces, so a screencast-style video with a
presenter in frame gets TRACK and the crop eats the slide (the SCREENCAST/
WIDE detectors sit behind the opt-in layouts=auto flag). The clip editor now
has a framing selector that pins every scene's layout: 'full' renders the
whole source frame (WIDE: no side-crop, blurred bands), 'track' forces the
subject-tracking crop, 'auto' returns to the classifier.
Plumbed as force_strategy through reframe_v2.render -> render_clip ->
perform_recut -> /api/clip/rerender (and the recut_clip MCP tool). A
non-auto choice always re-reframes from the retained source (409 without
it) and persists in the clip's recipe, so later plain trims inherit the
look instead of silently reverting; an explicit 'auto' resets it.
Verified live: framing=full on a TRACK-cropped clip re-rendered with the
full frame visible edge to edge (125s source path), and the editor reopens
with the persisted choice preselected.
/api/process (and the process_video MCP tool) now accept optional
target_clips (1-15) and clip_min_seconds / clip_max_seconds (5-180),
surfaced in the dashboard as a collapsed 'advanced options' section.
Blank means the AI decides, keeping the default request byte-identical.
Plumbed through the same env overrides the A/B harness already reads:
CLIP_TARGET_MIN/MAX (existing) and a new clip_duration_bounds() in
clip_selection.py backing CLIP_MIN_SECONDS/MAX_SECONDS. The detail and
visual prompts take the band as template placeholders instead of the
hardcoded 15-60, and word-snapping enforces the same bounds. All three
knobs are honest targets, not guarantees: the model still returns fewer
clips when the material doesn't hold them, and the UI copy says so.
Verified live: target_clips=2 + band 8-15s on the demo video returned
exactly 2 clips of 13.3s and 13.7s (the uncontrolled run gave one 41.7s
clip); out-of-range values 400 with a named reason.
- Per-job asyncio lock around /api/clip/rerender (same pattern as
_restore_locks): concurrent saves raced on the metadata.json
read-modify-write, with the last writer silently reverting the other
clip's recipe and video_url.
- Re-run normalize_segments after snap_to_words + clamp: a segment fully
outside the canonical range used to clamp to an inverted (end < start)
window that passed within_range and died in ffmpeg as a 500; it is now a
clean 400.
- Add METADATA_SCRUB + '-movflags +faststart' to the cut and concat
commands: a fast-path recut IS the delivered file, and without a fronted
moov atom the browser preview hangs (same invariant as every other
final-artifact producer in the repo).
- Unique per-invocation temp names (uuid token) for part/list files and a
uuid suffix on the output name: two concurrent recuts in one job dir no
longer overwrite or delete each other's intermediates, and same-second
saves of one clip no longer collide on the output filename.
- 1800s timeout on ffmpeg runs (matching apply_watermark) so a hung render
can't pin an executor thread and its quota reservation until restart.
Review findings on the MX-gate commit, addressed:
- Rate limits now run BEFORE the DNS work, and the attempt row is
inserted before the MX gate, so rejected junk-domain floods count
toward both limits instead of getting unlimited free DNS lookups.
- Existing accounts bypass the MX gate: it protects sign-up only, so a
domain whose MX later matches the disposable list can't lock an owner
out of their account.
- RFC 5321 implicit MX now also checks AAAA (IPv6-only mail domains
were falsely rejected).
- Error-derived verdicts cache for 60s instead of 1h: a transient
NXDOMAIN no longer pins a lockout, a resolver blip no longer
whitelists a domain for an hour.
- One shared resolver with an LRU record cache (was: new resolver +
resolv.conf read per lookup); verdict cache evicts FIFO instead of
full clear.
- MX blocklist moved to disposable_mx.txt, same loader and ops workflow
as disposable_domains.txt (the two lists were already drifting).
- Both rate-limit counts merged into one FILTER query; distinct 429
message for the per-IP limit (shared-NAT lockouts diagnosable).
- Index on (request_ip, created_at) + 30-day token purge in the
retention sweeper. NOTE: schema is create_all-only, prod needs:
CREATE INDEX IF NOT EXISTS ix_magic_ip_created
ON magic_link_tokens (request_ip, created_at);
Bot sign-ups with rotating temp-mail domains (onldm.net -> 10minutemail's
SMTP) and nonexistent addresses were bouncing every magic link back into
the support inbox and hurting sender reputation.
- email_policy.mx_verdict(): resolve the domain's MX (A fallback per RFC
5321) and reject when nothing can receive mail or when the MX target
belongs to known disposable-mail infrastructure - catches the rotating
front domains the static blocklist can't keep up with. Cached per
domain, fails open on resolver trouble.
- auth: per-IP rate limit on magic-link requests (bots rotate addresses,
not IPs).
- blocklist: add onldm.net; pin dnspython (already transitive via
email-validator).
New mcp_ui module holds the template: preview each 9:16 clip inline,
select the keepers and publish them via publish_clip from inside the
conversation. One template, three data paths, because the ecosystem has
not converged: baked-in JSON on the per-call embedded resource, the
ChatGPT Apps window.openai bridge, and the MCP Apps ready/render-data
postMessage handshake. Titles are JSON-escaped so a clip name cannot
break out of the script tag, and the template is fully inline because
host CSPs block external fetches.
The server grows resources/list, resources/read and the resources
capability; list_clips declares the template under both _meta.ui
.resourceUri and openai/outputTemplate. Non-UI clients see the same
text and structured content as before; the extra content entry is
spec-tolerated. The unknown-method protocol test moves off
resources/list, which is now a real method.
Every clip now exposes its recipe (which source segments it was cut from)
via GET /api/clip/{job}/{i}/edl, and POST /api/clip/rerender re-renders it
from an edited segment list: fast path recuts from the already-reframed
canonical file, source path re-reframes from the retained source
(--keep-original now passed for URL jobs). Captions/subtitles/transcript
remap piecewise through recut.virtual_transcript for multi-segment clips.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Agents don't forget to come back; humans do. Make the whole pipeline
drivable without the dashboard:
- API keys (osk_...): sha256-stored tokens minted from the account page.
get_current_user_optional resolves them like a session, so metering,
entitlement, priority and job ownership apply to agents with zero
endpoint changes. Key management refuses API-key auth (a leaked key
cannot mint replacements).
- MCP server at /mcp: stateless Streamable-HTTP JSON-RPC, no SDK
dependency. Six tools (process_video, get_job_status, list_clips,
get_quota, add_subtitles, publish_clip) that call back into this same
app in-process via ASGITransport with the caller's auth headers, so
MCP can never drift from REST behavior. Cloud requires a key;
self-host stays BYOK-open.
- Completion webhooks: webhook_url (+ optional HMAC webhook_secret) on
/api/process, SSRF-checked at submit AND delivery, fired once after
the R2 archive so payloads carry durable links, survives redeploys
via the resume manifest.
- Dashboard: API keys card in the account page (create once-shown key,
list, revoke).
- Tests pin BILLING_ENABLED=0 in conftest so the suite no longer
depends on the developer's personal .env.
Prod measurement, 3-ago-2026: 408 of 429 jobs (95%) delivered three clips or
fewer, the mode being ONE. Cross-referenced against retention on the cohort
that signed up 3-7 days ago (old enough to have returned, recent enough that
the 7-day purge has not deleted their user_videos rows):
clips delivered users came back a 2nd day
1-3 251 0.4%
4-9 31 16.1%
Forty times the retention on the far side of a boundary that 95% of jobs never
crossed. That is the mechanism behind the 96.7% of users who only ever use the
product on a single day.
The shortlist was not the constraint — a 5-minute video already shortlists 5
windows. The detail prompt was: it asked to "prefer one great clip per
candidate window", and both the 2-second rule and STANDS ALONE end in "or skip
it" with no lower bound, as does DIVERSITY's "drop the other". Three rules
pushing down and nothing holding the count up collapses to one clip.
clip_count_targets() now derives a floor and a ceiling from the shortlist size
(3 windows -> 3-6, 5 -> 4-10, 10+ -> 6-12) and the prompt states it. Every
quality rule is untouched — they are validated at 82% against random windows
and this change does not spend that.
A/B on 8 real prod transcripts (3.5-18 min, all of which delivered 1-3 clips in
production), sharing the score pass between variants so only the detail prompt
differs:
OLD mean 2.75 median 2.5 <=3 clips: 6/8
NEW mean 4.00 median 4.0 <=3 clips: 3/8
better on 7 of 8, worse on none, one tie (sign test p = 0.016)
The ceiling never bound: the most any video produced was 5 against a ceiling of
8-12, so the model is not padding to hit a number — the floor and the removal
of the one-per-window bias are doing the work. That is the outcome to want.
Read the limits honestly. Three of eight still land at three or fewer, and the
sample under-represents the sub-5-minute videos that are 54% of real jobs and
the hardest case here: both short videos in the set shortlisted only 2 windows
out of the 3-4 that existed, because the SCORE pass returned fewer usable
windows than it was given. That is the next thing to look at, and it caps this
change on exactly the videos that matter most.
CLIP_TARGET_MIN / CLIP_TARGET_MAX override both bounds for further A/B runs
without a deploy.
AUTO_LAYOUT=shadow runs the picker, prints one greppable line per job, and
applies nothing. The render is what it would have been with the picker off,
verified end to end on the production image: excel.mp4 decides "screencast",
logs it, and still renders with every layout module disabled.
Everything measured about this picker was measured on 48 YouTube clips chosen
by hand. What users actually upload is a different distribution nobody has
looked at, and the honest way to find out is to ask the question on real jobs
without letting the answer reach the output. A week of this costs 0.002 USD and
~2s per video and cannot damage a clip somebody paid for.
Log line is deliberately not routed through cloud/analytics.py: that path is
opt-in and host-scoped, and a shadow run has to work on any deployment,
self-hosted included.
[layout-shadow] decision=screencast would_enable=screencast_layout duration=121s
Three horizontal bands was the obvious shape and it is geometrically wrong.
A 1080x640 band is LANDSCAPE, so filling one from a 1080-tall source needs a
1551px-wide crop; on a 1920 frame holding three people that reaches both
neighbours, and the rendered bands each showed two faces. Clamping the crop to
the space a person owns then produced 328x194, upscaled 3.3x into a blurry
close-up of a nose. Both were rendered and looked at before this changed.
A 2x2 grid has PORTRAIT tiles (540x960), which ask for a tall narrow crop, the
shape a person actually occupies. Three people take three cells and the fourth
holds the wide shot, letterboxed rather than cropped, which doubles as context
for who else is in the room.
The neighbour clamp stays: it is what stops a crop reaching the next person
whenever the tile aspect would otherwise allow it.
Verified on a synthetic wide shot built from three corpus talking heads (the
first attempt at that was wrong too: hstacking three 640x360 tiles and scaling
to 1080 tall stretched every face 3x and the detector found nothing).