mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
fix(kanban): stop decompose siblings sharing one worktree checkout
Some checks failed
CI / Detect affected areas (push) Waiting to run
CI / Python tests (push) Blocked by required conditions
CI / Python lints (push) Blocked by required conditions
CI / JS & TS checks (push) Blocked by required conditions
CI / Desktop E2E (push) Blocked by required conditions
CI / Docs Site (push) Blocked by required conditions
CI / Deny unrelated histories (push) Blocked by required conditions
CI / Check contributors (push) Blocked by required conditions
CI / Check uv.lock (push) Blocked by required conditions
CI / package-lock.json diff (push) Blocked by required conditions
CI / Lint Docker scripts (push) Blocked by required conditions
CI / Build&Test Docker image (push) Blocked by required conditions
CI / Supply-chain scan (push) Blocked by required conditions
CI / Review label gate (push) Blocked by required conditions
CI / OSV scan (push) Waiting to run
CI / CI review comment (live) (push) Blocked by required conditions
CI / All required checks pass (push) Blocked by required conditions
CI / CI timing report (push) Blocked by required conditions
Deploy Site / deploy-vercel (push) Waiting to run
Deploy Site / deploy-docs (push) Waiting to run
Docker Build, Test, and Publish / build (amd64, type=gha,scope=docker-amd64, type=gha,mode=max,scope=docker-amd64, linux/amd64, ubuntu-latest) (push) Waiting to run
Docker Build, Test, and Publish / build (arm64, type=gha,scope=docker-arm64, type=gha,mode=max,scope=docker-arm64, linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Docker Build, Test, and Publish / publish (amd64, type=gha,scope=docker-amd64, type=gha,mode=max,scope=docker-amd64, linux/amd64, ubuntu-latest) (push) Blocked by required conditions
Docker Build, Test, and Publish / publish (arm64, type=gha,scope=docker-arm64, type=gha,mode=max,scope=docker-arm64, linux/arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
Docker Build, Test, and Publish / merge (push) Blocked by required conditions
auto-fix lint issues & formatting / Generate eslint --fix patch (push) Waiting to run
auto-fix lint issues & formatting / Apply patch (push) Blocked by required conditions
Build Skills Index / build-index (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
Some checks failed
CI / Detect affected areas (push) Waiting to run
CI / Python tests (push) Blocked by required conditions
CI / Python lints (push) Blocked by required conditions
CI / JS & TS checks (push) Blocked by required conditions
CI / Desktop E2E (push) Blocked by required conditions
CI / Docs Site (push) Blocked by required conditions
CI / Deny unrelated histories (push) Blocked by required conditions
CI / Check contributors (push) Blocked by required conditions
CI / Check uv.lock (push) Blocked by required conditions
CI / package-lock.json diff (push) Blocked by required conditions
CI / Lint Docker scripts (push) Blocked by required conditions
CI / Build&Test Docker image (push) Blocked by required conditions
CI / Supply-chain scan (push) Blocked by required conditions
CI / Review label gate (push) Blocked by required conditions
CI / OSV scan (push) Waiting to run
CI / CI review comment (live) (push) Blocked by required conditions
CI / All required checks pass (push) Blocked by required conditions
CI / CI timing report (push) Blocked by required conditions
Deploy Site / deploy-vercel (push) Waiting to run
Deploy Site / deploy-docs (push) Waiting to run
Docker Build, Test, and Publish / build (amd64, type=gha,scope=docker-amd64, type=gha,mode=max,scope=docker-amd64, linux/amd64, ubuntu-latest) (push) Waiting to run
Docker Build, Test, and Publish / build (arm64, type=gha,scope=docker-arm64, type=gha,mode=max,scope=docker-arm64, linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Docker Build, Test, and Publish / publish (amd64, type=gha,scope=docker-amd64, type=gha,mode=max,scope=docker-amd64, linux/amd64, ubuntu-latest) (push) Blocked by required conditions
Docker Build, Test, and Publish / publish (arm64, type=gha,scope=docker-arm64, type=gha,mode=max,scope=docker-arm64, linux/arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
Docker Build, Test, and Publish / merge (push) Blocked by required conditions
auto-fix lint issues & formatting / Generate eslint --fix patch (push) Waiting to run
auto-fix lint issues & formatting / Apply patch (push) Blocked by required conditions
Build Skills Index / build-index (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
Decompose children inherit the root's literal workspace_path (#37172), so every sibling of a worktree-kind root points at the SAME checkout. _resolve_worktree_workspace's existing-checkout shortcut then reuses that directory on whatever branch is currently checked out, ignoring the task's own branch_name. Net effect: sibling workers — which can be promoted and dispatched concurrently — run in one directory on the first sibling's branch, with no lock. Work lands on the wrong task's branch (provenance corruption) and concurrent siblings trample each other's index/tree. Fix, two layers: - decompose_triage_task: worktree-kind children no longer inherit the root's literal path; each child materializes its own <repo>/.worktrees/<child-id> at dispatch (dir/scratch inheritance unchanged — children legitimately share those). - _resolve_worktree_workspace: when the requested path is an existing checkout of a DIFFERENT branch, fall back to a fresh <repo>/.worktrees/<task-id> instead of silently reusing it (heals rows that already carry a shared path). Same-branch reuse and the no-repo/own-path degenerate cases keep the legacy behaviour. Tests: tests/hermes_cli/test_kanban_worktree_isolation.py (5); full test_kanban_db.py + test_kanban_decompose_db.py suites pass unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
c2c2449d05
commit
65d42e35d4
2 changed files with 225 additions and 0 deletions
|
|
@ -5947,6 +5947,15 @@ def decompose_triage_task(
|
|||
child_ws_kind = child.get("workspace_kind") or root_ws_kind
|
||||
if child.get("workspace_path"):
|
||||
child_ws_path = child.get("workspace_path")
|
||||
elif child_ws_kind == "worktree":
|
||||
# Never share one worktree checkout between siblings: the
|
||||
# root's literal path would put every child in the same
|
||||
# directory on the first-dispatched sibling's branch, with
|
||||
# no lock — siblings can be promoted and dispatched
|
||||
# concurrently. Leave the path unset so dispatch
|
||||
# materializes a fresh <repo>/.worktrees/<child-id> per
|
||||
# child from the board anchor.
|
||||
child_ws_path = None
|
||||
elif child_ws_kind == root_ws_kind:
|
||||
child_ws_path = root_ws_path
|
||||
else:
|
||||
|
|
@ -6324,6 +6333,24 @@ def _resolve_worktree_workspace(
|
|||
|
||||
if requested.exists() and _is_linked_worktree_checkout(requested):
|
||||
actual_branch = _git_current_branch(requested)
|
||||
if actual_branch == branch_name:
|
||||
return requested_resolved, actual_branch
|
||||
# The requested path is an existing checkout of a DIFFERENT
|
||||
# task's branch. Decompose children inherit the root's
|
||||
# workspace_path verbatim, so siblings all point here; reusing
|
||||
# the checkout as-is would run this task on the other task's
|
||||
# branch — silent cross-task provenance corruption, and unsafe
|
||||
# when siblings run concurrently. Fall back to a fresh worktree
|
||||
# of our own under the same repo.
|
||||
fallback_root = _repo_root_for_worktree_target(requested.parent)
|
||||
if fallback_root is not None:
|
||||
fallback = fallback_root / ".worktrees" / task.id
|
||||
if fallback.resolve(strict=False) != requested_resolved:
|
||||
_ensure_git_worktree(fallback_root, fallback, branch_name)
|
||||
return fallback.resolve(strict=False), branch_name
|
||||
# No repo to anchor a fallback on (or the occupied path IS this
|
||||
# task's own canonical worktree): keep the legacy reuse rather
|
||||
# than failing dispatch.
|
||||
return requested_resolved, actual_branch or branch_name
|
||||
|
||||
repo_root = _git_toplevel(requested)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue