Skip to content

feat(source-control): script the worktree audit Step 2b recreate-and-reap remedy - #8215

Merged
kyle-sexton merged 6 commits into
mainfrom
work-resolve-issue/issue-8022-39106092491-1
Oct 20, 2026
Merged

kyle-sexton merged 6 commits into
mainfrom
work-resolve-issue/issue-8022-39106092491-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #8022

Summary

Opened by the work-resolve-issue lane. The run's own summary:

Adds reap-orphaned-plugin-records.sh, which runs the Step 2b mkdir/cd/reap --dry-run/reap/rm .claude/rmdir chain over each confirmed path in order and stops at the first failure naming the path and step. Step 2b now presents this script instead of the hand-run chain, still after per-path confirmation.

Not verified

  • The new script was committed without the executable bit (the commit tool cannot set file modes); invoked via bash, which the audit text does, but a maintainer may want chmod +x and git update-index --chmod=+x
  • The fragment is named issue-8022-worktree-audit-remedy-3f9a1c72.md by hand because HEAD was detached and new-changelog-fragment refused to run; it passes check-changelog-fragments
  • check-changelog-fragments --check-required <base> not run (no base ref given); left to the PR's CI

Fix

  • plugins/source-control/scripts/reap-orphaned-plugin-records.sh: new remedy script; plain mkdir, helper cwd check, removes only the directory it created, missing parent points at #7461
  • plugins/source-control/scripts/reap-orphaned-plugin-records.test.sh: new test with stubbed claude CLI: two dead paths in order, existing path refused, stop after first failure, missing parent, trailing slash
  • plugins/source-control/skills/worktree/context/audit.md: Step 2b remedy text presents the script and lists its guards
  • .changes/source-control/issue-8022-worktree-audit-remedy-3f9a1c72.md: minor changelog fragment

Verification

The run reports:

Left out: the items under Not verified.

Related

#8022

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 31cd06360c2a0cc0b54f91d611442c1e3526a2e8: 0 finding(s), 0 as inline comments.

Security review — PR #8215 (head 31cd063)

No security issues found.

The PR adds plugins/source-control/scripts/reap-orphaned-plugin-records.sh, its test, a changelog fragment and an audit.md update. It deletes or softens no standing instruction, so the protected-class list in docs/conventions/instruction-exception-register/README.md was not consulted.

  • Destructive operations are bounded. rm -rf -- "$path/.claude" runs only after the script created $path with plain mkdir (never -p). mkdir fails if the path already exists, including a symlink, so a live directory or a symlink to one is never reaped or removed. rmdir removes only an empty directory.
  • No injection surface. Every path expansion is quoted and -- guards the mkdir, cd, rm, rmdir and dirname calls. Paths reach the helper only as arguments to bash "$HELPER", with no eval or string-built commands. / and .. fail at mkdir because they already exist.
  • Trust boundary is documented. The paths come from a caller who has already confirmed each one is a dead worktree, which audit.md requires before the script runs. The script stops at the first failure and leaves the directory in place if the reap fails. It handles no credentials.
  • Other files. The test, the changelog fragment and the audit.md prose add no new attack surface.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 31cd06360c2a0cc0b54f91d611442c1e3526a2e8: 0 finding(s), 0 as inline comments.

Code review: no findings

I read the full diff (4 files) and the closing issue #8022, and I found nothing to report.

Closing issue #8022. The change meets each acceptance criterion as far as I could check by reading:

  • The new script's test covers two dead paths reaped in order, an existing path refused without reaping, and a stop after the first failing path. It also covers a missing parent and a trailing slash.
  • .changes/source-control/issue-8022-worktree-audit-remedy-3f9a1c72.md is a source-control changelog fragment, and I found nothing wrong with it.
  • Step 2b in audit.md now presents the script after per-path confirmation. Its guards are kept: plain mkdir that fails on an existing path, the reap helper's own cwd check, and removal of only the directory the script created.
  • A missing parent fails at mkdir with a message pointing at fix(source-control): audit Step 2b recreate-and-reap remedy fails when the parent directory is also gone #7461.

What I checked myself. I read the script against the helper's --worktree-path and --dry-run contract. I also confirmed that the assert_* helpers and skip_suite used by the new test exist in test-helpers.sh. The script is mode 755 in the diff and on disk, so the PR body's note about a missing executable bit no longer applies.

Not verified. The sandbox refused to run the new test file, so I did not run it. The PR's "35 cases passed", the check-skill result and the fragment check are the author's claims, and I did not confirm them.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of 3 on b77f015.

@melodic-automation-lanes melodic-automation-lanes Bot added the needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this. label Oct 18, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped on this pull request and needs a person: a review finding is uncertain or deferred, so a person decides it.

  • Reason: feedback-uncertain
  • Resume key: b77f0158535c4d48b3617972c737af5ffb55991b (the head the lane stopped on)

To resume, deal with the reason above, remove the needs-human label (and do-not-merge, if set), then dispatch the pr-unblock workflow with pr-number=8215 and activity=address-feedback:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=8215 -f activity=address-feedback

kyle-sexton and others added 2 commits October 18, 2026 21:06
…st pattern

lint-repo failed because the new script and its test have a shebang but
index mode 100644, and lint-shell failed on SC2295 in the test's
${log%%in $B*}. Set both files to 100755 and quote $B so it matches
literally.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 2 of 3 on ba34023.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped on this pull request and needs a person: a review finding is uncertain or deferred, so a person decides it.

  • Reason: feedback-uncertain
  • Resume key: ba340238ccd1852bb7756c70d60fed11844fd59f (the head the lane stopped on)

To resume, deal with the reason above, remove the needs-human label (and do-not-merge, if set), then dispatch the pr-unblock workflow with pr-number=8215 and activity=address-feedback:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=8215 -f activity=address-feedback

@kyle-sexton kyle-sexton removed the needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this. label Oct 20, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 20, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: risk HIGH at head 31cd06360c2a0cc0b54f91d611442c1e3526a2e8. Only LOW merges without a human. A floor path or capability change holds it: a human merges it in person, never an agent or a lane.

HIGH high-path:plugins/source-control/scripts/**: plugins/source-control/scripts/reap-orphaned-plugin-records.sh, plugins/source-control/scripts/reap-orphaned-plugin-records.test.sh
HIGH high-script: plugins/source-control/scripts/reap-orphaned-plugin-records.sh, plugins/source-control/scripts/reap-orphaned-plugin-records.test.sh

Merged via the queue into main with commit d8b3ba8 Oct 20, 2026
52 of 53 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-8022-39106092491-1 branch October 20, 2026 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(source-control): script the worktree audit Step 2b recreate-and-reap remedy

1 participant