Skip to content

fix(kanban): isolate board override per concurrent call#38325

Closed
worlldz wants to merge 1 commit into
NousResearch:mainfrom
worlldz:fix-kanban-board-override-race
Closed

fix(kanban): isolate board override per concurrent call#38325
worlldz wants to merge 1 commit into
NousResearch:mainfrom
worlldz:fix-kanban-board-override-race

Conversation

@worlldz

@worlldz worlldz commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #38323

hermes kanban --board <slug> ... was pinning the requested board by mutating the process-global HERMES_KANBAN_BOARD environment variable for the duration of the call.

That works in single-threaded use, but it is not safe when multiple kanban calls run concurrently in the same process. A second call can overwrite the board pin while the first call is still in progress, which makes writes land on the wrong board.

This patch replaces the in-process board override with a context-local override, while keeping the environment-variable path available for spawned worker processes and explicit external overrides.

It also adds a regression test that runs two concurrent kanban --board ... create calls in the same process and verifies that each task lands on the correct board.

Validation:
uv run --extra dev pytest tests/hermes_cli/test_kanban_cli.py -q -k 'board_override_is_isolated_per_concurrent_call or run_slash_link_unlink'

Result:
2 passed, 45 deselected in 2.60s

Live repro on current main before fix:
{'alpha_titles': [], 'beta_titles': ['beta-task', 'alpha-task']}

Live repro after fix:
{'alpha_titles': ['alpha-task'], 'beta_titles': ['beta-task']}

@worlldz worlldz force-pushed the fix-kanban-board-override-race branch from df46c6e to 90429d4 Compare June 3, 2026 15:56
@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 Jun 3, 2026
@teknium1

teknium1 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Merged via #39074. Your commit was cherry-picked onto current main with your authorship preserved (081694c11).

On top of your CLI fix, we widened the same scoped_current_board() contextvar to two sibling sites that had the identical bug class — the dashboard specify and decompose FastAPI threadpool endpoints, which were also mutating the process-global HERMES_KANBAN_BOARD env var and would cross-write under concurrent requests. Thanks for the clean fix and the barrier-based repro test.

@teknium1 teknium1 closed this Jun 4, 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.

[Bug]: kanban --board uses process-global state and can cross-write tasks under concurrent calls

3 participants