Skip to content

fix(kanban): guard corrupted board DB auto-init (Fixes #30687)#30701

Open
deepujain wants to merge 1 commit into
NousResearch:mainfrom
deepujain:fix/30687-kanban-db-corruption-guard
Open

fix(kanban): guard corrupted board DB auto-init (Fixes #30687)#30701
deepujain wants to merge 1 commit into
NousResearch:mainfrom
deepujain:fix/30687-kanban-db-corruption-guard

Conversation

@deepujain

Copy link
Copy Markdown

Summary

Fixes #30687.

Kanban command startup still auto-initializes the DB so fresh installs work, but that same path was unsafe for an existing board whose DB had been truncated or replaced with a schema-less SQLite file. In that case connect() could create the full schema and let commands continue against an empty board.

This change adds a DB-open guard before schema creation:

  • existing zero-byte Kanban DBs fail with a clear error instead of being initialized
  • existing SQLite files that are missing the required tasks table fail before CREATE TABLE IF NOT EXISTS
  • known named boards whose DB path is missing fail during automatic command startup
  • hermes kanban init and create_board() pass an explicit allow_recreate flag, so deliberate initialization still works

The check also catches the risky alternate/top-level DB case: an existing current board plus an empty HERMES_KANBAN_DB target no longer becomes a new empty board by accident.

Tests

  • scripts/run_tests.sh tests/hermes_cli/test_kanban_db.py tests/hermes_cli/test_kanban_boards.py
    • 221 passed
  • /Users/dejain/nvidia/oss/hermes-agent/.venv/bin/ruff check hermes_cli/kanban.py hermes_cli/kanban_db.py tests/hermes_cli/test_kanban_db.py tests/hermes_cli/test_kanban_boards.py
    • passed

Notes

  • Platform tested: macOS local dev environment.
  • This does not attempt SQLite page recovery or backups; it only prevents the silent auto-recreation path and leaves explicit recovery/init decisions to the user.

@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists labels May 23, 2026
@deepujain deepujain marked this pull request as ready for review May 23, 2026 02:21
@deepujain deepujain force-pushed the fix/30687-kanban-db-corruption-guard branch from a17c4e6 to 13456b7 Compare June 2, 2026 22:18
@deepujain

deepujain commented Jun 2, 2026

Copy link
Copy Markdown
Author

@teknium1 Updated this PR again against current main and resolved the new hermes_cli/kanban.py conflict by keeping both behaviors: scoped board context from main, plus skipping pre-dispatch auto-init for the explicit kanban init path. GitHub now reports the PR as mergeable. Focused validation: scripts/run_tests.sh tests/hermes_cli/test_kanban_db.py tests/hermes_cli/test_kanban_boards.py passed, 273/273. I still cannot formally request review because GitHub says this account lacks RequestReviewsByLogin permission on this repo. Could you approve any pending workflow run and review when you have a chance?

@deepujain deepujain force-pushed the fix/30687-kanban-db-corruption-guard branch from 13456b7 to 0d0c2b0 Compare June 7, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kanban: corrupted board DB + empty top-level DB → silent recreation with total data loss

2 participants