Fix and harden AI storyboard planner with Modal-hosted models
Session from build-small-agent-trace on Hugging Face by drdavidtang · MIT · condensed by Coders Talk
Fix a crashing storyboard planner endpoint, then progressively harden it: prewarm the model, add a lightweight-model fallback, and add PDF export and reset controls to the TUI storyboard app.
- +0Prompt · +0New error: planner failed with 'Planner must return exactly four scenes', causing a 502 Bad Gateway.
- +0mAgent did · +0mTraced the storyboard planner and added a single low-temperature repair pass for malformed/invalid scene counts, with regression tests; python compiles though pytest wasn't installed locally.
- +2mPrompt · +2mCan we wake the nemotron container on first app load so it's warm by the time the user submits on the second screen?
- +2mAgent did · +2mAdded a fire-and-forget backend prewarm endpoint hit once on app mount to cross the web-to-GPU boundary; TypeScript checks passed but the full Vite build was blocked by a broken local Rollup native dependency.
- +5mIntervention · +5mInterrupted the push and said the full storyboard loads even when nemotron fails, producing an empty console.Why: I noticed the app was accepting broken output as a real storyboard and wanted that caught before pushing anything.
- +6mAgent did · +6mMade empty/default-filled model output impossible to pass validation (required non-empty fields, frontend guard), then built a MiniCPM fallback that splits the plan into metadata plus four independent scene calls when Nemotron fails twice.
- +9mFail · +9mLive endpoint testing exposed real weaknesses: MiniCPM narratives came back undersized (39-71 words vs 80-130 required) with schema drift on supporting details, and Nemotron took ~82s warm and still returned invalid/malformed JSON on both the primary and repair attempts.
- +25mPrompt · +25mIs there a smaller Nemotron model? A few minutes is too slow — or should we just make MiniCPM the default?
- +26mAgent did · +26mSwitched MiniCPM to the sole active planner and prewarm target, removing Nemotron from runtime config/docs while parking its deployment module; committed and pushed (5ab4ab1). Then added a START AGAIN reset control, loosened overly strict scene validation that was crashing on stylistic issues, fixed a 422 chat error caused by oversized prompts duplicating scene JSON, and built a server-side PDF export of the storyboard with visually inspected output.
- +1h 5mOutcome · +1h 5mCommitted and pushed daa4993 'Add storyboard PDF export' (7 files changed); EXPORT STORYBOARD button placed in the workspace header next to START AGAIN, working tree clean.
Next time I'd give the live-endpoint reliability numbers up front — the real fix here only became obvious once we hit MiniCPM and Nemotron live and saw actual timings and malformed output, not from reading the code. My interruption about the empty console when Nemotron silently failed did the most work: it forced strict validation before we ever committed, which then had to be loosened again once it started rejecting merely-imperfect (not broken) storyboards. Deciding to park Nemotron entirely in favor of MiniCPM as default was the right call given the 82s+ warm latency versus MiniCPM's seconds.