Skip to content

fix(kanban): make --initial-status blocked sticky from birth - #91180

Open
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:liuhao/cron-bugfix-91178
Open

fix(kanban): make --initial-status blocked sticky from birth#91180
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:liuhao/cron-bugfix-91178

Conversation

@liuhao1024

Copy link
Copy Markdown
Contributor

What does this PR do?

Makes hermes kanban create --initial-status blocked actually 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_ready therefore treated it as event-less and auto-promoted it through promoted → 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-create hermes kanban block did 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_task writes (reason/kind/recurrences/source_status, plus initial: True to mark the origin), so an initial-blocked task follows the same lifecycle as a post-create block: sticky until an explicit unblock, invisible to the dispatcher's auto-recovery.

Related Issue

Fixes #91178

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

How to Test

  1. .venv/bin/python -m pytest tests/hermes_cli/test_kanban_blocked_sticky.py -q — should pass (5 passed, including the three new)
  2. Observed result: on unmodified main, test_initial_status_blocked_is_not_auto_promoted fails at the first sticky assertion — create_task(..., initial_status="blocked") leaves no "blocked" event row, _has_sticky_block returns False, and recompute_ready promotes the task on the first tick (the kanban task created with --initial-status blocked is promoted and spawned #91178 spawn-past-the-gate shape)
  3. Regression: 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 pass

Checklist

  • Code follows the project's style guidelines
  • Self-review completed
  • Comments added for complex logic (why the event row is required for the sticky gate, and why it is atomic with the create)
  • Tests added that prove the fix (sticky-from-birth + unblock clears + plain tasks stay auto-recover)
  • All new and existing tests pass locally (5 + 4 passed)
  • Platform: macOS (pure DB/event logic, platform-independent)

@alt-glitch alt-glitch added type/bug Something isn't working comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Aug 21, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

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
@liuhao1024
liuhao1024 force-pushed the liuhao/cron-bugfix-91178 branch from 7359be2 to 3c3c654 Compare August 21, 2026 00:18
@liuhao1024

Copy link
Copy Markdown
Contributor Author

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 hermes_cli/kanban_db.py (one event append inside an existing transaction) and tests/hermes_cli/test_kanban_blocked_sticky.py; neither is exercised by an install step.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management duplicate This issue or pull request already exists 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.

kanban task created with --initial-status blocked is promoted and spawned

2 participants