Fix selected_content migration that broke /api/activity (assistant stuck at "Queued 0%") - #201
Merged
Merged
Conversation
The "Render Selected" migration ran `ALTER TABLE video_render_job`, but the table is `videorenderjob` (SQLModel's default name, as every other migration uses). The error was swallowed, so on any existing database the column never arrived while the model still declared it — and every read of the video job table raised `no such column: videorenderjob.selected_content`. `GET /api/activity` reads every job table in one union, so it returned 500 on every 2s poll. The store keeps the last known state on a failed poll, which left assistant turns showing "Queued 0%" and "Thinking..." forever even though the worker had finished and written the reply into the chat. The corrected ALTER runs on the next startup and adds the column; no manual step needed. Tests cover an old database being migrated, the activity listing reading afterwards, and a guard that every ADD COLUMN names a real table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VXSCyWni3bUs3umLurV7wP
davior
marked this pull request as ready for review
October 5, 2026 13:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After #200 ("Render Selected"), the assistant appeared to hang. The task indicator showed Queued 0% and the chat showed Thinking… indefinitely. The reply had actually been written: it showed up after a page refresh.
Every 2 s poll of
GET /api/activity?limit=25was returning 500 Internal Server Error (confirmed from a browser HAR capture).Root cause
The new migration ran:
The table is actually
videorenderjob, SQLModel's default name, which every other migration indatabase.pyalready uses. Theexcept Exception: passaround it swallowed the "no such table" error. As a result, on any existing database:VideoRenderJobmodel still declared itno such column: videorenderjob.selected_content/api/activityreads every job table in one union, so that one missing column made the whole endpoint fail. The activity store keeps the last known state when a poll fails. That froze assistant turns at their initialqueuedstate even though the worker had completed them.Fresh databases were unaffected because
create_allbuilds the column directly, which is why tests didn't catch it.Fix
ALTERadds the column; no manual DB step is needed.backend/tests/test_migrations.py:selected_contentALTER TABLE … ADD COLUMNindatabase.pynames a table that exists, which catches this whole class of silent failureAll three tests fail on the previous code and pass with the fix. Full backend suite: 1141 passed.
Video render creation and estimation on existing installs were broken by the same missing column and are fixed by this too.
🤖 Generated with Claude Code
https://claude.ai/code/session_01VXSCyWni3bUs3umLurV7wP
Generated by Claude Code