Skip to main content
An agent applies schema migrations from a migrations directory. Forward migrations on staging are routine; every production migration is a human decision; a rollback that drops data is not an agent action. The interesting case is the migration whose connection dropped: it may have applied, and the agent must not run it again on a guess.

The policy

runnable

The code

runnable file=main.py

What the agent sees

0043 ran once. The agent’s retry would have run it a second time; the effect key migration:staging:0043 in the AMBIGUOUS state is what stopped it.

The receipt

runnable

When an AMBIGUOUS appears

Query the migrations table in the database itself: if 0043 is recorded, ctrlrun resolve migration:staging:0043 --committed; if not, --failed, and the agent’s next attempt runs. A reconcile hook that runs that query is the automatic form.

Next