Skip to content

feat(source-control): scope worktree cleanup to paths and run Step 4c inline on POSIX - #8096

Merged
kyle-sexton merged 8 commits into
mainfrom
work-resolve-issue/issue-7332-39105808952-1
Oct 19, 2026
Merged

kyle-sexton merged 8 commits into
mainfrom
work-resolve-issue/issue-7332-39105808952-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #7332

Summary

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

/source-control:worktree cleanup now takes \[<path>...\], running the same classification and guards on only those worktrees, and a bare cleanup asks session-worktree vs whole repository when the session worked one. Step 4c runs branch deletion and current-worktree removal inline on Linux/macOS after confirmation and a passed stranded-work guard, emitting them on Windows or a hook block.

Not verified

  • plugins/source-control/evals/worktree-cleanup-emits-branch-delete/ (plugin eval case) not edited or run; its prompt has no confirmation so it should still hold, but eval runs are out of scope per the issue
  • No evals added for the new scoped-path behavior; eval runs were not performed
  • check-skill on babysit-prs could not pass here (read-only ~/.claude); untouched by this change
  • new-changelog-fragment could not run on the detached HEAD, so the fragment was written by hand and validated with check-changelog-fragments

Fix

  • plugins/source-control/skills/worktree/SKILL.md: action table, headline, scope paragraph, Step 4c invariant and non-goals line updated
  • plugins/source-control/skills/worktree/context/cleanup.md: new Scope section; Step 4c rewritten (inline on POSIX, emit on Windows/hook block)
  • plugins/source-control/skills/worktree/evals/evals.json: cleanup eval case reworded to the Windows/hook-block contract
  • .changes/source-control/worktree-cleanup-scope-7332-3f9a1c7e.md: minor fragment

Verification

The run reports:

  • check-changelog-fragments: all 143 fragments valid
  • check-skill plugins/source-control/skills: worktree PASS, 0 errors (6 warnings, all pre-existing size/style); babysit-prs failed only on a read-only filesystem write to ~/.claude in the sandbox, unrelated to this change
  • fresh-context subagent review of the diff: no guard weakened; found stale eval wording and a Step 4b/4c ambiguity, both fixed
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/39105808952

Left out: the items under Not verified.

Related

#7332

melodic-automation-lanes Bot and others added 2 commits October 18, 2026 07:13
… inline on POSIX

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Comment thread plugins/source-control/skills/worktree/context/cleanup.md Outdated
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

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

No security findings in the incremental change (186ca26..68a527f).

The change touches three files:

  • plugins/source-control/skills/worktree/SKILL.md: the stranded-work invariant now reads "never run or emit its git branch -D" instead of "never emit". This widens the guardrail to cover a run as well as an emitted command. It deletes, narrows or softens no standing instruction, so the instruction-surface deletion lens does not apply.
  • plugins/source-control/skills/worktree/evals/evals.json: the expected_output wording for the eval case matches the new rule.
  • plugins/source-control/skills/worktree/reattach-slice.test.sh: the assert_gate phrase is updated to match the new SKILL.md text.

The diff adds no code paths, no injection surface and no handling of tokens or secrets.

Comment thread plugins/source-control/skills/worktree/context/cleanup.md Outdated
Comment thread plugins/source-control/skills/worktree/context/cleanup.md Outdated
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 68a527f046aa562fd6ec171dd68ecd4857c4b5e5: 0 finding(s), 0 as inline comments.

Incremental review of 186ca26..68a527f (3 files): no findings.

The change is one wording edit applied consistently in three places. The Step 4c invariant in plugins/source-control/skills/worktree/SKILL.md now reads "never run or emit its git branch -D". This matches the PR's move to running branch deletion inline on POSIX, so the guard now covers a branch deletion the skill runs as well as one it emits. The eval expected_output in evals.json (case 11) is reworded to match. The phrase assertion in reattach-slice.test.sh is updated to the new text.

  • No stale copies: grep of plugins and docs found no remaining "never emit its" phrase, so no other test or document still asserts the old wording.
  • Not run: I could not run reattach-slice.test.sh or validate the evals.json JSON here because the sandbox required approval for those commands. From reading the diff, the assertion string matches the new SKILL.md text exactly. Treat that as unverified until CI runs it.
  • Closing issue source-control: worktree cleanup should take explicit paths and scope from the conversation #7332: this increment only tightens the safety invariant. It does not change the acceptance-criteria coverage reviewed at the earlier head.

… worktree from 4b

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

Comment thread plugins/source-control/skills/worktree/context/cleanup.md Outdated
…d session-worktree removal

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@melodic-automation-lanes

melodic-automation-lanes Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Unattended merge: risk MED at head 404090142ec8b594e9bb4efe1c98beca28d587f4. Only LOW merges without a human; this pull request waits for one.

MED findings:claude-review: 3 open

@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: the merge stages a change under .github/workflows/, which the lane does not push.

  • Reason: workflow-staged
  • Resume key: d85604c14ec963898631910801574ec22c72cfd7 (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=8096 and activity=resolve-conflicts:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=8096 -f activity=resolve-conflicts

…sue-7332-39105808952-1

# Conflicts:
#	plugins/source-control/skills/worktree/SKILL.md
#	plugins/source-control/skills/worktree/context/cleanup.md
Comment thread plugins/source-control/skills/worktree/context/cleanup.md
Comment thread plugins/source-control/skills/worktree/context/cleanup.md Outdated
@kyle-sexton kyle-sexton removed the needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this. label Oct 18, 2026
@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 19, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped on this pull request and needs a person: the lane could not fix every failing check; its run log names each one and why.

  • Reason: ci-fix-escalated
  • Resume key: 404090142ec8b594e9bb4efe1c98beca28d587f4 (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=8096 and activity=fix-ci:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=8096 -f activity=fix-ci

kyle-sexton and others added 3 commits October 19, 2026 01:15
…h slice

Move the cleanup action's safety invariants directly under its heading,
ahead of the procedure summary and the Scope paragraph, so the
stranded-work rule sits within the first 20000 bytes that
reattach-slice.test.sh requires. Pure reorder; no wording changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…branch -D runs

The Step 3 prompt now names the local branch deletion and the session's
own worktree removal that Step 4b performs on Linux and macOS, and Step 4
points at that prompt. The stranded-work guard states that Step 4b runs
`git branch -D` on Linux and macOS and emits it on Windows or a hook block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ted branch -D

This PR runs `git branch -D` inline on Linux and macOS and emits it on
Windows, so the safety rule, the reattach-slice test that pins its wording,
and the eval expectation now say "run or emit". The rule stays inside the
first 20000 bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 19, 2026
Merged via the queue into main with commit d14818b Oct 19, 2026
25 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-7332-39105808952-1 branch October 19, 2026 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

source-control: worktree cleanup should take explicit paths and scope from the conversation

1 participant