Since 30-sep-2026 YouTube bot-checks anonymous requests from every one of
our non-residential IPs per video: the same video fails on the 3 statics
and the server's own IP, with every player client, and the paid residential
proxy answers it. The metering probe learns that verdict first; the
download then repeated four anonymous attempts (~8 s, four more hits on IPs
YouTube is scoring) before reaching the paid proxy for the same answer.
The probe now leaves a one-shot verdict per URL, app.py passes it to the
job as DOWNLOAD_SKIP_STATICS=1 (and into the resume manifest), and
plan_download_attempts drops the free attempts when a paid proxy exists.
A stack of Google accounts from one IP used to get a 60-minute first video
each. first_video_grants keeps an HMAC of the client IP (never the IP), not
tied to the user row, counting only grants whose reservation is live; a
network that already had one gets the first-N-minutes cut instead.
- Free source past the balance: first video (<= 60 min) clipped whole for the
balance, any other clipped to the first N minutes. No 402 wall for free
accounts with >= PARTIAL_MIN_MINUTES left.
- cloud/lifecycle.py: welcome, first-clip nudge, win-back (optional
WINBACK_PROMO_CODE from env) and abandoned-checkout recovery via
after_expiration.recovery + checkout.session.expired.
- Commercial emails go through send_commercial_email: opt-out honoured,
unsubscribe footer and List-Unsubscribe headers (out-of-minutes too).
- The clip button and modal are "edit hook" (was "viral hook"), and the
submit says "update hook" when the clip already has one.
- Typeface picker: Montserrat, Anton, Serif, all bundled so the server
render (hooks.HOOK_FONTS, /api/hook `font`) and the Remotion preview
(HOOK_FONTS in remotion/lib/fonts.ts) use the same file and size.
Unset keeps each style's own typeface, so existing styles render as
before.
- The preview box is a true 9:16 (it was taller than the video, so the
hook sat off where it lands); style swatches are larger, drawn in the
real typeface, and "Pills" shows pills.
- Entrance options are hidden when they cannot apply (server re-render)
instead of shown greyed out.
- Autopilot: skipped videos can be clipped again by hand (private videos
used to be misread as Shorts).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every line of the hook gets its own white rounded box with black bold
sans (Montserrat ExtraBold, SIL OFL, bundled in fonts/ with its license),
the look short-form viewers know from TikTok. It replaces the serif
white card as the default for auto hooks, the editor's hook modal and
the /api/hook default; the other six styles stay selectable.
- hooks.py: _draw_pills renders the stack for the FFmpeg path.
- Remotion HookOverlay mirrors it (box-decoration-break: clone), so the
editor preview matches the burned result.
- The generate form says the hook text, style, position and size can be
changed per clip afterwards; the saved style preference moves to a v2
key so the old stored default does not pin people to the serif card.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Logs
- Each job log line records when it arrived (app._TimedLog) and
/api/status returns log_times; the dashboard showed new Date() on every
render, so every line had the same, moving clock.
- The cloud log view shows every stage: download %, early audio,
transcription %, finding moments, layout, clips found, and per clip
creating / framed / ready. Progress updates its own line instead of
adding one per step. Lines glued to yt-dlp's \r progress bar (the
parallel transcription prints onto it) are split, so its % shows again.
"Found N clips" matched the old "viral clips" wording only.
Result cards
- The results grid only goes to two columns when each card gets ~600px
(auto-fill) instead of at the xl breakpoint, where the side panel was
squeezed and the copy buttons spilled out of the card.
- Card actions take as many per row as fit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/api/social/post and the AI Shorts post sent the clip with a sync
httpx.Client inside an async handler, so the whole API froze for the
length of the upload. 23-sep-2026 19:47:48 UTC: one TikTok+YouTube post
stalled every request, /health included, for 42 s and the uptime monitor
paged "openshorts-api down" for 2 min. Both uploads (and the actor image
fetch in saasshorts_generate) now run through asyncio.to_thread; an AST
test rejects blocking httpx/requests calls inside async defs in app.py.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- security_utils: accept only is_global addresses (100.64.0.0/10, the
Tailscale range, went through is_private), judging IPv4-mapped / 6to4 /
Teredo / NAT64 IPv6 by the IPv4 inside.
- /api/process validates the URL (public host, one YouTube video) before
anything fetches it, and the quality probe now runs after the metering
step (balance, job limit, hourly probe cap); a low-quality confirm or a
too-short source hands the reservation back. quality_probe.py checks the
same itself, passes noplaylist and no longer disables TLS verification.
- Metered whole-video URL jobs carry SOURCE_CAP_MINUTES = reserved minutes
(job env + resume manifest); main.py cuts a download clearly longer than
that, so a server cannot answer the probe short and the download long.
- main.py / quality_probe.py get child_env(): the server secrets (Stripe,
JWT, DB, SMTP, Telegram, R2, AgentLedger, managed keys) are dropped; a
test fails if the pipeline ever reads one.
- /api/social/user no longer logs the whole Upload-Post profile list.
- Owner checks on /api/thumbnail/generate, /api/thumbnail/publish/status
(dashboard now polls with apiFetch) and /api/render/{id}; /video/{id}
and /gallery escape every interpolated value and drop non-http URLs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Free tools (no login), linked from nav and footer via /tools:
- /youtube-transcript-generator: reads the captions a video already has on
YouTube (free_tools.py, yt-dlp over the flat-rate static proxies only, never
the per-GB proxy, never the GPU). Per-IP limits, global daily cap, 24 h
cache, honest "no captions" answer with a CTA to the clip generator.
Copy / TXT / SRT export in the browser.
- /youtube-tag-generator: tags, 10 titles or a description from a brief, one
Gemini text call, rules taken from YouTube's own docs (sourced on the page).
- /video-aspect-ratio-converter: 16:9 to 9:16 in the browser with mediabunny
and WebCodecs (blur / crop / bars), nothing uploaded.
Tool pages keep the form in the static HTML; the behaviour is a Vite entry
(dashboard/tools) that vite-plugin-seo resolves by name.
New pages /auto-clip and /youtube-automation with real, blurred screenshots
of the Autopilot tab and the connect-an-agent card, Autopilot rules from
cloud/autopilot.py, plan prices from the billing API and aggregate usage
from the ledger (dated).
SEO fixes: titles/metas for /how-openshorts-works, /podcast-to-shorts, /mcp
and /free-ai-clip-generator (brand queries at pos 1-2 with <1% CTR); a free
AI clipper / free clipping website section and FAQ, and contextual "free AI
clip generator" anchors from sibling pages and the homepage.
Attribution: static pages now write the same first-touch os_attrib key the
app writes, so the signup is credited to the page the visit started on
(7,481 of 7,481 signups in 30 days said "/"). Signup, CheckoutStarted and
Subscribed carry landing_path / referrer_host / utm props in OpenPanel.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A job that fails for a reason on our side (CUDA/OOM, NVENC, cublas,
Gemini 5xx, no clip rendered) is re-queued once after 30 s, keeping its
reservation and transcript checkpoint. Content failures stay final.
- main.py renders clips best-score first and retries each failed clip once.
- A deploy's drain timeout no longer fails and refunds running jobs: the
child is killed, the manifest kept, and the next instance resumes it
(22-sep-2026: 6 jobs failed at once this way). Mid-render manifests are
resumed instead of being recovered as completed.
- /api/status returns the queue position and an ETA; the dashboard shows
it with a 'paid plans skip the line' upsell.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On 22-sep-2026 30-60% of jobs failed per hour at peak with 8 concurrent
jobs on a 20 GB GPU: a job three clips into its render still held 5.9 GB.
- main.py releases the ASR models right after transcribing (Parakeet's
onnxruntime CUDA arena lived until the process exited); TransNetV2
empties torch's cache after each pass.
- Host-wide cap on GPU transcriptions (flock slots on the shared output
volume, ASR_HOST_SLOTS=2), across job processes and deploy containers.
- The queue only starts a job when nvidia-smi reports GPU_MIN_FREE_MB free
(an idle card always starts).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
During a rolling deploy the old container finishes its running jobs on the
same GPU while the new one starts its own full MAX_CONCURRENT_JOBS. On
22-sep-2026 that was 7 old + 3 new jobs on a 20 GB card: TransNetV2 and
NVENC ran out of memory and 5 of 12 managed jobs failed. The new instance
now counts the jobs another instance is heartbeating and waits until the
total fits (bounded by the drain timeout; a killed instance goes stale in 60 s).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Most subscribers use OpenShorts on one day and cancel. Autopilot makes the
value recur: once switched on, every new upload on the user's YouTube channel
(listed through the existing Upload-Post connection, no scraping) is sent
through the normal /api/process pipeline, the user gets an email when the
clips are ready, and with autopublish on the best clips are scheduled on
their socials, one a day.
- cloud/autopilot.py: poller, in-process job submission as the user,
completion hook, autopublish, and /api/autopilot{,/videos,/run}
- guard rails: only videos published after switching on, max 3 days old,
1 automatic job per user per day, first N minutes per video, Shorts skipped,
paid plans only, dedupe by (user, video) across the deploy handover
- dashboard: new Autopilot tab (sidebar + mobile menu, #app?tab=autopilot)
- connect page can return to the Autopilot tab
- analytics: ClipsDelivered/JobFailed now report source=url and the plan
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hourly sweep deleted job dirs and source uploads by age alone. With the
queue backed up (22-sep-2026) free jobs waited over an hour, so their dir
was removed under the worker: no clips, and the minute reservation stayed
held until the 3 h stuck sweep. 21 free users lost their job that way today,
most of them on their first run.
- _job_is_active(): running here, queued/processing in memory, or a fresh
resume manifest (the other instance's jobs during a handover). Manifests
pin a dir for at most ACTIVE_JOB_MAX_SECONDS (24 h).
- The age sweeps and both size caps skip active jobs and their sources.
- run_job_wrapper settles the reservation from the job record it started
with, so a vanished entry releases the minutes instead of holding them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(seo): measure the SEO pages, convert from them, and widen the cluster
The audit of 17-sep-2026 found the static SEO surface ranking at positions
1.8-4 with a 0.2-1.6% CTR while leaking every click it earned: the pages
carried no analytics at all (~424 clicks/month invisible, confirmed with
curl), the only link into the app was the fixed nav button, ten internal
links pointed at /cdn-cgi/l/email-protection, thirteen titles and
twenty-one descriptions were past the length Google renders, and every URL
in the sitemap claimed the same lastmod.
What changes, and how it is verified:
- Analytics (render.js). The shim, the %VITE_OPENPANEL_*% gate and
ANALYTICS_HOSTS are ported verbatim from index.html, plus the init call
the SPA makes from lib/consent.js — first-party measurement is exempt
from prior consent and always on, so there is nothing to ask here. Vite
only rewrites index.html and these files are emitted assets, so the
plugin substitutes the placeholders itself; unset still yields an inert
page. Verified by building with and without the variables.
- Body CTA (render.js, per-page copy in pages.js). Rendered between the
TL;DR and the body, with the text that fits each page's argument, and
never on legal pages or the 404. The link carries utm_* so
lib/attribution.js can post the click with the signup, and fires a
SeoCtaClick event so the CTA can be told apart from the nav button.
- Broken mailto links (legal.js). 46 plain-text addresses rewritten as
<a href="mailto:...">. Cloudflare Scrape Shield turns the bare address
into a /cdn-cgi/l/email-protection link, which is a 404 for crawlers.
- Titles and descriptions. Every title is now <=60 characters and every
description <=160, measured across all 35 emitted pages rather than
eyeballed (/gta-5-clips, merged the same week, was over on both). The
check is part of the verification, not a one-off.
- Resume the job after sign-in (App.jsx). Pressing "get free clips" with no
session opened the login modal and dropped the request: the magic link
lands on a fresh document, so the pasted URL was gone. The request is now
written down before the redirect and replayed after it, through the same
handleProcess, so the isSignedIn -> isManaged -> keysMissing gate that
decides billing is untouched: an unentitled account still lands on
#/pricing, with the request parked until it pays. Files cannot be
serialised, so those resume only within the same document.
- Gallery surface (app.py). The gallery head had no canonical; the JSON-LD
was built from html.escape() output, producing &amp;/&quot; and
valid-JSON-but-wrong names; the video page's nav and CTAs were relative
hrefs on the api host, where "/" is a 404 (the app is on www). JSON-LD is
now serialised as JSON with <> and & escaped as unicode, both pages carry
their canonical, and cross-host links are absolute. Verified by rendering
both routes with a monkeypatched gallery: the JSON parses and a title
with quotes, an ampersand and markup survives round-trip.
- New comparison pages (pages.js): /opus-clip-pricing, /opus-clip-free-
alternative, /opus-ai, /opus-pro, /vizard-ai-video-to-text,
/submagic-reviews and a Spanish index at /alternativas. They target
buying-intent variants (opus clips pricing, opus clip free trial, opus ai,
opus pro, is vizard ai free) that the existing pages do not answer, read
every price from data.js, and join the related-page ring, the footer and
the landing links. /alternatives/vizard also gained the brand Q&A ("Is
Vizard AI free?"), since "vizard ai" is how its volume is spelled.
Build: npm run build green (35 HTML files, all metadata in range, all
JSON-LD parseable). Tests: pytest tests/ -q, 777 passed, 19 skipped.
* fix(seo): CTA sin UTM interno, tutorial no pisa el job reanudado, mailto en el agente DMCA
- El CTA de las paginas SEO enlazaba al mismo origen con utm_*, lo que
sobrescribia la atribucion real del visitante en lib/attribution.js y
partia la sesion en OpenPanel. El evento SeoCtaClick sigue midiendo el clic.
- Alta nueva con un enlace aparcado: no abrir el tutorial intro encima del
job que se reanuda solo.
- LoginModal solo promete 'tu video esta guardado' cuando el payload es una
URL; un File no sobrevive al magic link en otra pestana.
- Los dos info@upload-post.com del agente DMCA tambien en mailto.
---------
Co-authored-by: victormanuel.caverogracia <>
Three failures measured in prod on 17-sep-2026, one deploy.
1. 5 of 12 jobs failed with "ffmpeg could not cut clip ... exit 187, 0 bytes".
Exit 187 is AVERROR_EXIT after "h264_nvenc: Could not open encoder":
VRAM was full. The uvicorn process itself held 7.7 GB of the 20 GB card
while idle: the thumbnail studio and /api/subtitle on a dubbed clip
transcribe in-process, and the whisper (ctranslate2) and parakeet
(onnxruntime CUDA) singletons then lived in the API for good. Both call
transcribe_backends.release_models() now; the loaders fetch their model
inside the ASR gate so a release can never pull it from under a running
transcription.
2. 26 of the 37 probes that reached the per-GB proxy in 10 days were
`watch?v=X&list=...` or mix links. Neither the probe nor the download set
`noplaylist`, so yt-dlp walked the whole list, died on its first private /
age-gated / bot-checked entry (a video nobody pasted), the probe read it
as an IP problem and paid the proxy to walk the same list again, and the
user got a 400 for a valid link. Reproduced in the prod container: the
same URL with noplaylist answers in 9.6 s on a static. The probe also
keeps every attempt's error per route now, so the anonymous retry's
bot-check cannot overwrite a "confirm your age" from the cookie attempt
into an escalation.
3. noplaylist does nothing for a search or a bare playlist URL: one
`results?search_query=` held the probe thread for 2220 s in the container
and still failed. Search, playlist, channel and feed URLs are refused by
path before any request, with a message that says what to paste.
93 of the 99 quota walls sampled on 16-sep-2026 were shown to accounts with
their 20 free minutes untouched that had pasted a 21-90 min video: asked to
pay before seeing one clip, most left Stripe without paying.
The 402 now carries partial_minutes (the floored balance, at least
PARTIAL_MIN_MINUTES and shorter than the source). The wall shows 'clip the
first N min' next to the plans and resubmits with max_minutes; the server
reserves min(asked, balance) and sets MAX_SOURCE_MINUTES, and main.py cuts
the source in place before anything reads it, so every later stage and the
editor see a short video. The cut travels in the resume manifest so a
redeploy cannot re-run the whole video on a partial reservation. Status and
the results view say which part of the video the clips came from.
media_auth landed in 96f0139 with the allowlist and the capability tokens,
but nothing imported it: app.py still mounted /videos as a plain
StaticFiles over OUTPUT_DIR. The module was deployed as dead code and the
hole it was written to close stayed open.
Verified against production on 7-sep-2026, unauthenticated, with nothing
but a job id (which travels in every clip URL the dashboard builds):
/videos/<job>/.owner -> 200, a user uuid
/videos/<job>/<title>_metadata.json -> 200, the full transcript
/videos/<job>/<title>.mp4 -> 200, the untouched source
Wiring media_auth.is_servable into the mount closes the first two, plus
.resume.json (which carries the customer's own webhook_secret),
.transcript_checkpoint.json, .instance and the .layout.json sidecars. A
refused path 404s before touching the filesystem, so it is indistinguishable
from a missing one.
Safe for every consumer: the dashboard reads transcripts through the
authenticated /api/clip/{job}/{i}/transcript, never from /videos, and every
/videos URL the backend builds is a clip, preview (.mp4), scene thumbnail
(.jpg), actor upload (.png) or subtitle (.ass) — all allowlisted.
This is the path half only. The clips themselves and the source video in
the same directory are still public to anyone holding the job id; closing
that needs the capability tokens media_auth also provides, which means
request handlers, an /api/media-token endpoint and the dashboard appending
the token in getApiUrl. That ships with its frontend half, not here.
Claude-Session: https://claude.ai/code/session_01UZGqjYcZyfmKww1gcyKrp5
A clip render dies in two steps: reframe_v2.render raises (it has a single
`return True` and no False path), main.py prints "Reframe v2 failed
(<Type>: <msg>)" and falls back to the v1 frame loop, and only if v1 also
fails does "Clip N failed" appear. The alert classifier picked the second
line and not the first, so it named the fallback's exception and hid the
one that actually started it.
Both lines are wanted now. This matters because the zero-clip jobs fixed
in ff2ad3d were reported as completed and never alerted at all; from now
on they fail properly and page, and the page should carry the root cause
rather than v1's symptom.
Claude-Session: https://claude.ai/code/session_01UZGqjYcZyfmKww1gcyKrp5
main.py's clip worker pool swallows a per-clip exception (it only prints
"Clip N failed") and the process still exits 0, and the metadata JSON is
written BEFORE any clip renders. app.py rebuilt the finished job's result
from that metadata and named every clip through _canonical_clip_file,
which returns a filename whether or not the file exists.
So a job whose renders ALL failed was reported as completed with N clips:
the minute reservation was committed, ClipsDelivered fired, archive_job
skipped every missing file and uploaded the metadata alone (returning
before it writes the Project row, so the job was neither restorable nor
visible in history), and the dashboard offered clips whose only existence
was a title. Hitting "download all" on one then answered 404 "No clip
files found for this job" - reported as ticket #4711, job 89d76bbc: two
titles, two viral scores, blank players, minutes gone.
Measured over the R2 archive on 7-sep-2026, this is not an edge case:
195 of 1687 archived jobs hold a metadata file and not one clip, across
184 users. On a 200-job sample since 1-aug, 14.6% of all promised clips
were never delivered while every one of those jobs was billed and
counted as a success.
_clips_actually_rendered keeps only the clips whose file is on disk and
non-empty, preferring main.py's own CLIP_READY marker (what the file IS)
over the name rebuilt from the convention (a guess). A job that rendered
nothing is now marked failed, so _settle_reservation releases the
minutes instead of committing them and the outcome is tracked as
JobFailed.
Claude-Session: https://claude.ai/code/session_01UZGqjYcZyfmKww1gcyKrp5
Reopening a project whose working files were gone (redeploy, hourly sweep)
fired the transcript requests, which pull the job back from R2 (~25 s for
2 GB), and the <video> loads at the same instant; /videos was a plain
StaticFiles mount, so every player got a 404 until the user reloaded
(job cff3ad6c, 6-sep-2026 00:37 UTC, 15 x 404).
- restoring_static.py: StaticFiles subclass that, on a miss, hands the job
id to a restorer and looks once more. Range/ETag/HEAD behaviour untouched.
- app.py: restore_project's core is now _restore_job_files (no auth, the
caller decides); the /videos restorer looks the Project up by job id and
restores for its owner. The files are public by job id already, so this
grants nothing new. A player arriving mid-restore waits on the per-job
lock instead of failing. The "Auto-restored" line is printed once, when
files were actually pulled, instead of once per waiting request.
Claude-Session: https://claude.ai/code/session_013ubPhpBw8kAUcLXCCfH4C5
PAID_PROXY_DAILY_MB (default 500): past it, the per-GB proxy is dropped
from the duration probe and from every new job's env until UTC midnight,
with one Telegram note per day. A repeat of 28-aug (statics refused by
YouTube for hours) now costs $0.50 at worst instead of $14.
The watcher probed the statics against google.com/generate_204, which kept
answering 204 that whole day while YouTube served the static IPs fake
'Video unavailable'. A static now has to return a real watch page with a
playable player response; the paid probe keeps the cheap plain-HTTP 204
(HTTPS through DataImpulse breaks in httpx even when healthy).
Claude-Session: https://claude.ai/code/session_014i9z6mLTy978uRCfSsMfBq
DataImpulse showed ~0.2 $/day with the static pool healthy, and $14 on
28-aug that nothing on the server could explain: the monthly counter is
in-memory and the container log rotates within the hour. The panel's
per-host rows for 31-aug/1-sep pointed at two leaks.
The duration probe (cloud/metering.probe_url_minutes) walked every URL that
failed on the statics through the paid proxy with both extractors, ~1.7 MB
a time: private, removed and members-only videos, live streams with no
duration, and every non-YouTube URL (Twitch, Kick, Rumble, product pages,
drive links) that the download plan itself never sends there. It now
reaches the paid proxy only for a failure another IP can fix (bot-check,
403/429, proxy or network errors) and never for a non-YouTube URL.
main.py prints PROXY_ROUTE=<json> after every download: the winning
attempt, paid bytes summed over every attempt that used the per-GB proxy
(failed ones included; a paid attempt that died after three fragments was
billed for them), and each free attempt's error text. app.py persists it as
a proxy_usage row at job end and pages Telegram whenever the paid proxy
carried bytes, folding a burst into one message per 5 min; a probe that
reached the paid proxy is recorded the same way.
Claude-Session: https://claude.ai/code/session_014i9z6mLTy978uRCfSsMfBq
Self-hosters asked for a pipeline that never calls Google. LLM_BASE_URL (+
LLM_MODEL, LLM_API_KEY) routes the transcript scoring and detail passes of
get_viral_clips to a /chat/completions endpoint; the answer is validated with
the same pydantic schemas Gemini enforces server-side, so main.py sees one
shape. json_schema is requested first and the request falls back to
json_object and then to free text when a server rejects the field.
Scoring batches drop from 8 to 3 windows on the local path: Ollama's default
4k context truncates silently and a truncated prompt scores garbage.
Self-host /api/process now accepts a request without X-Gemini-Key when the
backend is configured, /api/config exposes localLlm and the dashboard stops
demanding the key. Frame-based stages (layout picker, on-screen content,
silent videos) stay on Gemini and degrade as before without a key; the
silent-video path says so instead of failing generically.
Verified end to end with Ollama 0.13.5 + qwen2.5:7b on an M1 Pro: a 15-min
talk, 14 windows, 6 clips with usable hooks and titles, six local calls and
zero requests to Google.
Claude-Session: https://claude.ai/code/session_014i9z6mLTy978uRCfSsMfBq
/api/source-url skipped the ownership check when the job record did not
resolve, and then signed anyway. That made it the one door in the design that
hands out a working capability without asking who is asking, which is precisely
what locking down /api/source was for.
Narrow in practice: a real job resolves, from its metadata or from the manifest
that names its owner while it runs, so the uncovered case is a directory in a
half-written state. It also still takes guessing a UUID, so this was never
worse than the behaviour it replaced. It is fixed because "a hole with a rare
precondition" is still a hole.
Off billing it keeps answering, since there is no owner to check and the
self-host preview would otherwise break for nothing.
The test stubs the minter so that reopening the hole fails on the status
assertion rather than on _cloud_config being None off billing: a test that
passes only because the code under it happens to crash stops guarding the day
it stops crashing. Verified by reopening the hole and reading the failure.
Claude-Session: https://claude.ai/code/session_01WyFE2wXi8quZR6nLRRLDgE
GET /api/source streams the file we downloaded, not a derived clip, and it was
open on the reasoning that the UUID job id is the capability. That makes the
product a public YouTube downloader wearing a UUID, which is the characterisation
worth avoiding, and one leaked id in a log or a referer opens someone else's
video.
A <video src> cannot carry an Authorization header, which is why it was open in
the first place, so the owner mints a short-lived signed URL from
/api/source-url and hands the player that. The endpoint takes the signature or
falls back to the owner check. Self-host and ownerless BYOK jobs are untouched:
no owner to check, no secret to sign with. The owner lookup is gated on
BILLING_ENABLED because it falls through to a full rescan of the output
directory, which off billing would run on every preview and buy nothing.
Both minters go through _signed_source_url. The EDL feeds ClipEditor's source
monitor the same way and was built as a bare path, which works in self-host and
in every test and 404s in cloud. The regression test asserts the endpoint calls
the minter rather than comparing strings: off billing the helper returns that
same bare path, so a string comparison passes just as happily with the bug in.
Verified by putting the bug back and watching it fail.
The frontend mints at render, not when the session is persisted, or localStorage
would hold a token that expired overnight.
SOURCE_RETENTION_SECONDS can age the retained download out ahead of the clips it
produced, and defaults to the job clock, so nothing changes until someone sets
it. Lowering it is not free: the EDL, rerender, scenes and reframe endpoints all
read that file and answer 409 once it is gone.
Claude-Session: https://claude.ai/code/session_01WyFE2wXi8quZR6nLRRLDgE
Art. 50(2) asks a provider whose system generates synthetic audio or video to
mark the output in a machine-readable way, and the terms already promised we
"label and mark" dubbed clips while nothing did either.
mark_ai_generated stamps the disclosure by stream copy, so it is a remux and
never a re-encode. The tag is `comment` because mp4 keeps only the standard
tags and ffmpeg drops a custom key without warning, which a test pins. It is
best effort by design: a missing tag must not lose someone the video they just
paid minutes for.
Deliberately narrow, on dubbing and AI actors, not on an ordinary clip whose
pixels and audio are the user's own footage. Marking everything would make the
tag mean nothing. TranslateModal says the file is tagged and that the person
publishing it owes their audience the disclosure, which is the art. 50(4) duty
and falls on them, not on us.
Still missing, and a product decision rather than an oversight: the visible
burned-in label.
Claude-Session: https://claude.ai/code/session_01WyFE2wXi8quZR6nLRRLDgE
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.
Feedback from a real run: thumbnails were 'face + two words' and the
person did not look like the presenter. The concept planner now has to
show the subject (product, number, result) with props and depth, and may
use the plain face only once. Frames are kept at native resolution so the
face crop sent as reference is ~800px instead of ~500px, and the image
prompt demands the exact same real person (no idealizing, no caricature).
Refining titles in another language now updates the session language and
returns paired thumbnail texts, so the thumbnail follows the title.
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.
- 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.
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.
The stdio reconfigure only covers the API process. main.py prints an
emoji on its first line and configures nothing, so on a cp1252 console
the server now starts but every job dies before rendering.
Measured 22-ago-2026 against prod, on one 46 MB / 52 s clip:
origin -> itself through Traefik 130 MB/s
origin -> a datacenter client 838 KB/s
origin -> the author's browser 90 KB/s (8.5 min for one clip)
R2 S3 endpoint -> the server 11 MB/s, 206
R2 S3 endpoint -> that browser 503, every single request
So the API process is not the bottleneck (it serves the file at 130 MB/s while
the box sits at 0.01 MB/s of egress); the long path out of Hetzner is. And the
fix for that, R2, is unreachable from a browser: *.r2.cloudflarestorage.com is
an S3 endpoint, and a presigned GET that curl fetches at 11 MB/s with identical
headers returns 503 to Chrome.
R2_PUBLIC_BASE points presigned_get() at a custom domain bound to the bucket
instead, which serves the same objects through the normal Cloudflare edge.
Unset, everything keeps signing S3 URLs exactly as before, so this is inert
until the domain exists. Switched at that one choke point because every caller
hands the URL to a browser.
The download button streamed nothing to the screen while it buffered tens of MB
into a blob, which on a slow link is minutes of a button that looks dead. It now
reports percentage, which needs Content-Length readable from JS, which needs the
CORS middleware to name it in expose_headers.
Every log line in app.py is emoji-prefixed and a Windows console is cp1252
by default, so _recover_jobs_from_disk() kills the server during startup:
print(f"♻️ Recovered {recovered} completed job(s) from disk.")
UnicodeEncodeError: 'charmap' codec can't encode characters in 0-1
ERROR: Application startup failed. Exiting.
It never binds a port, so the dashboard is simply unreachable on a stock
Windows box. PYTHONIOENCODING=utf-8 works around it, but that has to be
known before the first run, and the traceback does not suggest it.
subtitles._configure_stdio already does exactly this for the transcription
path. The server needs it too, and needs it before the first print, so it
runs at module scope rather than in the lifespan hook.
Verified: uvicorn with no PYTHONIOENCODING, and an import under a stdout
forced to cp1252/strict. Both start and log the emoji correctly.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QiYkHKB7Tp7X6NdnEutda2
The job runner built its command as ["python", "-u", "main.py"], which
resolves against PATH. Inside the Docker image there is exactly one
interpreter so it works, but in the documented non-Docker install --
a venv -- PATH points at whatever Python came first, not the one running
the server. Every job then dies immediately:
ModuleNotFoundError: No module named 'cv2'
The CLI works fine in the same checkout, so it presents as "the dashboard
is broken" rather than anything to do with interpreters.
_run_quality_probe five hundred lines up already uses sys.executable for
exactly this reason; this makes the two agree.
Verified: same job, same venv, failed before and completed after.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QiYkHKB7Tp7X6NdnEutda2
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.
GET /api/social/scheduled lists the caller's pending posts and
DELETE /api/social/scheduled/{job_id} cancels one. Upload-Post's own
schedule endpoint takes no profile filter and returns the whole managed
account, so both filter by the caller's profile server-side — the same
multi-tenant trap as the impressions endpoint, and the reason cancel
404s instead of 403s on someone else's job.
The template picked its next daily slot from n8n workflow static data,
which two approvals tapped seconds apart both read before either wrote,
booking the same slot and publishing together (seen in a live run). It
now derives the slot from the server-held queue, which is shared state
and cannot race with itself that way.
Upload-Post's /total-impressions/{profile} echoes the requested profile
but returns account-wide numbers — a profile with zero posts got 85K
Instagram impressions — which for managed users leaks other tenants'
aggregates into the dashboard card and the analytics API. Aggregate the
post-analytics cache instead, which is correctly scoped by ?user=, and
keep the same response shape (total_impressions + per_platform).
GET /api/social/analytics (profile totals), /analytics/posts (per-post
cached metrics) and /analytics/impressions (windowed totals). Managed
users are locked to their own profile and rate-limited to 60/h in a
bucket separate from the metering probes; cloud without a plan gets a
clean 402 no_plan instead of a misleading missing-header 400. BYOK
keeps its own key and picks the profile with ?user=.