Repository navigation
Umbrella: data-layer — Alembic chain repair + schema/ORM sync (blocks RBAC → enterprise) #9920
Description
Activity
- addedumbrellaEpic/umbrella tracking issue grouping member issuesEpic/umbrella tracking issue grouping member issues
on Jun 11, 2026 Status: both members implemented — PRs open
- Broken Alembic migration chain: KeyError '20260216_002' — fresh-DB upgrade impossible #9759 (keystone) → PR fix(backend): repair Alembic chain + compose migration bootstrap — fresh-DB upgrade now reaches head (#9759) #9988: the previously-repaired chain (KeyError/heads/env.py) was necessary but not sufficient — actually running
alembic upgrade headon a fresh Postgres 16 surfaced 4 more failure classes (002 alters a create_all-onlysecretstable; 018 alters 5 more create_all-only tables; 022/027/030/031/032/036 re-emit CREATE TYPE because genericsa.Enumsilently ignorescreate_type=False; 047 duplicate index), plus the async/sync driver mismatch in env.py. All fixed; fresh-DB upgrade verified to head20260608_053(68 tables), idempotent re-run, legacy create_all DB path also verified. Compose now runsalembic upgrade headin the backend entrypoint for Postgres-backed modes — flippingAUTOBOT_USER_MODE=single_companyis a single-var change. - bug(llc): AgentOrgNode ORM model is out of sync with agent_org_nodes migration columns #9899 → PR fix(backend): sync AgentOrgNode and Secret ORM models with their migration columns (#9899) #9989: real gap was 9 columns (issue listed 6; also
context_mode,last_heartbeat_at,pre_pause_status) +Secret.workflow_id(bug(backend): Secret ORM model missing workflow_id column added by migration 20260324_017 #9975). Verified model-built vs migration-built schemas column-identical. Merge after fix(backend): repair Alembic chain + compose migration bootstrap — fresh-DB upgrade now reaches head (#9759) #9988.
Discoveries filed: #9975 (Secret.workflow_id — fixed in #9989), #9980 (LLC models'
sa.Enum(PythonEnum)emits member NAMES vs migrations' lowercase values — create_all/migration enum mismatch, 10 columns affected).- Broken Alembic migration chain: KeyError '20260216_002' — fresh-DB upgrade impossible #9759 (keystone) → PR fix(backend): repair Alembic chain + compose migration bootstrap — fresh-DB upgrade now reaches head (#9759) #9988: the previously-repaired chain (KeyError/heads/env.py) was necessary but not sufficient — actually running
Umbrella complete — both members merged and closed
- Broken Alembic migration chain: KeyError '20260216_002' — fresh-DB upgrade impossible #9759 → PR fix(backend): repair Alembic chain + compose migration bootstrap — fresh-DB upgrade now reaches head (#9759) #9988 merged (
afd58590d): fresh-DBalembic upgrade headverified green end-to-end; compose backend entrypoint bootstraps the schema for Postgres-backed modes. RBAC fresh-DB bootstrap is unblocked —AUTOBOT_USER_MODE=single_companyis now a single-var flip. - bug(llc): AgentOrgNode ORM model is out of sync with agent_org_nodes migration columns #9899 → PR fix(backend): sync AgentOrgNode and Secret ORM models with their migration columns (#9899) #9989 merged (
712cf1059):AgentOrgNode(9 columns) andSecret(workflow_id, bug(backend): Secret ORM model missing workflow_id column added by migration 20260324_017 #9975) now match their migrations; model-built vs migration-built schemas verified column-identical.
Follow-up discovery left open: #9980 (LLC models'
sa.Enum(PythonEnum)emits member NAMES vs migrations' lowercase values — 10 columns).- Broken Alembic migration chain: KeyError '20260216_002' — fresh-DB upgrade impossible #9759 → PR fix(backend): repair Alembic chain + compose migration bootstrap — fresh-DB upgrade now reaches head (#9759) #9988 merged (
Post-closure audit (session close-out) surfaced two more gaps in the same family, filed as:
- bug(ansible): backend Alembic migration tasks silently fail — no alembic.ini at chdir + failed_when:false swallows the error #10001 — bug(ansible): both native backend-migration tasks invoke alembic without
-c migrations/alembic.ini(no config at chdir) andfailed_when: falseswallows the failure — native Postgres-backed deploys have likely never migrated. Compose is covered by fix(backend): repair Alembic chain + compose migration bootstrap — fresh-DB upgrade now reaches head (#9759) #9988's entrypoint; native needs this fix before relying on fix(backend): sync AgentOrgNode and Secret ORM models with their migration columns (#9899) #9989's ORM columns. - ci: add fresh-database alembic-upgrade gate — nothing in CI runs the migration chain against a clean Postgres #10002 — ci: add a fresh-Postgres
alembic upgrade headgate — none of the five failure classes fixed in fix(backend): repair Alembic chain + compose migration bootstrap — fresh-DB upgrade now reaches head (#9759) #9988 was CI-detectable; this prevents recurrence.
Already filed during implementation: #9975 (closed via #9989), #9980 (open).
- bug(ansible): backend Alembic migration tasks silently fail — no alembic.ini at chdir + failed_when:false swallows the error #10001 — bug(ansible): both native backend-migration tasks invoke alembic without
Reopened: umbrella epics close only by explicit human decision, not by PR keywords or task-list completion.
- added a commit that references this issue
on Jun 12, 2026 - added a commit that references this issue
on Jun 21, 2026 Data-layer umbrella — all members closed ✅ (recommend close)
Every member of #9920 (Alembic chain repair + schema/ORM sync) is now merged & closed:
Member What Landed #10027 Shared alembic guard helpers ( has_table/ensure_pg_enum…) across 002/018/6 LLC migrations#10072 4c8b019b6#9980 values_callable=pg_enum_valueson 11 LLC enum columns (repairs ORM read path)#10077 57e9fa625#10001 Ansible Alembic tasks silently failing (no -c, swallowed errors)#10039 #10002 Fresh-DB alembic-upgrade CI gate #10039 #10026 Legacy-DB upgrade-path gate — case 1 stamped-intermediate, case 3 unstamped→baseline-adoption (#10039), case 2 naive-timestamp 018 conversion (#10368 74fbbeefa)#10039 + #10368 The repaired chain now upgrades cleanly from every reachable fleet state (fresh, intermediate-stamp, naive-timestamp, unstamped-populated), all gated in migration-matrix CI; the enum NAMES/values mismatch is fixed; and the strict Ansible invocation + baseline-adoption entrypoint protect never-migrated native deploys. Data-layer work complete — recommend closing #9920 (umbrellas are human-closed).
Data-layer umbrella COMPLETE — closing
All members merged & closed: #9759, #9899, #9980 (#10077), #10027 (#10072), #10001 + #10002 + #10026 (#10039 + #10368), #10043, #10075, #10076. The repaired Alembic chain upgrades cleanly from every reachable fleet state (fresh / intermediate-stamp / naive-timestamp / unstamped-populated), all gated in migration-matrix CI; enum NAMES/values fixed; strict Ansible invocation + baseline-adoption protect never-migrated native deploys. Data-layer foundation done — it unblocked the RBAC/secrets sub-umbrellas (#10088 well underway, #10193 PRD-stage).
- added sub-issues
on Sep 1, 2026
Mission
Repair and harden the schema/migration layer so a fresh database upgrades cleanly and ORM models match their migrations. The broken Alembic chain (#9759) is the keystone: it makes fresh-DB upgrades impossible, which blocks RBAC bootstrap, which blocks the enterprise tier. Fix the chain (divergent heads, id mismatch, env.py), then bring out-of-sync ORM models into alignment with their migration columns.
Dependency edges
Members (sized)
LAgentOrgNodeORM model out of sync withagent_org_nodesmigration columnsMNote: RBAC fresh-DB schema bootstrap (
secretstable only via create_all, not migrations) is tracked under #9759's remediation per the compose out-of-box notes.Triage delta — 2026-06-12 (new members, post-close follow-ups)
M→ PR fix(llc): sa.Enum columns emit member VALUES not NAMES via values_callable (#9980) #10077S(blocked-by test(migrations): legacy-DB upgrade-path gate for repaired Alembic chain — intermediate stamps, naive-timestamp 018 skip, unstamped populated DBs (#9988 follow-up) #10026 in U1 Umbrella: deployment-install — compose, secrets, service-auth, single_user gating, upgrade migrations #9919 — legacy gate must land first)MM→ PR consolidation(migrations): shared alembic guard helpers — has_table/has_column/ensure_pg_enum (#10027) #10072 (full-chain DDL byte-identical, sha-verified). Note: enum values kept literal in migrations by design — no shared registry; bug(llc): sa.Enum(PythonEnum) in LLC models emits member NAMES, not values — create_all-built enum types mismatch migrations #9980 fixed model-side instead.- [ ] bug(migrations): llc_work_products + llc_work_item_relations have no creating migration — fresh migration-built DBs lack both tables once create_all faucet closes #10043 — llc_work_products + llc_work_item_relations have NO creating migration — surfaced by consolidation(migrations): shared alembic guard helpers — has_table/has_column/ensure_pg_enum dup'd inline across 002/018 + 6 LLC migrations and SLM utils.py #10027 inventory; becomes a fresh-DB 500 once the bug(ansible): backend Alembic migration tasks silently fail — no alembic.ini at chdir + failed_when:false swallows the error #10001 create_all faucet close mergesMDiscoveries — 2026-06-13 (from #10027/#9980 verification)
MSSTriage delta — 2026-06-21