Skip to content

fix(cli): validate kanban current-board pointer to stop silent synth/create - #20069

Closed
konsisumer wants to merge 1 commit into
NousResearch:mainfrom
konsisumer:fix/kanban-stale-current-board-pointer
Closed

fix(cli): validate kanban current-board pointer to stop silent synth/create#20069
konsisumer wants to merge 1 commit into
NousResearch:mainfrom
konsisumer:fix/kanban-stale-current-board-pointer

Conversation

@konsisumer

Copy link
Copy Markdown
Contributor

Stop kanban from silently synthesizing/creating a board when <root>/kanban/current points at a missing slug.

What changed and why

  • hermes_cli/kanban_db.py::get_current_board() now validates the on-disk pointer via board_exists() and falls back to default (with a deduped stderr warning) when the slug doesn't resolve. Previously the slug was returned unchecked, so downstream kb.connect() calls would mkdir the board directory and sqlite3.connect() would create the DB file — making the missing slug appear in boards list as a real, active workspace and hiding the user's real boards behind a synthetic empty one.
  • The pointer file itself is left in place. Users can recover their selection by running hermes kanban boards create <slug> and the next read honours the pointer again.
  • HERMES_KANBAN_BOARD env-var resolution is intentionally not validated: it's written by the dispatcher on worker spawn (which already knows the board exists), so a runtime existence check there would only mask dispatcher bugs.
  • Added five unit tests in tests/hermes_cli/test_kanban_boards.py::TestStaleCurrentBoardPointer covering: fallback to default, warning dedupe within a process, no implicit board-directory creation through kb.connect(), recovery via boards create, and absence from list_boards().

How to test

  • Reproduce the issue's exact scenario:
    tmp=$(mktemp -d)
    mkdir -p "$tmp/kanban"
    printf 'missing-board\n' > "$tmp/kanban/current"
    HERMES_HOME="$tmp" hermes kanban boards show
    HERMES_HOME="$tmp" hermes kanban stats
    HERMES_HOME="$tmp" hermes kanban list
    HERMES_HOME="$tmp" hermes kanban boards list
    find "$tmp/kanban" -mindepth 1
    After the fix, every command emits the stale-pointer warning and reports default. kanban/boards/missing-board/ is never created.
  • Run the kanban suite: pytest tests/hermes_cli/test_kanban_boards.py -q (54 passed locally).

What platforms tested on

  • macOS on darwin-arm64 (local)

Fixes #20055

…create

A stale `<root>/kanban/current` (e.g. board removed outside `boards rm`,
slug typo, hand edit) was being trusted by `get_current_board()` without
checking that the board existed. Read-only commands (`stats`, `list`,
`boards list`, `boards show`) then resolved the active board through
that slug and called `kb.connect()`, whose `path.parent.mkdir(...)` plus
`sqlite3.connect()` materialized an empty board directory + DB on disk.
The synthetic board then surfaced in `boards list` as if it were a real
active workspace, making the user's real boards look like they had
silently lost their tasks.

`get_current_board()` now validates the file pointer via `board_exists()`
and falls back to `default` with a stderr warning when the slug doesn't
resolve. The pointer file is left in place so users can recover their
selection by running `hermes kanban boards create <slug>` — the next
read then honours the pointer again. The warning is deduped per process
to avoid double-printing within a single CLI invocation.

The `HERMES_KANBAN_BOARD` env-var path is intentionally untouched: it's
written by the dispatcher on worker spawn (which already knows the board
exists), so adding a runtime existence check there would only mask
dispatcher bugs.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard labels May 5, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #20063 — both fix the same stale current-board pointer issue (#20055) with fallback-to-default approach.

@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #20063 — both fix the same stale current-board pointer issue (#20055).

@konsisumer

Copy link
Copy Markdown
Contributor Author

Closing — deferring to #20063 by @steezkelly which addresses the same. Reopen if that PR stalls.

@konsisumer konsisumer closed this May 5, 2026
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 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.

Kanban should not silently synthesize/create boards from a stale current-board pointer

2 participants