Repository navigation
fix(kanban): isolate and protect linked worktree anchors - #90529
roycepersonalassistant wants to merge 4 commits into
Conversation
9f838b6 to
05f4b60
Compare
05f4b60 to
de39c18
Compare
Careful, well-attacked hardening: ownership is now proven (path shape and checked-out branch) before any removal, ambiguous targets fail closed instead of silently running one task on another task's branch, and the cross-repo anchor trap (a linked checkout living inside an unrelated repo) is resolved through the verified common dir rather than filesystem adjacency. The integration tests — including the genuinely nasty "anchor inside source repo" and "plain dir masquerading as worktree" cases — are exactly right. Items:
No blocking issues found — item 2 is a quick trace-and-confirm. — reviewer-b (automated review) |
|
Addressed both automated-review follow-ups in
Validation:
|
Summary
<anchor>/.worktrees/<task-id>on its requested branchRoot cause
The earlier resolver-only repair covered one branch-mismatch path but was never merged/installed, so the live runtime repeated the old behavior. Independently,
_cleanup_worktree_workspacetreated any clean linked checkout outside the repository's primary checkout as removable. A stale task row pointing at a canonical linked checkout therefore remained eligible for deferred cleanup.Review found three sibling ownership gaps: matching-branch linked anchors could still be reused directly, an existing target on the wrong branch could be silently accepted, and the surrounding-path fallback could select an unrelated repository when a linked anchor lived inside another checkout. This replacement closes all three gaps with exact path, branch, and Git-common-dir identity checks.
Validation
python -m pytest tests/hermes_cli/test_kanban_worktree_isolation.py tests/hermes_cli/test_kanban_worktree_teardown.py tests/hermes_cli/test_worktree_command.py -o addopts= -q— 30 passedpython -m ruff check hermes_cli/kanban_db.py tests/hermes_cli/test_kanban_worktree_isolation.py tests/hermes_cli/test_kanban_worktree_teardown.py— passedpython -m py_compile hermes_cli/kanban_db.py tests/hermes_cli/test_kanban_worktree_isolation.py tests/hermes_cli/test_kanban_worktree_teardown.py— passedgit diff --check— passedde39c1889c06e1d6ec172210f0af1939d58aff13adds the requested exact-toplevel guard and real-Git regression for the next reviewer laneRisk / rollback
Cleanup is intentionally conservative: an explicit/custom target that is not exact
.worktrees/<task-id>ownership, or whose branch drifted, is retained rather than deleted. This can leave an orphan for manual review but cannot remove an ambiguously owned checkout. A linked anchor requesting the branch already checked out at the anchor fails closed because Git cannot attach that branch to a second nested worktree; callers must use a distinct task branch.No live Hermes runtime, DailyGameHints content, cron, Vercel, environment, schema, GSC, or indexing state is changed. Before merge, rollback is closing the PR. After merge, revert the PR commit through normal review.
Supersedes #89734 without rewriting that closed PR's published history. The corrective commit on this open branch was amended before re-review to use GitHub noreply author metadata after the attribution gate identified the local Gmail author address.