From afae2dd9ecf373a0f5505f9f32003d1bcf2dba0e Mon Sep 17 00:00:00 2001 From: QuenVix <164776164+QuenVix@users.noreply.github.com> Date: Mon, 18 May 2026 20:14:21 -0700 Subject: [PATCH] fix(kanban): keep board-management commands independent from board override --- hermes_cli/kanban.py | 17 ++++++++--------- tests/hermes_cli/test_kanban_cli.py | 10 ++++++++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/hermes_cli/kanban.py b/hermes_cli/kanban.py index fa198a7dd2..a0e9d656b8 100644 --- a/hermes_cli/kanban.py +++ b/hermes_cli/kanban.py @@ -692,6 +692,14 @@ def kanban_command(args: argparse.Namespace) -> int: ) return 0 + # Board-management commands operate on board metadata and the persisted + # current-board pointer itself. They must ignore the shared `--board` + # task-routing override; otherwise `/kanban --board beta boards show` + # reports beta as the current board even when the on-disk pointer is + # alpha. + if action == "boards": + return _dispatch_boards(args) + # `--board ` applies to every subcommand below by way of an # env-var pin for the duration of this call. Using HERMES_KANBAN_BOARD # (rather than threading `board=` through 50+ kb.connect() sites) @@ -729,15 +737,6 @@ def kanban_command(args: argparse.Namespace) -> int: os.environ["HERMES_KANBAN_BOARD"] = normed restore_board_env = True - # Boards management doesn't touch the DB at all — dispatch early so - # fresh installs that haven't initialized any DB can still use - # `hermes kanban boards create …`. - if action == "boards": - try: - return _dispatch_boards(args) - finally: - _restore_board_env() - # Auto-initialize the DB before dispatching any subcommand. init_db # is idempotent, so running it every invocation is cheap (one # SELECT against sqlite_master when tables already exist) and diff --git a/tests/hermes_cli/test_kanban_cli.py b/tests/hermes_cli/test_kanban_cli.py index 241016a25d..7aaa46a619 100644 --- a/tests/hermes_cli/test_kanban_cli.py +++ b/tests/hermes_cli/test_kanban_cli.py @@ -402,3 +402,13 @@ def test_run_slash_board_override_restores_prior_env(kanban_home, monkeypatch): kc.run_slash("--board alpha list") assert os.environ.get("HERMES_KANBAN_BOARD") == "beta" + + +def test_run_slash_board_override_does_not_change_boards_show_current(kanban_home): + kb.create_board("alpha") + kb.create_board("beta") + kb.set_current_board("alpha") + + out = kc.run_slash("--board beta boards show") + + assert "Current board: alpha" in out