The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(kanban): fence the explicit-board override to unfenced callers
Brooklyn Nicholson387c78c8f7f2
diff --git a/agent/delegation_context.py b/agent/delegation_context.pyindex fac7fb638cb..9528cbd2f35 100644--- a/agent/delegation_context.py+++ b/agent/delegation_context.py@@ -73,6 +73,26 @@ def is_dispatcher_owned_worker_context() -> bool:return not (is_delegated_child_process_context() or _NON_DISPATCHER_OWNED_CONTEXT.get())+def explicit_board_intent_is_pinned() -> bool:+ """Whether an explicit kanban ``board=`` argument must still resolve through+ the dispatcher-injected env pins (``HERMES_KANBAN_DB`` & friends) rather than+ its own board directory.++ True for in-process delegate children, descendants carrying+ :data:`DELEGATED_CHILD_ENV_MARKER`, and dispatched workers+ (``HERMES_KANBAN_TASK`` set). The pins are the "workers physically cannot+ see other boards" isolation, and :func:`kanban_path_is_fenced` checks the+ pinned path / fenced root — an explicit board that resolved elsewhere would+ also escape that fence. Outside these fences an explicit board is the+ caller's own intent and wins.+ """+ if _DELEGATED_CHILD_CONTEXT.get():+ return True+ if os.environ.get(DELEGATED_CHILD_ENV_MARKER):+ return True+ return bool((os.environ.get("HERMES_KANBAN_TASK") or "").strip())++def owned_kanban_task() -> str:"""The board task this execution OWNS: ``HERMES_KANBAN_TASK`` for the dispatcher-ownedworker, ``""`` otherwise. Tool access is not worker identity — a profile can expose thediff --git a/gateway/kanban_watchers.py b/gateway/kanban_watchers.pyindex 2e82473ac50..0d2a832290d 100644--- a/gateway/kanban_watchers.py+++ b/gateway/kanban_watchers.py@@ -122,16 +122,22 @@ class GatewayKanbanWatchersMixin:def _kanban_sub_op(self, board: Optional[str], op: str, sub: dict, **extra: Any) -> None:"""Sync helper (runs in to_thread): call ``kanban_db_notify.<op>`` for one subscription on its board."""+ from hermes_cli import kanban_db as _kbfrom hermes_cli import kanban_db_connect as _kbcfrom hermes_cli import kanban_db_notify as _kbn- conn = _kbc.connect(board=board)- try:- getattr(_kbn, op)(- conn, task_id=sub["task_id"], platform=sub["platform"], chat_id=sub["chat_id"],- thread_id=sub.get("thread_id") or "", **extra,- )- finally:- conn.close()+ # Cursor writes are machine flow: the sub's board slug must resolve+ # through the env pin on a dispatcher-pinned box (same as the notifier+ # tick), or advance/rewind land on a per-slug DB the notifier never+ # reads and cursors silently reset.+ with _kb.pin_first_board_resolution():+ conn = _kbc.connect(board=board)+ try:+ getattr(_kbn, op)(+ conn, task_id=sub["task_id"], platform=sub["platform"], chat_id=sub["chat_id"],+ thread_id=sub.get("thread_id") or "", **extra,+ )+ finally:+ conn.close()def _kanban_advance(self, sub: dict, cursor: int, board: Optional[str] = None) -> None:self._kanban_sub_op(board, "advance_notify_cursor", sub, new_cursor=cursor)diff --git a/gateway/kanban_watchers_dispatcher.py b/gateway/kanban_watchers_dispatcher.pyindex 8c58fcb60c7..c6003a32c43 100644--- a/gateway/kanban_watchers_dispatcher.py+++ b/gateway/kanban_watchers_dispatcher.py@@ -138,7 +138,9 @@ class _KanbanDispatcher:return _board_slugs(self.kb)def board_db_fingerprint(self, slug: str) -> tuple[str, int | None, int | None]:- path = self.kb.kanban_db_path(slug)+ from hermes_cli import kanban_db as _kb+ with _kb.pin_first_board_resolution():+ path = self.kb.kanban_db_path(slug)try:resolved = str(path.expanduser().resolve())except Exception:@@ -185,8 +187,13 @@ class _KanbanDispatcher:try:# No explicit init_db(): connect() runs the migration once per# process (see the matching note in the notifier collector).- conn = _kbc().connect(board=slug)- return _kbd().dispatch_once(conn, board=slug, **kwargs)+ # Pin-first: the tick is machine flow — on a box whose env pins+ # HERMES_KANBAN_DB every enumerated slug must resolve to the pinned+ # file, or the dispatcher reads per-slug DBs nobody writes.+ from hermes_cli import kanban_db as _kb+ with _kb.pin_first_board_resolution():+ conn = _kbc().connect(board=slug)+ return _kbd().dispatch_once(conn, board=slug, **kwargs)except Exception as exc:if self.is_corrupt_board_db_error(exc):self.disabled_corrupt_boards[slug] = (fingerprint, time.monotonic())@@ -221,18 +228,20 @@ class _KanbanDispatcher:"""kbd = _kbd()_review_probe = kbd.review_dispatch_enabled()- for slug in self._board_slugs():- conn = None- try:- conn = _kbc().connect(board=slug)- if kbd.has_spawnable_ready(conn) or (_review_probe and kbd.has_spawnable_review(conn)):- return True- except Exception:- continue- finally:- if conn is not None:- with contextlib.suppress(Exception):- conn.close()+ from hermes_cli import kanban_db as _kb+ with _kb.pin_first_board_resolution():+ for slug in self._board_slugs():+ conn = None+ try:+ conn = _kbc().connect(board=slug)+ if kbd.has_spawnable_ready(conn) or (_review_probe and kbd.has_spawnable_review(conn)):+ return True+ except Exception:+ continue+ finally:+ if conn is not None:+ with contextlib.suppress(Exception):+ conn.close()return Falsedef auto_decompose_tick(self, auto_decompose_per_tick: int) -> int:@@ -248,7 +257,8 @@ class _KanbanDispatcher:return 0attempted = 0successes = 0- with _default_profile_secret_scope():+ from hermes_cli import kanban_db as _kb+ with _default_profile_secret_scope(), _kb.pin_first_board_resolution():for slug in self._board_slugs():if attempted >= auto_decompose_per_tick:breakdiff --git a/gateway/kanban_watchers_notifier.py b/gateway/kanban_watchers_notifier.pyindex 69051c69814..b19ebb01200 100644--- a/gateway/kanban_watchers_notifier.py+++ b/gateway/kanban_watchers_notifier.py@@ -30,6 +30,17 @@ def _kbn():from hermes_cli import kanban_db_notifyreturn kanban_db_notify++def _pin_first():+ """Machine-flow board resolution: env pins outrank the enumerated slug.++ The slug here came from ``list_boards()``, not from a user — on a box whose+ env pins ``HERMES_KANBAN_DB`` every board must resolve to the pinned file+ or the notifier reads per-slug DBs nobody writes (see+ ``kanban_db.pin_first_board_resolution``)."""+ from hermes_cli import kanban_db+ return kanban_db.pin_first_board_resolution()+# "status" covers dashboard drag-drop and `_set_status_direct()`.# ``review_requested`` wakes the origin like a block but is not one;# the task is not archived so later review cycles keep notifying.@@ -243,21 +254,24 @@ class _Collector:logger.debug("kanban notifier: no connected adapters; skipping tick")return self.deliveries# Poll each resolved DB path once: several slugs can map to one DB when- # HERMES_KANBAN_DB pins the board path.+ # HERMES_KANBAN_DB pins the board path. The whole tick resolves pin-first:+ # on a dispatcher-pinned box each enumerated slug must map to the pinned+ # DB, never to that slug's own (empty) physical file.kb = self.kb- seen_db_paths: set[str] = set()- for board_meta in _list_boards(kb):- slug = board_meta.get("slug") or kb.DEFAULT_BOARD- db_path = board_meta.get("db_path")- try:- resolved_db_path = str(Path(db_path).expanduser().resolve()) if db_path else str(kb.kanban_db_path(slug).resolve())- except Exception:- resolved_db_path = f"slug:{slug}"- if resolved_db_path in seen_db_paths:- logger.debug("kanban notifier: skipping duplicate board slug %s for DB %s", slug, resolved_db_path)- continue- seen_db_paths.add(resolved_db_path)- self.collect_board(slug)+ with _pin_first():+ seen_db_paths: set[str] = set()+ for board_meta in _list_boards(kb):+ slug = board_meta.get("slug") or kb.DEFAULT_BOARD+ db_path = board_meta.get("db_path")+ try:+ resolved_db_path = str(Path(db_path).expanduser().resolve()) if db_path else str(kb.kanban_db_path(slug).resolve())+ except Exception:+ resolved_db_path = f"slug:{slug}"+ if resolved_db_path in seen_db_paths:+ logger.debug("kanban notifier: skipping duplicate board slug %s for DB %s", slug, resolved_db_path)+ continue+ seen_db_paths.add(resolved_db_path)+ self.collect_board(slug)return self.deliveriesdef _board_has_subs(self, slug: str) -> bool:diff --git a/hermes_cli/kanban_db.py b/hermes_cli/kanban_db.pyindex f515a3bfc96..0b010c0dbc2 100644--- a/hermes_cli/kanban_db.py+++ b/hermes_cli/kanban_db.py@@ -3,7 +3,10 @@Lives under the shared Hermes root: ``default`` board DB at ``<root>/kanban.db`` (pre-boardsback-compat), other boards at ``<root>/kanban/boards/<slug>/``; a worker on one board never seesanother. Board resolution: ``board=`` arg > ``HERMES_KANBAN_BOARD`` > ``HERMES_KANBAN_DB`` (pins the-file path) > ``<root>/kanban/current`` > ``default``; the dispatcher injects these into workers.+file path) > ``<root>/kanban/current`` > ``default`` — but only for unfenced callers; the dispatcher+injects these into workers, and dispatched workers (``HERMES_KANBAN_TASK``), delegated children and+board-enumerating machine flows (gateway notifier/watcher/dispatcher, ``pin_first_board_resolution``)+always resolve through the pin, so workers physically cannot see other boards.Concurrency: WAL + ``BEGIN IMMEDIATE`` + compare-and-swap on ``tasks.status``/``claim_lock`` —SQLite serializes writers so one claimer wins, losers see zero rows (no retries, no distributedlocks). Schema: tasks, task_links, task_comments, task_events, task_runs, attachments, notify subs.@@ -355,6 +358,32 @@ DEFAULT_BOARD = "default"_CURRENT_BOARD_OVERRIDE: ContextVar[str | None] = ContextVar("hermes_kanban_current_board_override", default=None,)+# Machine flows that enumerate boards (gateway notifier / watcher / dispatcher+# ticks) resolve board paths env-pin-first — see pin_first_board_resolution().+_PIN_FIRST_BOARD_RESOLUTION: ContextVar[bool] = ContextVar(+ "hermes_kanban_pin_first_board_resolution", default=False,+)+++def pin_first_board_resolution():+ """Resolve board paths env-pin-first for machine flows that enumerate boards.++ The gateway notifier, per-subscription cursor writes and the embedded+ dispatcher poll every board slug from ``list_boards()`` — the slug is not+ caller intent, it is an iteration variable. On a box whose environment pins+ ``HERMES_KANBAN_DB`` (the dispatcher default) every slug must map to that+ one pinned file: the notifier dedupes resolved DB paths, and per-slug+ paths read empty boards nobody writes, silently killing wake+ notifications. Explicit cross-board intent (CLI ``--board``, a model+ tool's ``board=``) is a USER property and must never run inside this+ context; with no pin set this context changes nothing.+ """+ token = _PIN_FIRST_BOARD_RESOLUTION.set(True)+ try:+ yield+ finally:+ _PIN_FIRST_BOARD_RESOLUTION.reset(token)@contextlib.contextmanager@@ -493,43 +522,61 @@ def _dir_holds_board(d: Path) -> bool:return (d / "board.json").exists() or (d / "kanban.db").exists()+def _explicit_board_slug(board: Optional[str]) -> Optional[str]:+ """Explicit caller intent: a direct ``board=`` argument, else the scoped+ ``--board`` context (CLI ``hermes kanban --board``, dashboard plugin_api);+ ``None`` when the caller expressed neither."""+ if board is not None:+ return _normalize_board_slug(board)+ # A caller-scoped board (CLI `hermes kanban --board B ...`, dashboard+ # plugin_api) is explicit intent just like a direct board= argument —+ # without this a worker-pinned HERMES_KANBAN_DB silently outranks --board+ # (os-reviewer P1 on PR#107195 / t_11c4afd8).+ ctx = (_CURRENT_BOARD_OVERRIDE.get() or "").strip()+ if ctx:+ try:+ return _normalize_board_slug(ctx)+ except ValueError:+ return None+ return None+++def _explicit_board_intent_pinned() -> bool:+ """Whether an explicit ``board=`` (or scoped ``--board``) must still resolve+ through the ``HERMES_KANBAN_DB``-style env pins instead of its own board dir.++ True for machine flows wrapped in :func:`pin_first_board_resolution` and+ for every execution the dispatcher fences: its own workers (they carry+ ``HERMES_KANBAN_TASK``) and delegated children / descendants (the+ ``HERMES_DELEGATED_CHILD_CONTEXT`` marker). The pins ARE the "workers+ physically cannot see other boards" isolation (5ec6baa), and+ ``agent.delegation_context.kanban_path_is_fenced`` checks the pinned path /+ fenced root — an explicit board that resolved elsewhere would also escape+ that fence."""+ if _PIN_FIRST_BOARD_RESOLUTION.get():+ return True+ from agent.delegation_context import explicit_board_intent_is_pinned+ return explicit_board_intent_is_pinned()++def _board_path(env_var: Optional[str], board: Optional[str], default_parts: tuple[str, ...], leaf: str,) -> Path:- """Shared resolver: explicit ``board`` parameter (when set) takes priority- over any env-var pin; a scoped ``--board`` context (:func:`scoped_current_board`)- is the same explicit caller intent and trumps the env pin too; otherwise the- ``env_var`` override, else legacy ``<root>/<default_parts>`` for the- ``default`` board, else ``board_dir(slug)/leaf``."""- slug = _normalize_board_slug(board)+ """Shared resolver. An explicit ``board=`` argument — or the scoped+ ``--board`` context (:func:`scoped_current_board`) — outranks the ``env_var``+ pin ONLY where no fence applies (see :func:`_explicit_board_intent_pinned`):+ user-facing cross-board intent (CLI ``--board``, a model tool's ``board=``)+ is honored, but machine flows that enumerate boards (gateway notifier /+ watcher / dispatcher ticks) and dispatched or delegated workers keep+ resolving through the pin. Without explicit intent the ``env_var`` override+ pins the file, else legacy ``<root>/<default_parts>`` for the ``default``+ board, else ``board_dir(slug)/leaf``."""+ pin = os.environ.get(env_var, "").strip() if env_var else ""+ slug = _explicit_board_slug(board)+ if pin and (slug is None or _explicit_board_intent_pinned()):+ return Path(pin).expanduser()if slug is None:- # A caller-scoped board (CLI `hermes kanban --board B ...`, dashboard- # plugin_api) is explicit intent just like a direct board= argument —- # it must also trump any ambient env pin, not merely fall through to- # get_current_board() after the env check has already won. Without- # this, a worker-pinned HERMES_KANBAN_DB silently outranks --board- # (os-reviewer P1 on PR#107195 / t_11c4afd8).- ctx = (_CURRENT_BOARD_OVERRIDE.get() or "").strip()- if ctx:- try:- ctx_slug = _normalize_board_slug(ctx)- except ValueError:- ctx_slug = None- if ctx_slug:- slug = ctx_slug- if slug is not None:- # Explicit board parameter (or scoped --board context) trumps- # everything — essential for cross-board routing from MCP-only- # sessions where the env pins one board (HERMES_KANBAN_DB) but the- # caller needs another.- if slug == DEFAULT_BOARD:- return kanban_home().joinpath(*default_parts)- return board_dir(slug) / leaf- if env_var:- override = os.environ.get(env_var, "").strip()- if override:- return Path(override).expanduser()- slug = get_current_board()+ slug = get_current_board()if slug == DEFAULT_BOARD:return kanban_home().joinpath(*default_parts)return board_dir(slug) / leafdiff --git a/tests/hermes_cli/test_kanban_board_path_priority.py b/tests/hermes_cli/test_kanban_board_path_priority.pyindex ea088bcae51..6f7aca483eb 100644--- a/tests/hermes_cli/test_kanban_board_path_priority.py+++ b/tests/hermes_cli/test_kanban_board_path_priority.py@@ -23,6 +23,8 @@ def _clean_env_board(monkeypatch):monkeypatch.delenv("HERMES_KANBAN_DB", raising=False)monkeypatch.delenv("HERMES_KANBAN_BOARD", raising=False)monkeypatch.delenv("HERMES_KANBAN_HOME", raising=False)+ monkeypatch.delenv("HERMES_KANBAN_TASK", raising=False)+ monkeypatch.delenv("HERMES_DELEGATED_CHILD_CONTEXT", raising=False)def test_explicit_board_trumps_kanban_db_env(monkeypatch, tmp_path):@@ -172,3 +174,97 @@ def test_cli_board_flag_trumps_worker_env_pin_end_to_end(monkeypatch, tmp_path):f"--board must not fall through to the worker's env-pinned board, "f"but found the task there too: {own_rows!r}")+++# ---------------------------------------------------------------------------+# Fenced callers keep the pinned path (side-effect screen on PR#131913).+#+# The env pins are the dispatcher's worker isolation (5ec6baa: "workers+# physically cannot see other boards"), and kanban_path_is_fenced checks the+# PINNED path / fenced root. Explicit board intent therefore only outranks the+# pin where no fence applies: a dispatched worker (HERMES_KANBAN_TASK) or a+# delegated child / descendant (HERMES_DELEGATED_CHILD_CONTEXT) passing+# board=<other> must still resolve through the pin, or it would both see and+# write a board outside the dispatcher's fence. Machine flows that enumerate+# boards (gateway notifier / watcher / dispatcher ticks) are fenced the same+# way via kanban_db.pin_first_board_resolution() — the enumerated slug is not+# caller intent.+# ---------------------------------------------------------------------------++def test_dispatched_worker_board_arg_stays_pinned(monkeypatch, tmp_path):+ """A dispatched worker (HERMES_KANBAN_TASK, the dispatcher's own injection)+ cannot resolve its way to another board: each env pin wins over board= for+ its own resolver."""+ pinned = tmp_path / "worker-pinned.db"+ pinned_workspaces = tmp_path / "worker-pinned-workspaces"+ monkeypatch.setenv("HERMES_KANBAN_DB", str(pinned))+ monkeypatch.setenv("HERMES_KANBAN_WORKSPACES_ROOT", str(pinned_workspaces))+ monkeypatch.setenv("HERMES_KANBAN_TASK", "t_3f1c63a5")+ assert kb.kanban_db_path(board="other-board") == pinned+ assert kb.workspaces_root(board="other-board") == pinned_workspaces+++def test_delegated_child_board_arg_stays_pinned(monkeypatch, tmp_path):+ """A delegated child / spawned descendant (HERMES_DELEGATED_CHILD_CONTEXT+ marker) passing an explicit board= resolves through the pin, so+ kanban_path_is_fenced still catches the resolved path."""+ from agent.delegation_context import DELEGATED_CHILD_ENV_MARKER, kanban_path_is_fenced++ pinned = tmp_path / "worker-pinned.db"+ monkeypatch.setenv("HERMES_KANBAN_DB", str(pinned))+ monkeypatch.setenv(DELEGATED_CHILD_ENV_MARKER, str(tmp_path)) # fenced root+ path = kb.kanban_db_path(board="other-board")+ assert path == pinned+ assert kanban_path_is_fenced(path), (+ "the explicit board escaped the dispatcher's pin-based fence"+ )+++def test_pin_first_board_resolution_maps_every_slug_to_the_pin(monkeypatch, tmp_path):+ """Machine flows (gateway notifier/watcher/dispatcher ticks) enumerate board+ slugs; inside pin_first_board_resolution() every slug must map to the+ pinned DB, and with no pin set the context must change nothing."""+ pinned = tmp_path / "pinned.db"+ monkeypatch.setenv("HERMES_KANBAN_DB", str(pinned))+ with kb.pin_first_board_resolution():+ assert kb.kanban_db_path(board="default") == pinned+ assert kb.kanban_db_path(board="sycode-trading") == pinned+ assert kb.kanban_db_path(board=None) == pinned+ # Outside the machine-flow context the explicit board wins again.+ assert "sycode-trading" in str(kb.kanban_db_path(board="sycode-trading"))+++def test_pin_first_board_resolution_without_pin_keeps_explicit_board(monkeypatch, tmp_path):+ """pin_first_board_resolution() is a no-op when no pin is set: multi-board+ notifier/dispatcher ticks on an unpinned box must keep resolving each slug+ to its own physical DB."""+ monkeypatch.delenv("HERMES_KANBAN_DB", raising=False)+ with kb.pin_first_board_resolution():+ assert "sycode-trading" in str(kb.kanban_db_path(board="sycode-trading"))+++def test_notifier_seam_connect_lands_on_pinned_db(monkeypatch, tmp_path):+ """Integration seam (the screen's repro shape): with HERMES_KANBAN_DB+ pinned, the notifier's per-slug connect(board=slug) inside the machine-flow+ context must open the pinned DB — the writes the worker made via+ connect() (no board) live there."""+ from hermes_cli import kanban_db_connect as kbc++ home = tmp_path / ".hermes"+ home.mkdir()+ monkeypatch.setenv("HERMES_HOME", str(home))+ monkeypatch.setattr(Path, "home", lambda: tmp_path)+ pinned = tmp_path / "board.db"+ monkeypatch.setenv("HERMES_KANBAN_DB", str(pinned))+ kb.init_db()+ with kbc.connect() as conn: # what the dispatcher/notifier box writes+ kb.create_task(conn, title="pinned task", assignee="worker")+ # The notifier polls every enumerated slug; before the fix this opened+ # each slug's own (empty) DB and found nothing.+ with kb.pin_first_board_resolution():+ for slug in ("default", "some-other-board"):+ with kbc.connect(board=slug) as conn:+ rows = conn.execute("SELECT title FROM tasks").fetchall()+ assert any(r[0] == "pinned task" for r in rows), (+ f"per-slug connect lost the pinned DB for board={slug!r}"+ )diff --git a/tests/hermes_cli/test_kanban_boards.py b/tests/hermes_cli/test_kanban_boards.pyindex 9576d132e8f..d2888fa45e0 100644--- a/tests/hermes_cli/test_kanban_boards.py+++ b/tests/hermes_cli/test_kanban_boards.py@@ -100,6 +100,27 @@ class TestPathResolution:assert p == fresh_home / "kanban" / "boards" / "atm10-server" / "kanban.db"+ def test_env_var_db_override_still_wins(self, fresh_home, tmp_path, monkeypatch):+ """``HERMES_KANBAN_DB`` pins the file regardless of ``board=`` arg for every+ execution the dispatcher fences (the 5ec6baa multi-boards isolation: workers+ physically cannot see other boards): its dispatched workers (``HERMES_KANBAN_TASK``)+ and delegated children / descendants (``HERMES_DELEGATED_CHILD_CONTEXT``). An+ explicit board that outranked the pin would also escape+ ``kanban_path_is_fenced``, which checks the pinned path / fenced root. Outside+ those fences an explicit board is the caller's own intent and wins (see+ ``test_explicit_board_trumps_env_var_db_override`` below)."""+ forced = tmp_path / "custom.db"+ monkeypatch.setenv("HERMES_KANBAN_DB", str(forced))+ assert kb.kanban_db_path() == forced+ assert kb.kanban_db_path(board=None) == forced+ # Dispatched worker identity: the pin still fences explicit board intent.+ monkeypatch.setenv("HERMES_KANBAN_TASK", "t_fence_probe")+ assert kb.kanban_db_path(board="ignored") == forced+ # Delegated children / spawned descendants are fenced the same way.+ from agent.delegation_context import DELEGATED_CHILD_ENV_MARKER+ monkeypatch.setenv(DELEGATED_CHILD_ENV_MARKER, "1")+ assert kb.kanban_db_path(board="ignored") == forced+def test_env_var_db_override_wins_when_board_not_passed(self, fresh_home, tmp_path, monkeypatch):"""``HERMES_KANBAN_DB`` pins the file when no explicit ``board=`` is given(back-compat for dispatcher-spawned workers with no board override)."""@@ -111,11 +132,12 @@ class TestPathResolution:def test_explicit_board_trumps_env_var_db_override(self, fresh_home, tmp_path, monkeypatch):"""Documented priority (module docstring, predates this test): explicit``board=`` arg > ``HERMES_KANBAN_BOARD`` > ``HERMES_KANBAN_DB`` > current >- default. An explicit ``board=`` must resolve to that board's own path even- when ``HERMES_KANBAN_DB`` pins a different file — this is the exact shape- every MCP-only / dispatcher-spawned kanban worker runs with, and is what- makes cross-board ``kanban_create(board=...)`` / ``kanban_show(board=...)``- work instead of silently landing on the worker's own pinned board (t_3f1c63a5)."""+ default — for UNFENCED callers. An explicit ``board=`` must resolve to that+ board's own path even when ``HERMES_KANBAN_DB`` pins a different file: this is+ what makes cross-board ``kanban_create(board=...)`` / ``kanban_show(board=...)``+ work from a user-facing session instead of silently landing on the pinned board+ (t_3f1c63a5). Fenced callers (dispatched workers, delegated children) keep the+ pinned path — see ``test_env_var_db_override_still_wins`` above."""forced = tmp_path / "custom.db"monkeypatch.setenv("HERMES_KANBAN_DB", str(forced))p = kb.kanban_db_path(board="atm10-server")