Repository navigation
fix(kanban): isolate and protect linked worktree anchors - #89734
Closed
roycepersonalassistant wants to merge 3 commits into
Closed
roycepersonalassistant wants to merge 3 commits into
roycepersonalassistant wants to merge 3 commits into
Conversation
Author
|
Superseded by #90529 without rewriting published history. The replacement includes the original linked-anchor resolver fix plus the deferred-cleanup ownership guard and follow-up repository/branch identity regressions, committed with GitHub noreply author metadata so attribution can resolve. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<anchor>/.worktrees/<task-id>on its requested branch.worktrees/<task-id>path ownership and branch ownership match exactly; fail closed otherwiseRoot 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.The review also found two sibling ownership gaps: matching-branch linked anchors could still be reused directly, and an existing target on the wrong branch could be silently accepted. Finally, the surrounding-path fallback could select an unrelated repository when a linked anchor lived inside another checkout. The updated implementation 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— 29 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— passedtests/hermes_cli/test_kanban*.pycomparison reproduced the same 16 unrelated failures on clean currentorigin/main; the focused worktree suites are cleanRisk / rollback
The cleanup policy 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 that requests 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 by this PR. Before merge, rollback is closing the PR. After merge, revert the resulting PR commit through normal review.
Supersedes the same core resolver direction from closed/conflicted PR #70585 and replaces #89727 with GitHub noreply author metadata for contributor-attribution compliance.