fix(kanban): emit blocked event for initial_status="blocked" tasks (fixes #47777) - #48437
Closed
ochsec wants to merge 1 commit into
Closed
fix(kanban): emit blocked event for initial_status="blocked" tasks (fixes #47777)#48437ochsec wants to merge 1 commit into
ochsec wants to merge 1 commit into
Conversation
Collaborator
|
Duplicate of #34735 — both PRs fix #47777 with the identical mechanism: in |
tonydwb
approved these changes
Jun 18, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Looks Good
- Correct root cause identified: Tasks created with initial_status=blocked had no blocked event in task_events, so _has_sticky_block() returned False and the task was auto-promoted to ready
- Minimal, targeted fix: 5-line addition to create_task() emits the missing blocked event when task_status == blocked
- Good regression tests: 3 new tests covering the sticky-blocked behavior from creation, including parent-completion and unblock paths
- Security note: Fixes a data-integrity issue where tasks could be auto-promoted and auto-completed with fabricated human approvals within seconds of creation
- No debug artifacts or secrets
Reviewed by Hermes Agent
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #47777
Problem
A task created with
initial_status="blocked"is auto-promoted toreadyon the next dispatch tick (≤60s) becauserecompute_ready()calls_has_sticky_block(), which looks for a"blocked"event intask_events. No such event is emitted at creation time, so_has_sticky_block()returnsFalseand the task is promoted — even though its status isblocked. This can cause unwanted worker spawns and, in the worst case, fabricated human approvals for decision records (as described in the issue).Root Cause
In
create_task()(hermes_cli/kanban_db.py), wheninitial_status="blocked"is passed, the task row getsstatus='blocked'but only a"created"event is appended totask_events. The"blocked"event is never emitted. By contrast,kanban_block()(the explicit block path) does emit a"blocked"event, so explicitly-blocked tasks are correctly treated as sticky-blocked by_has_sticky_block(). Created-blocked tasks diverge purely because of this missing event row.Fix
After the
"created"event increate_task(), emit a"blocked"event whentask_status == "blocked":This ensures created-blocked tasks are treated identically to explicitly-blocked tasks by
_has_sticky_block()andrecompute_ready(). Only an explicitunblock_task()releases them.Changes
hermes_cli/kanban_db.py—create_task(): emit"blocked"event wheninitial_status="blocked"(5 lines added)tests/hermes_cli/test_kanban_blocked_sticky.py— 3 new regression tests:test_created_blocked_task_stays_blocked— standalone blocked task survives 5 recompute tickstest_created_blocked_with_done_parents_stays_blocked— blocked child with done parents stays blockedtest_created_blocked_can_be_unblocked— explicit unblock works and promotes correctlyImpact
recompute_ready()logic or any existing behavior for non-blocked tasks, explicitly-blocked tasks, or normaltodo → readypromotion.unblock_task()call.test_kanban_blocked_sticky.pypass.