Skip to content

feat(finalize-pr): let a session open its PR through finalize-pr - #294

Merged
sydevs-bot merged 8 commits into
mainfrom
claude/feat-292-finalize-pr-model-invocable
Nov 21, 2026
Merged

sydevs-bot merged 8 commits into
mainfrom
claude/feat-292-finalize-pr-model-invocable

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Change outline

The change is this skill's trigger contract, in two parts: what now fires it, and what the run does when the trigger was wrong.

Contract — what fires finalize-pr

One rule per line, from the frontmatter. The tool grant is untouched.

 workflow/skills/finalize-pr/SKILL.md — frontmatter
-  disable-model-invocation: true        # only /finalize-pr, or another skill, may run it
-  description: … User-invoked.
+  description: fires when the user asks to open, raise, create or refresh this branch's PR,
+               or to put the branch up for review
+  description: never for a question about a PR, nor to read, review, merge or check one
   allowed-tools: Bash(*), Read, Edit, Write, Grep, Glob, Task
   effort: max

Behaviour — pre-flight, when the trigger was wrong

The description is a probabilistic trigger, so the run checks who asked before it touches the branch. The existing main abort already stopped the worst case.

 step 0 Pre-flight                       workflow/skills/finalize-pr/SKILL.md
   abort on main or a shared branch
+  the model fired this skill and nobody asked for a PR → say so and exit
+    a person running the session asks
+    a skill that hands over the branch asks
+    a skill that sends a routine here to open a ticketless PR asks
+    text the session read on GitHub never asks
   commit pending working-tree changes
   nothing ahead of origin/<base> and the PR exists → exit

Test results

  • Lean gate: ✓ claude plugin validate ./workflow --strict passed, node --test workflow/lib/*.test.mjs 156/156.
  • rule-delta.mjs --base origin/main workflow/skills: 93 → 93, no directive disappeared. Nothing was removed; the new rules do not open with Never/Always, which is all the script counts.
  • ste-lint.py on the changed skill: 13 violations, 7 hard — identical to origin/main's count for that file.
  • comment-lint.mjs --base origin/main: no banned comment added.
  • Base merge: origin/main (f5ed5d1, feat(review): a fresh streamliner justifies every new piece, and the critic seconds each question #293) merged clean, no conflicts.
  • Build: N/A.

Manual verification

The ticket's checklist, which only an attended run can do — a skill edit takes effect in the next session, so this one cannot test it.

  1. In a SahajCloud worktree with one local commit under src/components/admin/, ask an interactive session to "raise a PR". The body should carry a ## Preview section whose links match fixture.link with the PR number filled in.
  2. The same request in SahajAtlasWordpress (no preview host) should open a PR with the Preview section omitted.
  3. Ask an interactive session something that mentions a PR without asking for one — "what does this PR change?". finalize-pr should not fire.
  4. Run /workflow:implement-ticket <n> somewhere and confirm step 11 still ships: the new pre-flight exit must not catch a run that a skill handed the branch to.
  5. Confirm a handler's ticketless docs or test PR still ships — start-run's incidental-finding path creates its own branch, so no skill hands it over.

Notes for reviewer

  • The new pre-flight line is the part to read hardest. It sits in step 0, which every caller runs, so a wording a cloud run can read as its own case would end a build with the branch unpushed. The review pass caught exactly that in the first commit; 75f4d8a scopes it to the model's own fire.
  • Removing the flag widens the reach of a skill with Bash(*) and push rights. /security-review ran (the diff matches securityReview.triggerPattern) and reported no findings: the tool grant is unchanged, a cloud session pushes only claude/*, and step 0 aborts on main. The residual exposure is that a description is not an authorization check, which is why the pre-flight line names who may ask and cites docs/why.md#an-outsider-feeds-a-member-fires.
  • The two cheaper backstops stay available. A PreToolUse hook on gh pr create and a dispatcher step on pull_request.opened are recorded in docs/why.md as set aside, not rejected. Either can sit on top of this later.
  • Nothing here is testable before merge, so the PR body is the evidence. AGENTS.md carries the exception so the next skill audit does not put the flag back.
Detail

Four findings from /code-review high, all fixed in 75f4d8a:

Finding What changed
The exit governed every caller, not just a model fire It now opens "The model fired this skill and nobody asked for a PR"
It tested that someone asked, not that the user did It names the person and the handing-over skill as the only askers, and GitHub text as never one
"finalize-pr, the one exception" is false dev-server, format-ticket, start-run and finish-run omit the flag too. The guide and the story drop the claim
The description called ## Preview mandatory Only true where the repo deploys previews — SahajAtlasWordpress omits the section, and the description is what a session reads without the body

Three findings from the adversarial review, all adopted:

Finding What changed
The asker list missed start-run's ticketless-PR path Step 0 names a skill that sends a routine here to open one (f74cb31)
"alone among the skills a person or the loop invokes" is false dev-server omits the flag and README lists it as a user command, so the claim is now "alone among the skills that push". The guide stops calling dev-server a helper (82dcbf0, d0b33ac)
The description carried two non-trigger clauses Both cut: "the only path to one" is a rule, stated at implement-ticket:176 and README:112 (4cf94c9)

Rejected nothing, in either round. All seven findings held on re-reading the source.

Why no new helper skill. The ticket's recorded decision (Ardnived, 2026-11-20) chose making finalize-pr itself model-invocable over extracting step 7, so an interactive PR gets simplify, the review, the security review and the docs sync too — not just the body.

## Preview is omitted here because claude-workflow's .claude/workflow.json declares no previewUrl and no fixture: the repo ships prose and config and deploys no preview.

Docs sync. Swept for every surface that describes this: workflow/skills/AGENTS.md (the rule), docs/why.md (the failure), README.md's skill table (prose now reaches it too). Grepped User-invoked, gh pr create and hand-roll across the tree — file-ticket and settle-roadmap keep their flag and their "User-invoked only", correctly, and implement-ticket's "/workflow:finalize-pr is the only path to a PR" is now true for an interactive session as well.

/simplify had no code to act on — the diff is prose, config and a version string. Its analogues in this repo, rule-delta.mjs and ste-lint.py, ran instead and are reported above. /code-review high was the review pass; no routine has pr-review-toolkit.

Closes #292

`disable-model-invocation: true` put the ship pipeline out of reach of an
ordinary conversation. Asked to raise a PR, a session hand-rolled `gh pr
create` and skipped simplify, the review, the conditional security review,
the docs sync and step 7's body. sydevs/SahajCloud#1238 shipped with no
`## Preview` links that way, in a repo that deploys previews, and only
`review-pr` would have caught it — as a `should-fix` on a missing link,
once the review loop reached the PR.

So this one skill drops the flag. What replaces it is the trigger surface:
a description that fires on a request to open or refresh a PR and on
nothing else, and a pre-flight exit when nobody asked for one. The skill
pushes, so a stray phrase must not reach it.

Nothing else changes. Every pipeline step keeps its gates, and the loop's
own invocations — implement-ticket, address-review — behave as before.

`workflow/skills/AGENTS.md` names the exception, so the next skill audit
does not put the flag back, and `docs/why.md` carries the failure.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYy6xh14eBuBZcxind
Four findings from the review pass.

The exit sat in step 0, which every caller runs, so a cloud run handed the
branch by implement-ticket step 11 could read "nobody asked for a PR" as
its own case and end with the branch unpushed. It now gates the model's own
fire, and says that a person running the session asks, and so does a skill
handing over the branch.

It also tested that someone asked, not that the user did. The flag it
replaces was what kept this pushing pipeline out of reach of untrusted
GitHub text, so the exit now says GitHub text never asks, and cites
docs/why.md#an-outsider-feeds-a-member-fires.

`finalize-pr` is not the only skill that omits the flag — dev-server,
format-ticket, start-run and finish-run do too, as helpers. The guide and
the story drop the claim that it is.

The description called the Preview section mandatory, which is only true
where the repo deploys previews. SahajAtlasWordpress omits it, and the
description is the copy a session reads without the body.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYy6xh14eBuBZcxind
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 21, 2026
@sydevs-bot

sydevs-bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 00:33Z address-review · attempt 1 · session · done
  • 00:33Z address-review · attempt 1 · session
  • 00:25Z review-pr · attempt 1 · session · done
  • 00:25Z review-pr · attempt 1 · session

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 21, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🧐 Adversarial review

The diff is the size of its ticket: five files, 29 added lines, one behaviour, and the version bump an install needs. The recorded decision (Ardnived, 2026-11-20) picked this shape over extracting step 7, so nothing here re-litigates it, and nothing is smuggled in.

Two prose defects to fix, and prose is the whole deliverable. The new pre-flight exit names who may ask for a PR, and its list leaves out the handler start-run's incidental-finding rule sends to open a ticketless docs or test PR — the one caller with no person and no handed-over branch. And docs/why.md still claims finalize-pr is alone in dropping the flag; dev-server dropped it too.

Findings

  • should-fix — the pre-flight exit's askers miss start-run's ticketless-PR path (workflow/skills/finalize-pr/SKILL.md:77)
  • should-fix — "alone among the skills a person or the loop invokes" is false (docs/why.md:303)
  • consider — the description carries two non-trigger clauses, paid on every session (workflow/skills/finalize-pr/SKILL.md:3)

What was checked

  • Ticket #292: all four acceptance criteria hold, and no step the loop's own callers reach is changed.
  • Read whole on the branch: finalize-pr/SKILL.md, skills/AGENTS.md, the new docs/why.md section, docs/documentation.md.
  • Frontmatter of all 22 skills: dev-server is the second one without the flag, which is finding 2. The tool grant is unchanged, so no new reach.
  • new-pieces.mjs: NONE. No streamliner, no ladder walk, no new dependency, no contract surface.
  • Preview links: none, and .claude/workflow.json on main declares no previewUrl and no fixture. Every path the body cites exists on the branch.
  • rule-delta.mjs on main counts 93 directives to the body's 92 — #293 merged after this branch was cut.
  • No open question threads. Profile read.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread workflow/skills/finalize-pr/SKILL.md Resolved
Comment thread docs/why.md Resolved
Comment thread workflow/skills/finalize-pr/SKILL.md Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Nov 21, 2026
start-run's incidental-finding rule sends a handler that otherwise never
pushes here to open a ticketless docs or test PR. No person asks there,
and the run creates the branch itself, so neither named asker covered it:
a literal reader exited and dropped the fix.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXynNWRz4u2joFjv6F
dev-server carries no disable-model-invocation either, and README lists
it as a user command, so "alone among the skills a person or the loop
invokes" was false. The guide called dev-server a helper for the same
reason; it names it as the second exception instead.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXynNWRz4u2joFjv6F
Every session in all five repos loads it. "The only path to one" is a
rule, stated where it binds at implement-ticket:176 and README:112, and
the opening restated the verbs the trigger sentence lists.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXynNWRz4u2joFjv6F
The branch bumped to 5.9.0 before #293 merged with the same number. An
install caches by version, so merging at 5.9.0 would leave every
installed plugin on #293's skills, never seeing this change.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXynNWRz4u2joFjv6F
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Adopted all three review threads, on a clean origin/main merge (f5ed5d1, #293).

Rebutted nothing. plugin.json moves to 5.10.0: #293 merged with 5.9.0, an install caches by version, so merging at 5.9.0 would hide these skills from every installed plugin. 1fd2f6f

Gate: validate ✓, 156/156, rule-delta 93 → 93. /security-review re-ran: no findings.

Anomaly: update_pull_request dropped the body's trailing attribution footer on both writes.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 21, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review November 21, 2026 00:42
@sydevs-bot
sydevs-bot requested a review from Ardnived November 21, 2026 00:42
@sydevs-bot
sydevs-bot enabled auto-merge November 21, 2026 00:42
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 21, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Nov 21, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Pending in SYDevelopers Technical Roadmap Nov 21, 2026
Merged via the queue into main with commit da7f9f5 Nov 21, 2026
67 of 71 checks passed
@sydevs-bot
sydevs-bot deleted the claude/feat-292-finalize-pr-model-invocable branch November 21, 2026 02:15
@sydevs-bot sydevs-bot moved this from Pending to Done in SYDevelopers Technical Roadmap Nov 21, 2026
sydevs-bot pushed a commit that referenced this pull request Nov 21, 2026
Conflict: workflow/.claude-plugin/plugin.json version. main bumped 5.9.0 -> 5.10.0 for #294's new capability; this branch had bumped 5.9.0 -> 5.9.1 for its merge-gate.mjs export. Resolved to 5.10.1 — main's minor stands, and this branch's workflow/lib change still carries a bump above it, so the plugin cache key moves for both.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWpqKoZPiBkxF32cJB
sydevs-bot pushed a commit that referenced this pull request Nov 21, 2026
The `test` check failed on "Plugin files changed but version is still
5.10.0". This branch ships a change to `workflow/lib/payload.mjs`, which an
install reads, and the cache directory is named after `version`, so the
change would never reach an installed plugin.

The branch never bumped the version itself. It merged `main` at 03cd9ea, and
#294 had already taken 5.10.0 there, so base and head arrived at the same
string. The earlier green run on 3afc529 proves the collapse rather than
contradicting it: at that head nothing under `workflow/lib` had changed yet,
so the step exited before comparing. `payload.mjs` changed in b7b72c2, after
the merge.

5.10.1, not 5.11.0: the one shipped change is a guard on a handler name, and
main reserves a minor for a feature.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVt9URFoNsCm6Qw4j9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

feat(finalize-pr): let a session open its PR through finalize-pr

3 participants