fix(kanban): detect cycles in decompose_triage_task sibling-link pre-validation - #28088
Merged
Conversation
…validation decompose_triage_task inlines SQL INSERTs for atomicity and intentionally bypasses link_tasks() — which calls _would_cycle() per edge. If the LLM emits a cyclic parent graph (e.g. A.parents=[1], B.parents=[0]) the DB write succeeds but every involved child deadlocks in 'todo' forever: recompute_ready() requires all parents to be done, which is impossible when A waits for B and B waits for A. Add a Kahn topological sort over the sibling parent indices in the pre-validation block, before any DB writes. Mirrors the cycle-safety guarantee that link_tasks() provides for manually linked tasks.
2 tasks
Contributor
🔎 Lint report:
|
1 task
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.
Salvage of #28050 by @EloquentBrush0x onto current main.
Summary
decompose_triage_taskinlines INSERTs for atomicity and skipped the cycle check thatlink_tasks()does per-edge via_would_cycle(). A cyclic sibling parent graph (e.g.A.parents=[1],B.parents=[0]) succeeded silently and deadlocked every involved child intodoforever —recompute_ready()can never promote them.Changes
hermes_cli/kanban_db.py: Kahn topological sort over the sibling parent-index list in the pre-validation block, before any DB writes. O(N+E), no new imports.tests/hermes_cli/test_kanban_decompose_db.py: newtest_decompose_rejects_cyclic_parents.Validation
test_kanban_decompose_dbtests pass (7 pre-existing + 1 new).Closes #28050.