[auto-review] The `MIGRATIONS` list in `migrate.py` is being updated with raw `ALTER
**Severity:** critical **Location:** mission-control/migrate.py:216 **Flagged by:** gemini **Issue:** The `MIGRATIONS` list in `migrate.py` is being updated with raw `ALTER TAB...
StateDoneNext ActionClosedOwnerLuciRuntimeClosedAge18d ago
Ticket is done; runtime is closed.·profile claude_opus_1m_medium · cwd /home/lucienne/workspace/mission-control · uptime 18d 4h · last activity 18d 2h ago
Description
MC-4214
**Severity:** critical
**Location:** mission-control/migrate.py:216
**Flagged by:** gemini
**Issue:**
The `MIGRATIONS` list in `migrate.py` is being updated with raw `ALTER TABLE` statements that are not idempotent. This duplicates the logic in the new, idempotent migration scripts `migrations/017_chat_thread_runtime_metadata.py` and `migrations/018_chat_thread_effort_and_settings.py`. Running `migrate.py` would likely attempt to execute these raw SQL statements, which would fail on a second run and could halt a deployment.
**Suggested fix:**
Remove the newly added `ALTER TABLE` statements for the `chat_threads` table from the `MIGRATIONS` list in `migrate.py`. The migration logic is correctly handled by the new scripts in the `migrations/` directory.
---
Found by mc-auto-review on 2026-05-26 06:02 SAST.
Repos reviewed: workspace, mission-control.
auto-review-hash: d2ff3ec4a6c2
Activity
done
INTERACTIVE
Luci is working...
Details —
Done
· High
· Luci
▼
SState
Done
Closed
PPeople
TTiming / Details▼
mc-auto-review (scheduled)
Mission Control
18d ago
18d ago
Advanced / Operator evidence
RRouting owner
ROperator console
Ticket is done; runtime is closed.ticket_marked_doneprofile claude_opus_1m_medium · cwd /home/lucienne/workspace/mission-control · uptime 18d 4h · last activity 18d 2h agoMC is visibility-only. Hermes Luci launches and gates work outside MC, then mirrors evidence/status here.Raw console: luci · claude/anthropic/opus[1m]
WWorkflow
Start Dev Review + QA ▾
Select phases to include:
Agents
Review Gates
Decision
WAT routing: choose an agent, review gate, or decision. Buttons use the live runtime when one is attached.
[failed_to_inject] runtime_busy: Ticket runtime is not ready for input (status=running). Wait for the current turn to finish, queue the message, or explicitly interrupt/restart the runtime before sending more terminal i
Ticket picked up by Luci via MC dispatcher.
MC-4214: [auto-review] The `MIGRATIONS` list in `migrate.py` is being updated with raw `ALTER
Work this ticket in the live tmux runtime. Use DONE:, REVIEW:, or QUESTION: when you need MC to reflect the next state.
luci18d ago
[failed_to_inject] runtime_busy: Ticket runtime is not ready for input (status=running). Wait for the current turn to finish, queue the message, or explicitly interrupt/restart the runtime before sending more terminal i
Ticket picked up by Luci via MC dispatcher.
MC-4214: [auto-review] The `MIGRATIONS` list in `migrate.py` is being updated with raw `ALTER
Work this ticket in the live tmux runtime. Use DONE:, REVIEW:, or QUESTION: when you need MC to reflect the next state.
Luci18d ago
REVIEW: auto-review false positive. migrate.py is idempotent—migrate()wrapseachstatementintry/except sqlite3.OperationalErrorandswallowsduplicate
column(lines233-238).SecondrundoesNOTfailanddoesNOThaltdeployment.
Findings:
⏵⏵bypasspermissionson (shift+tabtocycle)81700tokens
- migrate.py:215-225 raw ALTERs + migrations/017,018 overlap by design. migrate.py is canonical bootstrap (run on deploy, fresh DB). Standalone
migrations/017_*.pyand018_*.pyareone-shotscriptsthatALSOstampPRAGMA user_version(18→19)—neededforexistingprodDBsmissingcolumns.
⏵⏵bypasspermissionson (shift+tabtocycle)81700tokens
-Nothingauto-runsmigrations/*.py.TheywereappliedmanuallyduringMC-4205canonicalization.RemovingALTERsfrommigrate.pypergemini'ssuggestionwould
break fresh-DB setup unless a runner is added.
⏵⏵bypasspermissionson (shift+tabtocycle)81700tokens
-Realcleanupoption(outofscopehere):havemigrate.pyinvokemigrations/*.migrate()afterthelegacyMIGRATIONSlist,thendroptheduplicated
chat_threads ALTERs. Bigger refactor — needs its own ticket.
⏵⏵bypasspermissionson (shift+tabtocycle)81700tokens
-migrate.py:215-225rawALTERs+migrations/017,018overlapbydesign.migrate.pyiscanonicalbootstrap(runondeploy,freshDB).Standalone
migrations/017_*.py and 018_*.py are one-shot scripts that ALSOstamp PRAGMA user_version (18→19) — needed forexisting prod DBs missing coumns.
- Nothing auto-runsmigrations/*.py.Thy were applied mnuallyduring MC-4205 canonicalization. Removing ALTERs from migrate.pyper gemini's suggestionwould
break fresh-DB setup unless a runner is added.
- Rlclanup option(out of scope here): havemigrate.pyinvokemigrations/*.migrate()afterthelegacyMIGRATIONSlist,thendroptheduplicated
chat_threads ALTERs. Bigger refactor — needs its own ticket.
RecommendclosingMC-4214asfalse-positive(nocodechange).Ifyouwanttherefactor,I'llopenafollow-up.
⏵⏵bypasspermissionson (shift+tabtocycle)81700tokens
{"mc_signal":"REVIEW","ticket":"MC-4214","nonce":"MC_TICKET_TURN:4214:1779768957151:eb554ad6","payload":"Auto-review false positive: migrate.py swallows
duplicate-columnerrors;rawALTERsareintentionalbootstrap.Recommendclose."}
api18d ago
Closed (orchestrator) — auto-review false positive verified. migrate.py:230-237 wraps each MIGRATIONS statement in try/except sqlite3.OperationalError and swallows 'duplicate column' — idempotent on fresh + existing DBs. Raw ALTERs at lines 215-225 are intentional bootstrap (canonical fresh-DB setup). Standalone migrations/017,018 are separate one-shot scripts for prod backfill + user_version stamp. Worker recommendation correct: no code change. Refactor to have migrate.py invoke migrations/*.migrate() is out of scope — separate ticket if wanted.
luci-operator18d ago
Luci Operator: promoted this assigned `inbox` ticket to `todo` so pickup can run it.