fix(kanban): scratch children no longer inherit parent workspace path - #67574
webtecnica wants to merge 1 commit into
Conversation
When a kanban worker creates a child task via kanban_create without explicit workspace args, the child previously inherited the parent's literal workspace_path. For scratch tasks this meant the child pointed at the parent's already-materialized directory instead of getting its own isolated workspace at <board>/workspaces/<child-id>. Now scratch children still inherit workspace_kind='scratch' but leave workspace_path=None so the dispatcher materializes a fresh directory. Dir / worktree children continue to inherit the parent's path, keeping follow-up work in the same project checkout. Closes NousResearch#67567.
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused fix. The current-main implementation still unconditionally copies a worker parent's workspace_path in tools/kanban_tools.py:1132; for scratch tasks, resolve_workspace reuses a stored path but otherwise creates <workspaces_root>/<task-id> (hermes_cli/kanban_db.py:5866-5881). The conditional in this PR therefore addresses the reported isolation failure while retaining persistent dir/worktree inheritance.
Problems
- No regression test covers a materialized scratch parent creating a child without workspace arguments. Existing coverage tests only the persistent-dir inheritance path at
tests/tools/test_kanban_tools.py:1009-1036.
Suggested changes
- Add a focused test asserting that such a child stays
scratchwithworkspace_path is None; keep the existing dir inheritance test as the persistent-workspace contract.
Automated hermes-sweeper review.
| # the parent's. Dir / worktree children keep their | ||
| # inherited path so follow-up work lands in the same | ||
| # project checkout. | ||
| if _self_task.workspace_kind != "scratch": |
There was a problem hiding this comment.
Please add a regression test for this branch with a claimed scratch parent whose materialized workspace_path is set. Assert the omitted-workspace child remains scratch with workspace_path is None; the current test suite covers only the dir inheritance case.
|
Reviewed against #67567. This correctly fixes the reported scratch case: guarding Two parts of the issue's Expected behavior remain uncovered, though, because the
The sibling PR #67570 addresses these by inheriting only |
|
Closing as superseded by #70143 (merged, SHA 781968b), which salvaged #67570. That change removed the implicit literal-path inheritance in |
Problem
When a dispatcher-spawned Kanban worker creates child tasks via
kanban_createwithout explicit workspace arguments, scratch children inherit the parent's literalworkspace_path. This means the child points at the parent's already-materialized<board>/workspaces/<parent-id>directory instead of getting its own isolated workspace.Production evidence: A remediation child editing inside a rejected-review directory invalidated review evidence, and allowed concurrent tasks to share one checkout/index.
Root cause
In
tools/kanban_tools.py::_handle_create, lines 1130–1132, when_inherit_workspaceis true, bothworkspace_kindandworkspace_pathare unconditionally copied from the parent task — without distinguishing thescratchcase from shareddir/worktreepaths.Fix
Only inherit
workspace_pathwhen the parent'sworkspace_kindis NOT"scratch". Scratch children still inheritworkspace_kind="scratch"but keepworkspace_path=None, so the dispatcher materializes a fresh directory at<board>/workspaces/<child-id>.Dir / worktree children continue to inherit the parent's path as before, keeping follow-up work inside the same project checkout.
Expected behavior after fix
workspace_path=None→ resolved to their own<board>/workspaces/<child-id>workspace_kind,workspace_path) inkanban_createstill override inheritanceHERMES_KANBAN_TASK) unchanged — still default to scratchCloses #67567.