Skip to content

feat(work-items): delete dossier branches when a spec container closes - #16907

Merged
kyle-sexton merged 8 commits into
mainfrom
feat/work-items-delete-dossier-branch-at-container-close
Nov 17, 2026
Merged

kyle-sexton merged 8 commits into
mainfrom
feat/work-items-delete-dossier-branch-at-container-close

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

No related issue: the wayfind skill already says a map's dossier branch is deleted when its destination container closes; this gives that delete an actor.

Summary

/planning:wayfind keeps a map's dossier branch "until the destination's container closes, then delete it", but no skill, tool or workflow performed the delete, so dossier branches piled up. The container close ritual, which owns the close, now does it, and four eval cases cover the step.

Fix

  • plugins/work-items/skills/decompose/context/container-lifecycle.md: once the close-out review passes, the ritual handles up to two remote dossier branches: the container's own, and the one named by the closing comment of the wayfind map that is the container's source item. The prefix is read from the dossier_branch_prefix key of the closed-out repository's docs/conventions/source-control.yaml.
  • An unattended run (--unattended, a loop or lane run) never deletes: it lists each branch due for deletion in the closing comment and its report.
  • An attended run shows, per branch, how many commits the default branch cannot reach and a summary of the files they change, asks once, and deletes only what the user confirms.
  • Two cases are report-only, attended or not: more than one matching branch, and a branch that is the head of an open pull request. The run does not delete, ask, or offer to delete on request.
  • A branch name read from a comment is data: it must carry the prefix and the map's key and match a safe ref charset, or it is reported and never reaches a command line. A container that stays open deletes nothing.
  • plugins/work-items/skills/ship/SKILL.md: the close route now names the ritual's file and says its close owns the dossier-branch step.
  • Four new eval cases: unattended, attended, two matching branches, open pull request. Each scaffolds a local bare origin with a dossier branch holding three commits not on main, so a delete command would really run.

Verification

  • scripts/validate-plugins.sh, the changelog fragment check, markdownlint and shellcheck on the scaffolds exit 0. validate-cases.py plugins/work-items/evals reports no FAIL, and with pass and fail labels swapped all 87 deterministic samples flip.
  • The cases were run three times on Sonnet (3 runs a case, Opus judge, plugin arm only) while the text and graders were fixed between runs. The last run, on the text in this PR, read VALID with no refused tool call: all 12 runs opened the ritual file by the path the ship route gives.
  • No run deleted a branch: in all 60 sandboxes over the three rounds, every scaffolded branch was still on the origin afterwards.
  • Last run, by case, as read from the traces: unattended 3 of 3 listed the branch as due and left it; attended 3 of 3 showed the unshared commits and files, then asked once; open pull request 3 of 3 skipped without asking or offering; two matches 2 of 3 reported both and offered nothing.
  • Known miss: 1 of 3 two-match runs reported both branches, deleted neither, and then offered "tell me which one … and I can run the deletion in a later attended run", which the text rules out. The graders fail that run.
  • On main's text (1 run a case) every case fails a grader that the new text passes, because the old text never handles the dossier branch.
  • The model-graded grader of each case was calibrated against its sample answers and agreed on every sample tested.
  • Deviation, named: after the last run two regexes were corrected for false fails on correct replies (a commit count written as a word; a delete offer matched across a sentence boundary). They were checked by replaying every deterministic grader over the kept replies of the last two runs, not by a fourth model run: exactly those two verdicts changed and the real offer still fails.
  • Measured on Sonnet only, one arm; no with-versus-without delta was taken.

Related

  • plugins/planning/skills/wayfind/SKILL.md, the "Keep the map's dossier branch" sentence.
  • Not covered here: a map that reaches its container through a plan (map, then plan, then decompose) leaves no tracker link from the container back to the map, so that map's dossier branch still has no deleter.

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits November 17, 2026 13:14
The container close ritual now owns the dossier-branch delete: once the
close-out review passes, it deletes the container's own dossier branch and
the one named in the closing comment of the wayfind map the container was
published from. The prefix comes from the source-control
dossier_branch_prefix setting; a branch name read from a comment must match
the prefix and a safe ref charset; a branch with an open pull request is
skipped; an attended run asks once and an unattended run only reports; a
container that stays open deletes nothing. The closing comment reports each
branch deleted or skipped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…elete unattended

An attended close now shows, per dossier branch, the commits the default
branch cannot reach and the files they change before asking, and deletes
only what the user confirms. An unattended run never deletes: the closing
comment and the run's report list each branch due for deletion.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 17, 2026 18:18
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T18:20:42.067160Z 9d6b338 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d6b338855

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

kyle-sexton and others added 6 commits November 17, 2026 13:35
…iner close

Four scaffolded cases give the close ritual a real origin holding the
dossier branch: unattended runs list it as due and delete nothing, attended
runs show its unshared commits and files before asking once, two matching
branches are both reported and neither deleted, and a branch that heads an
open pull request is skipped with that reason. Every deterministic grader
carries pass and fail samples.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…iguous match is report-only

The close ritual now reads the dossier prefix from the dossier_branch_prefix
key of docs/conventions/source-control.yaml in the repository being closed
out, not from the plugin's files, and leaves the default to the
source-control setting that owns it. More than one matching branch, like a
branch that heads an open pull request, is reported only: the run neither
deletes it nor asks whether to, attended or not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The open-pull-request case now needs the branch reported as skipped on the
same line as the pull request, so a reply that only repeats the prompt's
names fails, and a not_contains grader fails any offer to delete the
branch in this run. The ambiguous-match case gets the same no-offer
grader. The unattended case no longer grades whether the container
closes, which no run can do with the tracker out of reach. Every
model-graded grader now has pass and fail calibration samples.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-only cases from offering a delete

/work-items:ship now links the container-lifecycle file it routes the
close to, so a run opens it instead of searching the plugin, and names the
dossier-branch step as part of that close. An ambiguous match or an open
pull request's head is reported only: the run does not offer to delete it
on request, and leaves it to a person or a later attended run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
no-delete-offer now also fails a conditional offer such as "say which and
I'll delete it". lists-branch-as-due accepts a due heading up to 600
characters before the branch, in either order, and fails any reply that
claims the branch was deleted. reports-both needs both branches reported
as an ambiguous match, not merely named while exploring. Each scaffold's
main now carries the two shipping commits the prompt names.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
no-delete-offer now needs the condition and the delete in one offer: no
sentence-ending punctuation between them, and the verb offered after "I
can", "I'll", "I will" or "I could" must be delete, remove or running the
deletion. An offer to show commits after a sentence about deleting no
longer fails. shows-unshared-work-then-asks accepts the commit count as
"three" as well as "3".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 0b216650d35b387580f2190c46c99962b2aca0fa: read 25 of 25 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #16907 (dossier branch delete at container close)

I found no security issues in this pull request.

What changed. The container close ritual in plugins/work-items/skills/decompose/context/container-lifecycle.md now deletes up to two remote dossier branches after the close-out review passes. ship/SKILL.md now links straight to that ritual. The PR also adds four eval cases (case files, grader samples and scaffold scripts) and a changelog fragment.

What I checked.

  • Untrusted branch names. The second branch is named in the comment of a /planning:wayfind map, and anyone who can comment on that issue can write that comment. The new text treats the name as data. It must start with <prefix><map key>-, match ^[A-Za-z0-9._/-]+$ and contain no ... Otherwise it is reported and never put on a command line (container-lifecycle.md lines 1047–1050 in the diff). The required prefix means the name cannot start with -, which blocks option injection. The character set blocks shell metacharacters. So a hostile comment can at most point at another branch under the same prefix and key.
  • Who can delete. That spoofing path still needs a person. An unattended run (a loop, a lane, or any run with no operator turn) never deletes; it only lists the branches due for deletion. An attended run shows each branch's commits that the default branch lacks and the files they change, then asks once and deletes only what the user confirms. A branch that heads an open pull request is report-only, and so is any case where more than one branch matches. No credentialed lane gets a new action from this.
  • Where the prefix comes from. It is read from the repository being closed out (docs/conventions/source-control.yaml), not from the plugin's files. That source is under the repository owner's control.
  • Removed instructions. The change only adds rules and removes none. The ship/SKILL.md edit adds a link to the ritual file and keeps the "never close without the review" rule.
  • Eval scaffold scripts. They only build a local git repository and a bare .work/origin.git remote inside the eval sandbox. They have no network access, read no secrets and take no outside input.
  • Trust controls and manifests. No trust control, merge hold, workflow, action or plugin manifest is touched, so the manifest rules do not apply.
  • Owner friction holds. None are removed.

