fix(kanban): call recompute_ready after unlink_tasks removes a dependency#22646
Closed
wesleysimplicio wants to merge 1 commit into
Closed
fix(kanban): call recompute_ready after unlink_tasks removes a dependency#22646wesleysimplicio wants to merge 1 commit into
wesleysimplicio wants to merge 1 commit into
Conversation
…ency Problem: unlink_tasks() removes a parent→child dependency edge but does not trigger recompute_ready(). A child whose last blocking parent is unlinked stays stuck in 'todo' indefinitely — it only promotes to 'ready' on the next dispatcher tick or a manual 'hermes kanban recompute'. For CLI-only users without a dispatcher, the child is permanently stuck. Root cause: complete_task() and unblock_task() both call recompute_ready() after their write transaction so downstream children are evaluated immediately. unlink_tasks() was missing this call — removing a dependency is semantically equivalent to completing one, so the same recompute is needed. Fix: Capture the rowcount result before the write_txn exits, then call recompute_ready(conn) outside the transaction when a row was actually deleted (so the child sees the updated task_links state). Tests: Added test_unlink_tasks_triggers_recompute_ready in tests/hermes_cli/test_kanban_db.py: creates parent A (done) + parent C (running), child B with both parents (todo), unlinks C→B, asserts B is ready immediately. Stash-verified: FAILS without fix (child stays todo), PASSES with fix. 62/62 tests green in tests/hermes_cli/test_kanban_db.py. Closes NousResearch#22459.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a Kanban dependency-resolution bug where unlink_tasks() removed a parent→child edge but did not immediately re-evaluate todo → ready promotions, leaving tasks stuck for CLI-only users (no dispatcher).
Changes:
- Update
unlink_tasks()to callrecompute_ready(conn)after the write transaction when a link row was actually deleted. - Add a regression test covering the “unlink last blocking dependency promotes child to ready immediately” behavior (issue #22459).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
hermes_cli/kanban_db.py |
Triggers recompute_ready() after successfully unlinking a dependency edge so readiness updates immediately. |
tests/hermes_cli/test_kanban_db.py |
Adds a regression test ensuring unlink_tasks() promotes a child to ready when its remaining parents are all done. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
Merged via salvage PR #22669. Your commit was cherry-picked onto current main with your authorship preserved in git log (rebase-merge). Thanks for the contribution! |
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.
Problem
unlink_tasks()removes a parent→child dependency edge but does not callrecompute_ready(). A child whose last blocking parent is unlinked stays stuck intodoindefinitely — it only promotes toreadyon the next dispatcher tick or a manualhermes kanban recompute. For CLI-only users without a dispatcher, the task is permanently stuck.Root cause
complete_task()andunblock_task()both callrecompute_ready(conn)after their write transaction so downstream children are evaluated immediately.unlink_tasks()was missing this call — removing a dependency edge is semantically equivalent to completing one, so the same recompute is required.Fix
Capture the
rowcountresult before thewrite_txncontext manager exits, then callrecompute_ready(conn)outside the transaction when a row was actually deleted (so the child sees the updatedtask_linksstate):Tests
Added
test_unlink_tasks_triggers_recompute_readyintests/hermes_cli/test_kanban_db.py:todounlink_tasks(C, B)→ asserts B isreadyimmediatelyStash-verified: FAILS without fix (child stays
todo), PASSES with fix.62/62 tests green in
tests/hermes_cli/test_kanban_db.py.Closes #22459.