Repository navigation
fix(kanban): auto-decompose children lose project_id/workspace_path/branch_name - #105669
iankoratskydcn wants to merge 1 commit into
Conversation
…adiness Pre-existing uncommitted work found in this checkout (from a separate, concurrent Hermes session sharing this same ~/.hermes/hermes-agent working copy) at a green, tested state. Committed as-is, separately from the per-board dispatch toggle commit, per explicit instruction to keep the two changesets isolated rather than conflate them. Covers (inferred from diff, not authored this session): - kanban_db.py: _resolve_project_link / set_project_id and related project-binding helpers; specify_triage_task additions. - kanban_db_graph.py: consolidated/simplified decompose graph logic (net -177 lines vs kanban_db.py's +258 — looks like a graph-logic relocation alongside the double-fire guard fix, not just growth). - kanban_db_workspace.py, kanban_ops.py: small supporting changes. - promote_task readiness parameter (kanban_db.py / test_kanban_promote.py). - Test coverage: test_kanban_cli_dispatch_passthrough.py, test_kanban_decompose_db.py (new file), test_kanban_promote.py, test_kanban_worktree_isolation.py. Verified before commit: all 9 files syntax-clean at staged content; scripts/run_tests.sh on the 4 affected test files: 13/13 passed.
Related: #75601, #91205, #103714 and #42660 are open competing fixes for the same auto-decompose child-anchoring class (children persisted with null project_id / workspace_path). This PR recovers the link via sibling tasks and the |
|
We hit this in production on v0.21.5 (f97608f). With |
Bug
kanban.auto_decompose(viadecompose_triage_task→_insert_decomposed_child→_resolve_project_link) produces child cards withproject_id,workspace_path, andbranch_nameallnullwhenever the project can't be resolved through the normal registry lookup path — e.g. when the source task's project isn't in the decomposing profile's localprojects.db(worker profiles have independentprojects.dbfiles; the Kanban DB is shared).Reproduced live: a triage card whose project bound correctly (
project_id, absoluteworkspace_path, realbranch_name) was decomposed into 6 children, all of which showedworkspace_kind: worktreebut every resolving fieldnull— human-readableshowprintedWorkspace: worktree @ (unresolved). This is the same failure class as an earlier manually-decomposed card that needed a manual "malformed child execution envelope: project_id and branch_name missing" repair before a builder could run.Fix
_resolve_project_linkinhermes_cli/kanban_db.py:project_source_task_idis given, fall back to the earliest sibling task on the sameproject_idthat has a resolvedworkspace_kind='worktree'+ non-nullworkspace_path, and recover the project from it.<repo>/.worktrees/<id>convention) instead of silently dropping the link and degrading to an unlinked scratch child.Also included in this commit (same original changeset, kept together per the author's own note that these were verified as one green unit):
decomposedevent check).promote_taskgains areadiness=Trueescape hatch for triage-status inspection canaries, requiring a non-empty audit reason.Conflict note
This was originally committed against an older
main. Currentmainalready refactoredkanban_db_graph.py'sdecompose_triage_task/_insert_decomposed_childinto thin delegators to the canonical implementation inkanban_db.py(see that file's own docstring, which independently describes this exact bug class: "this module used to own a full, independently-maintained duplicate that silently dropped project_id/branch_name/skills from every decomposed child"). Rebased the cherry-pick onto that delegation; the actual_resolve_project_linkfix applied cleanly since it lives inkanban_db.py, not the removed duplicate.Testing
test_kanban_notify.pyfailures (13 tests) are a pre-existing, unrelatedpytest.mark.asyncioregistration issue reproduced identically on unmodifiedmain— not caused by this change.test_kanban_decompose_db.py::test_decompose_preserves_project_execution_metadataand::test_project_link_recovers_from_canonical_task_when_registry_is_unavailableare the direct regression tests for this bug class.