Spend: the four new eval cases (max_turns: 25, timeout_seconds: 480 each) use prepaid model credit when evals run. That is not a hold.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 0b216650d35b387580f2190c46c99962b2aca0fa: read 25 of 25 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings

This PR gives the dossier-branch delete that /planning:wayfind already promises a skill that performs it. The container close ritual in plugins/work-items/skills/decompose/context/container-lifecycle.md now handles it. /work-items:ship points the close at that file, and four scaffolded eval cases cover the ritual: attended confirm, unattended list-only, a branch that heads an open PR, and two matching branches.

I read all 22 files the scope lists. I skipped the three copies of no-branch-delete.json, which are identical to the first one.

What I checked against the code at head

  • Branch naming matches what the plugins already use. The ritual builds the container's own branch as <prefix><key>- with <key> = branch_ref. That matches wayfind's <prefix><key>-<slug> shape (plugins/planning/skills/wayfind/SKILL.md L122-L131) and the dossier_branch_prefix entry under "YAML keys" in plugins/source-control/reference/config-resolution.md (L284-L294). The trailing - stops dossier/400- from matching dossier/4000-….
  • The map-branch source is consistent. The ritual reads the map's branch from the map's closing comment, and wayfind's closing comment names the dossier branch (wayfind work step 8). The source item is the container's parent, which matches the existing --parent "<source-item-id>" publish rule.
  • The ship routing change is sound. The new ${CLAUDE_PLUGIN_ROOT} link in ship/SKILL.md follows the pattern used elsewhere in work-items, and --unattended is a flag that ship/actions/run.md and work-loop already use.
  • Eval cases look consistent. Each scaffold builds the state its prompt describes: a bare origin, the branch pushed then deleted locally, and set-head. The no-branch-delete must-not grader runs on both arms. I checked the regex graders by hand against their pass/fail samples, including the YAML '' escapes and the fixed-width lookbehinds. I did not run them: this lane has no shell. The author says validate-plugins.sh, the fragment check and markdownlint pass; that is unverified by me.
  • Path-scoped rules are respected. .claude/rules/eval-case-transcripts.md: the samples are synthetic run output with no identifying detail. .claude/rules/skill-bodies-state-current-rules.md: no upstream specific is restated.
  • Changelog bump fits. The fragment is bump: minor, which suits a new behaviour. No plugin.json or marketplace.json changed, so there are no manifest lines.

Notes (not findings)

  • The PR body is out of date. Its "Related" section says plugins/work-items/skills/ship/SKILL.md "lists the close steps without this one". But this diff does change that file's close-out row to name the dossier-branch step, and the changelog fragment says so. Worth updating the body so it doesn't mislead later readers.
  • No closing issue. The PR states it has none, so there are no acceptance criteria to check against.
  • What it spends: four new eval cases, each with max_turns: 25 and timeout_seconds: 480, use prepaid eval-run credit whenever the eval suite runs. This is not a hold.
  • I left security questions out of scope. These include the ref-charset validation, and how branch names listed from the remote reach a command line. The separate security lane covers them.

Loosened-check verdict: fail (no wrapper line; default used, no consumer entries); patterns: 0. No check is loosened: the change only adds eval cases and graders.

Verifier dropped 0 of 0 candidates.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 17, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 6be2b0d Nov 17, 2026
63 checks passed
@kyle-sexton
kyle-sexton deleted the feat/work-items-delete-dossier-branch-at-container-close branch November 17, 2026 21:56
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant