fix(kanban): make --initial-status blocked sticky from birth - #91180
fix(kanban): make --initial-status blocked sticky from birth#91180liuhao1024 wants to merge 1 commit into
Conversation
Duplicate of #34735: both implement the same create-time blocked-event mechanism so initially blocked tasks remain sticky through recompute_ready. |
The sticky-block gate (_has_sticky_block, NousResearch#28712) keys on the latest blocked/unblocked event row, but a task born blocked only wrote the status column — so recompute_ready treated it as event-less and auto-promoted it on the next dispatch tick, spawning an assignee past the activation gate. Emit the block transition atomically with the create, same payload shape as block_task plus initial=True. Fixes NousResearch#91178
7359be2 to
3c3c654
Compare
|
The slice 7/12 failure is an infra flake, not a test failure: the failing step in that job is "Install uv" — the runner failed to install the toolchain before any test executed, and no test name appears in the failure output. The only files this PR touches are I can't re-run checks as an outside contributor, so I've force-pushed a new commit SHA (3c3c654, content-identical to 7359be27a9 — amended committer date only) to trigger a fresh CI run, which is already queued. |
What does this PR do?
Makes
hermes kanban create --initial-status blockedactually stick. The sticky-block gate (_has_sticky_block, from #28712) keys on the latest"blocked"/"unblocked"event row, but a task born blocked only ever wrote the status column — no event row. On the next dispatch tick,recompute_readytherefore treated it as event-less and auto-promoted it throughpromoted → claimed → spawned, starting the assignee ~21s after creation and bypassing exactly the setup/credential/deployment activation gate the caller had expressed (#91178). An explicit post-createhermes kanban blockdid persist, confirming the initial-block path was the only one missing the event.The fix emits the block transition atomically inside the create transaction, with the same payload shape
block_taskwrites (reason/kind/recurrences/source_status, plusinitial: Trueto mark the origin), so an initial-blocked task follows the same lifecycle as a post-create block: sticky until an explicitunblock, invisible to the dispatcher's auto-recovery.Related Issue
Fixes #91178
Type of Change
Changes Made
hermes_cli/kanban_db.py—create_task's post-create hook now appends a"blocked"event row wheninitial_status == "blocked", inside the same write transaction as the create, with the kanban task created with --initial-status blocked is promoted and spawned #91178 rationale documented inlinetests/hermes_cli/test_kanban_blocked_sticky.py— three regressions beside the existing kanban: dispatcher auto-promotes blocked task → respawn worker → protocol_violation loop #28712 sticky tests: an initial-blocked task has a durable sticky event and survives fiverecompute_readyticks un-promoted; an explicitunblockstill clears the gate and returns the task to the normal promotion path; and a plain created task stays event-less (the fix must not make every task sticky)How to Test
.venv/bin/python -m pytest tests/hermes_cli/test_kanban_blocked_sticky.py -q— should pass (5 passed, including the three new)test_initial_status_blocked_is_not_auto_promotedfails at the first sticky assertion —create_task(..., initial_status="blocked")leaves no"blocked"event row,_has_sticky_blockreturns False, andrecompute_readypromotes the task on the first tick (the kanban task created with --initial-status blocked is promoted and spawned #91178 spawn-past-the-gate shape)tests/hermes_cli/test_kanban_block_kinds.py+test_kanban_cli_dispatch_passthrough.py— 4 passed (block-kind routing and dispatch passthrough unchanged); the existing kanban: dispatcher auto-promotes blocked task → respawn worker → protocol_violation loop #28712 worker-block sticky tests still passChecklist