alembic asked for confirmation on a destructive downgrade and the agent's run stalled with zero output for 10 minutes
Finds and neutralizes the confirmation prompt stalling an alembic downgrade in a headless run. Use it when an alembic run hangs with no output around a destructive downgrade. Key trigger: a zero-output stall where a human would be asked to confirm.
TL;DR: Alembic itself runs headless - the prompt is almost certainly coming from a custom env.py hook or a wrapper script, not from alembic core. Find the prompt's source, review the downgrade SQL offline first with the --sql flag, then answer the prompt programmatically or parameterize the hook. Never let a destructive downgrade wait on a human in an unattended run.
alembic asked for confirmation on a destructive downgrade and the agent's run stalled with zero output for 10 minutes- Confirm the prompt exists and find its wording: run the same downgrade command interactively in a terminal.
Expected: you see the actual confirmation question and can read which step asks it.
- Find the prompt's source: search env.py and any wrapper scripts for interactive input calls.
Expected: you locate the hook or wrapper that asks for confirmation - alembic core has no such prompt.
- Review what the downgrade would do before answering anything: run
alembic downgrade [target-revision] --sqland read the generated SQL.
Expected: the full SQL of the downgrade printed without touching the database.
- Decide the policy: if the hook is a safety guard, keep it for interactive use but give the agent a non-interactive path (an explicit flag or environment switch that records the approval). If it is leftover scaffolding, remove it.
Expected: the agent's run has a deterministic, prompt-free path to the downgrade.
- Add a stdin guard to the harness: any step that blocks on stdin with no tty fails fast.
Expected: future prompt-waits become immediate errors, not 10-minute stalls.
Use this when
- an alembic downgrade (or any alembic run) stalls with zero output
- a confirmation prompt appears that alembic's own docs do not mention
- a destructive downgrade must run in an unattended agent session
Not for this skill when
- the downgrade fails with a SQL error - fix the migration
- you are unsure the downgrade is safe - stop and review it with a human first
- the stall has output (logs, progress) - that is a slow migration, not a prompt
Variant phrasings
- alembic downgrade hangs waiting for confirmation
- alembic run stalls with no output on destructive downgrade
- headless alembic blocked on interactive prompt
Why it happens
Alembic's command line is fully non-interactive by design - upgrades and downgrades never ask questions. Teams often add confirmation hooks into env.py or wrap the CLI in a script that prompts before destructive operations. Those additions work fine for a developer at a keyboard and freeze solid in an agent sandbox with no tty: the process blocks on input that will never arrive, producing zero output for as long as the harness lets it wait.
Edge cases
- Reviewing with --sql shows the SQL but not data-loss consequences - a DROP COLUMN looks innocent in SQL and destroys data. Read it as a human would.
- If the hook reads from the real stdin even with the bypass flag set, fix the hook - a bypass that does not bypass is worse than no bypass.
- Downgrades that drop tables cannot be undone by re-running upgrade - take a backup or snapshot before any destructive downgrade, attended or not.
- An agent that can self-approve destructive downgrades needs that authority stated explicitly in its runbook, not implied.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_Ls2S6lLvjX5WYnlEqCx79Q
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.