Skip to content

fix(kanban): detect cycles in decompose_triage_task sibling-link pre-validation - #28088

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-848fd080
May 18, 2026
Merged

fix(kanban): detect cycles in decompose_triage_task sibling-link pre-validation#28088
teknium1 merged 1 commit into
mainfrom
hermes/hermes-848fd080

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvage of #28050 by @EloquentBrush0x onto current main.

Summary

decompose_triage_task inlines INSERTs for atomicity and skipped the cycle check that link_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 in todo forever — 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: new test_decompose_rejects_cyclic_parents.

Validation

  • 8/8 test_kanban_decompose_db tests pass (7 pre-existing + 1 new).

Closes #28050.

…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.
@teknium1
teknium1 merged commit 502d03d into main May 18, 2026
5 of 6 checks passed
@teknium1
teknium1 deleted the hermes/hermes-848fd080 branch May 18, 2026 16:40
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-848fd080 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 8787 on HEAD, 8787 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4617 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have labels May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard 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.

3 participants