From 8396d60218dc8aeb6bcc6861db6cdd0e762ef640 Mon Sep 17 00:00:00 2001 From: Lyndz Williams Date: Sat, 15 Aug 2026 01:15:29 +0100 Subject: [PATCH 1/2] fix(alembic): resolve duplicate revision 010, restore single head Two migrations both claimed revision "010" (down_revision "009"): - 010_add_access_provisions_event_id.py (merged first) - 010_agent_policy_schema.py (PR #424, "Policy Engine foundation") Neither was rebased against the other before merging to main, leaving Alembic unable to resolve `head`: ERROR [alembic.util.messaging] Multiple head revisions are present for given argument 'head'; please specify a specific target revision, '@head' to narrow to a specific head, or 'heads' for all heads This is a real deploy-blocker, not a Railway config issue: found while standing up a fresh Railway deployment for the `generate-v2-config` V24_API_URL fix pack (Wave 1 P0) -- the container built and started fine, but crash-looped through the full healthcheck retry window because the `alembic upgrade head` startup step failed outright, so the app process never came up. Fix: 010_agent_policy_schema.py is fully self-contained (creates agent_registry/policy_rules/audit_log -- three brand-new tables, no foreign keys outside itself, no other migration references it), so it's safe to move to the tail of the chain rather than guess at merge intent. Renamed to 019, re-chained after 018 (the actual tip of the other branch). `alembic heads` now resolves to a single `019 (head)`, and `alembic history` shows one linear chain from `` through `019` with no other duplicates anywhere in the history. Co-Authored-By: Claude Sonnet 5 --- .../{010_agent_policy_schema.py => 019_agent_policy_schema.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename backend/alembic/versions/{010_agent_policy_schema.py => 019_agent_policy_schema.py} (100%) diff --git a/backend/alembic/versions/010_agent_policy_schema.py b/backend/alembic/versions/019_agent_policy_schema.py similarity index 100% rename from backend/alembic/versions/010_agent_policy_schema.py rename to backend/alembic/versions/019_agent_policy_schema.py From 6478be0904147acf074006a8bcf9f5dbd17252eb Mon Sep 17 00:00:00 2001 From: Lyndz Williams Date: Sat, 15 Aug 2026 01:16:27 +0100 Subject: [PATCH 2/2] fix: previous commit staged the pre-edit file content by mistake git add with two paths (the old deleted path + the new renamed path) failed atomically on the missing old path, so the actual revision-id edits (010/009 -> 019/018) never made it into the previous commit despite the working tree being correct. This commit contains the real diff. Co-Authored-By: Claude Sonnet 5 --- .../versions/019_agent_policy_schema.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/backend/alembic/versions/019_agent_policy_schema.py b/backend/alembic/versions/019_agent_policy_schema.py index 2f4adb9d..275c8bce 100644 --- a/backend/alembic/versions/019_agent_policy_schema.py +++ b/backend/alembic/versions/019_agent_policy_schema.py @@ -1,18 +1,29 @@ """agent_policy_schema -Revision ID: 010 -Revises: 009 +Revision ID: 019 +Revises: 018 Create Date: 2026-08-14 Part of Track 2: Policy-Aware Crew Orchestrator. + +Originally authored as revision "010" off "009", in parallel with +010_add_access_provisions_event_id.py (also off "009") -- both branches +merged to main without either being rebased, leaving two migrations +claiming the same revision id and Alembic unable to resolve a single head +("Multiple head revisions are present for given argument 'head'"). +Renumbered to 019 and re-chained after 018 (the actual tip of the other +branch) to restore a single linear history. This migration is fully +self-contained (agent_registry/policy_rules/audit_log, all new tables, +no foreign keys outside itself) so moving it to the tail is safe -- no +other migration references it. """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. -revision = '010' -down_revision = '009' +revision = '019' +down_revision = '018' branch_labels = None depends_on = None