Skip to content

fix(kanban): create additive-column indexes after migration#28741

Closed
stormhierta wants to merge 1 commit into
NousResearch:mainfrom
stormhierta:fix/kanban-session-index-migration
Closed

fix(kanban): create additive-column indexes after migration#28741
stormhierta wants to merge 1 commit into
NousResearch:mainfrom
stormhierta:fix/kanban-session-index-migration

Conversation

@stormhierta

Copy link
Copy Markdown

Summary

  • move indexes for additive Kanban columns out of SCHEMA_SQL
  • create idx_tasks_session_id and idx_events_run after their columns are guaranteed to exist in _migrate_add_optional_columns
  • add regression coverage for both fresh board initialization and legacy board migration

Bug

Existing Kanban boards can fail during connect() with:

sqlite3.OperationalError: no such column: session_id

The session_id feature added tasks.session_id as an additive column, but SCHEMA_SQL also attempted to create idx_tasks_session_id ON tasks(session_id) before the additive migration ran. On an existing DB, CREATE TABLE IF NOT EXISTS tasks (...) is a no-op, so the old table still lacks session_id when the index statement executes.

idx_events_run ON task_events(run_id, id) had the same migration-order hazard for legacy boards missing task_events.run_id.

Fix

Keep additive-column indexes out of the global schema script and create them after the additive column migration has run.

Test Plan

  • /home/stormhierta/.hermes/hermes-agent/venv/bin/python -m pytest tests/hermes_cli/test_kanban_db_init.py -q

@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels May 19, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #28461 — same fix (move additive-column index creation after migration). See also #28602 for a broader scope variant.

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Thanks @stormhierta — closing as duplicate of #28781, which combined all six community PRs that hit this bug on 2026-05-19 into one salvage (merged in 7552e0f). You correctly diagnosed the SCHEMA_SQL-before-migration ordering issue. The salvage extends coverage to all four additive-column indexes (idx_tasks_session_id, idx_tasks_tenant, idx_tasks_idempotency, idx_events_run) and ships a regression test seeding a pre-#16081 + pre-#17805 fixture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants