Skip to content

Videos: the bot picks sound and frame, /draw /video /gif for everyone, admin-only ! shortcuts - #315

Merged
iamwavecut merged 3 commits into
mainfrom
feat/movie-generation-params
Dec 3, 2026
Merged

iamwavecut merged 3 commits into
mainfrom
feat/movie-generation-params

Conversation

@iamwavecut

Copy link
Copy Markdown
Owner

The bot, not the dialog model, now decides between a video with sound and a GIF; videos with sound take their frame from the request; generation commands get slash forms for everyone; and a video whose result was lost in transfer is rendered again.

Why

After #314 the dialog model (Gemma 4 26B) answered every video request in production with make_video, even !кино (taskman jobs 5984899, 5984941 and 5984974 went to FastFrames as silent clips). Job 5984899 also failed outright: FastFrames rendered the clip in 22 s, but the status poll that carried the MP4 (about 3.5 MB of base64) ran past its 30 s timeout. The Tailscale link from the farm to the bot host measured 180 KB/s to 1 MB/s with a 282 ms RTT. Discovery deletes a finished job once it has been read, so the next poll got 404 job not found.

Changes

Video routing. make_video and make_movie share one argument list and one scheduler. A VIP user gets a video with sound unless the message asks for a GIF or a clip without sound (gif, гифка, без звука, беззвучный, silent, /gif). Every other user gets a silent clip for any video request; the vip_only refusal is gone. Tool descriptions, the dialog system prompt and get_user_status entitlements say the same.

Frame and quality. Both video tools take orientation (portrait for a vertical, 9:16 or phone video, or for Stories, Reels, TikTok and Shorts, including earlier in the conversation; landscape otherwise) and quality (high → 4 steps). The job meta stores orientation; the MiniMax-H3 optimizer gets the requested frame as a Frame: line in the user message, returns an orientation field, and composes for it. When the dialog gave no frame, the optimizer's answer is used. draw-api receives orientation: "portrait" and steps only for videos with sound; FastFrames renders 832×480 only, so silent clips stay landscape. 576p is not exposed: the farm measured 96 s render and 117 s HTTP for 4 steps at 576p (cold) against 46 s at 480p.

Lost results. One draw-api status poll may take 90 s (was 30 s), body included. A 404 after a failed status read becomes draw-api result lost, and the video pipeline submits the render once more (video-<id>-retry).

Commands. /draw, /video and /gif join /song for everyone (in groups with the bot's name) and in the Telegram command menus; /movie is removed. The ! shortcuts (!рис, !draw, !песня, !song, !видео, !video, !кино, !movie, !гиф, !gif) work only for configured admins; their dialog turn skips the 5 s debounce and the enqueue limit, and the generation they ask for runs in the VIP queue at ADMIN_COMMAND_PRIORITY, above every other job. A command without a subject (no text, no reply, no media) does not start a turn: the bot replies with a usage hint that disappears after 2 minutes and deletes the command message where it may.

Help. /start help, the VIP benefit lists and the VIP upsell mention /draw, /video, /gif and videos with sound.

Prompt changes

prompts/video/movie_optimizer.prompt and prompts/aifarm/system.prompt keep their {{role}} markers. The optimizer template data gains one optional field, frame, rendered in the user message, so the optimizer's system part stays identical for every request. The dialog system prompt changes one sentence, so its prefix cache is rebuilt once after deploy.

Verification

  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings: clean.
  • cargo test --workspace --no-fail-fast: all pass (one command-order test updated for the new menus).
  • New tests: VIP and non-VIP routing with GIF and no-sound wording; explicit and inferred portrait frame and the landscape default down to the draw-api body; quality, frame and admin flag from both tools to the scheduler; admin priority in the queue plan and the dialog turn; ! shortcuts refused for non-admins; usage hint and delete plan for empty commands; reply or media as a subject; lost-result re-render and no re-render for an unknown job; optimizer frame line and schema.
  • No live Telegram test before merge; production checks follow the deploy.

…sults rendered again

The dialog model answered every video request with make_video, even !кино. The scheduler now decides:
a VIP gets a video with sound unless the message asks for a GIF or no sound, everyone else gets a
silent clip (no vip_only refusal). Both video tools take orientation (portrait for vertical, 9:16,
phone, Stories, Reels, TikTok or Shorts) and quality (high: 4 steps). The MiniMax-H3 optimizer gets
the requested frame in the user message, returns its own orientation when the dialog gave none, and
composes for it; draw-api receives orientation and steps for videos with sound only.

/draw, /video and /gif join /song for everyone and in the command menus; /movie is gone. The ! shortcuts
work only for configured admins: their turn skips the debounce and the enqueue limit, and their
generation runs in the VIP queue at ADMIN_COMMAND_PRIORITY. A command without a subject gets a
two-minute usage hint, and the bot deletes the command where it may. Help and VIP lists mention the
new commands and videos with sound.

A draw-api status poll may take 90 s: a finished MP4 is several MB of base64 over a link that drops
to 180 KB/s. Discovery deletes a job once read, so a 404 after a failed read means the result was
lost, and the video pipeline renders it once more.
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Warnings
⚠️ Prompt files are cache-sensitive contracts; confirm prompt shape and role markers were preserved intentionally.
⚠️ Large PR (1778 changed lines). Consider splitting unless this is generated/mechanical.
Messages
📖 Danger checked 18 changed file(s).

Generated by 🚫 dangerJS against a7d3027

@iamwavecut

Copy link
Copy Markdown
Owner Author

Danger warnings:

  • Prompts: both files keep their {{role "system"}} / {{role "user"}} markers. video/movie_optimizer.prompt gains one optional template field, frame, rendered only in the user message, so the system part is the same for every request (covered by the_requested_frame_goes_to_the_user_message_of_a_video_with_sound_only). aifarm/system.prompt changes one sentence of <agent_behavior>; its prefix cache is rebuilt once after deploy.
  • Size: about 600 of the changed lines are tests. The routing, frame, command and lost-result changes share the video request path and the job meta, so splitting them would ship intermediate states of the same contract.

PR-Agent failed on HTTP 429 from the model endpoint before publishing anything; re-dispatched as run 47148061462.

Telegram keeps a bot upload as sent in private chats and groups and adds transcoded qualities only in big
channels; comparing the uploaded and stored sizes shows that in production.
Every message in a forum topic replies to the topic's first message; that reply is not the command's
subject.
@iamwavecut

Copy link
Copy Markdown
Owner Author

PR-Agent failed four times on HTTP 429 from the GLM Coding Plan endpoint (runs 47147854623 attempts 1–2, 47150699890 attempts 1–2) and published nothing. The owner approved merging without it. Instead I reviewed the full diff myself; it found one bug, fixed in a7d3027: in a forum topic every message replies to the topic's first message, so an empty /video there was not treated as empty. I also removed an unused Deserialize derive. Rust lint, workspace and dependency checks were green on 08821f9; a7d3027 is waiting for them before merge.

@iamwavecut
iamwavecut merged commit 6cb8ab2 into main Dec 3, 2026
10 of 12 checks passed
@iamwavecut
iamwavecut deleted the feat/movie-generation-params branch December 3, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant