Skip to content

fix(pr-review-toolkit): launch review workflow by plugin-workflow name - #97

Merged
cblecker merged 2 commits into
mainfrom
claude/pr-review-toolkit-scriptpath-break-rszvsv
Aug 31, 2026
Merged

fix(pr-review-toolkit): launch review workflow by plugin-workflow name#97
cblecker merged 2 commits into
mainfrom
claude/pr-review-toolkit-scriptpath-break-rszvsv

Conversation

@cblecker

@cblecker cblecker commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Problem

Claude Code 2.1.251 hardened the Workflow tool: scriptPath is now validated against the session's readable set (working directory, /add-dired directories, session-internal paths, explicit Read(...) allow rules) before the file is opened. The review-pr skill launched its analysis workflow via scriptPath: ${CLAUDE_SKILL_DIR}/review-pr.js, which expands to an absolute plugin-cache path — outside that set in any normal session, worktree or not. The launch now fails with:

scriptPath must be a script path this tool returned, or a file you can already read (the working directory or a directory you have added): <plugin-cache>/.../skills/review-pr/review-pr.js

Symlink/hardlink indirection is defeated by a realpath re-check in the same hardening, and passing inline script alongside an out-of-scope scriptPath is also rejected, so the launch mechanism itself had to change.

Fix

Register review-pr.js as a plugin workflow and launch it by name:

  • plugin.json: add "workflows": ["./skills/review-pr/review-pr.js"] (a manifest key recognized by Claude Code's plugin loader; validated with claude plugin validate). The script registers as pr-review-toolkit:review-pr-analysis, and name-mode resolution loads its content through the CLI itself as installed-plugin content — the model's read scope is never involved, so it works under worktree isolation and every permission mode. Version bumped 2.0.1 → 2.1.0 (minor: new plugin component, backward-compatible behavior change).
  • review-pr.js: the workflow's meta.name is review-pr-analysis, deliberately distinct from the skill's name. Registered plugin workflows surface as slash commands under <plugin>:<workflow-name>, so a workflow named review-pr would claim the same qualified name as the skill and shadow its /pr-review-toolkit:review-pr entry — dispatching bare workflow invocations (which fail on the arg guards) instead of the skill that computes those args. The description marks the workflow as internal and points to the skill. Nothing else in the script changed.
  • SKILL.md: the launch step invokes Workflow with name: pr-review-toolkit:review-pr-analysis and the same args. If the name is not found (older Claude Code without plugin workflows — versions that also predate the scriptPath restriction), it falls back to the original ${CLAUDE_SKILL_DIR}/review-pr.js scriptPath launch; if both fail, it stops with an honest error.
  • README.md: workflow section and control-flow diagram updated to name-mode, plus a compatibility note covering the 2.1.251 hardening and the name-collision rationale.

The file stays in the skill directory (declared via the manifest key rather than moved to a workflows/ dir) so the fallback path remains valid; ${CLAUDE_PLUGIN_ROOT} is not substituted in SKILL.md content, only ${CLAUDE_SKILL_DIR} is.

Verification

  • claude plugin validate . and claude plugin validate ./pr-review-toolkit pass with the new manifest key
  • npx markdownlint-cli2 — 0 issues; uvx skillsaw --strict — 0 errors/warnings, grade A
  • End-to-end registration on Claude Code 2.1.251: installed this repo as a local marketplace; a fresh session's Workflow tool lists pr-review-toolkit:review-pr-analysis as an available named workflow (and no longer lists a colliding pr-review-toolkit:review-pr workflow) — confirming the script loads and its meta parses through the plugin-workflow loader
  • Slash dispatch after the rename: /pr-review-toolkit:review-pr reaches the skill (runs its preflight and constraints), not the workflow's auto-generated command wrapper
  • A full review run needs a real PR checkout: worth exercising /pr-review-toolkit:review-pr on a PR after installing 2.1.0

🤖 Generated with Claude Code

https://claude.ai/code/session_014c2jqqgQhooKnviBPN8tjY


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added a registered workflow for pull request analysis.
    • Updated the review command to use the new workflow while preserving compatibility with older tool versions.
  • Documentation

    • Clarified workflow naming, invocation, and compatibility behavior.
    • Updated diagrams and guidance to distinguish the analysis workflow from the primary review command.
  • Chores

    • Updated the plugin version to 2.1.0.

Claude Code 2.1.251 validates Workflow scriptPath against the session's
readable set (working directory, added directories) before opening the
file, so the skill's plugin-cache scriptPath is now rejected in normal
sessions. Register review-pr.js as a plugin workflow via the manifest
`workflows` key and launch it as `pr-review-toolkit:review-pr`, which the
CLI loads as installed-plugin content without involving the model's read
scope. Older CLIs without plugin workflows predate the scriptPath
restriction, so the skill falls back to the original scriptPath launch
there. The workflow script itself is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014c2jqqgQhooKnviBPN8tjY
Copilot AI balanced review requested due to automatic review settings August 31, 2026 18:49
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8a6ffa95-0f1e-48cc-89c2-3ff8406495bf

📥 Commits

Reviewing files that changed from the base of the PR and between 5ea27b1 and 9f0b320.

📒 Files selected for processing (3)
  • pr-review-toolkit/README.md
  • pr-review-toolkit/skills/review-pr/SKILL.md
  • pr-review-toolkit/skills/review-pr/review-pr.js

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The plugin registers review-pr.js as pr-review-toolkit:review-pr-analysis. The skill invokes this workflow by name and falls back to scriptPath when older Claude Code versions do not register plugin workflows.

Changes

Review workflow registration

Layer / File(s) Summary
Register the analysis workflow
pr-review-toolkit/.claude-plugin/plugin.json, pr-review-toolkit/skills/review-pr/review-pr.js
The manifest version changes to 2.1.0 and registers review-pr.js. The exported workflow metadata uses the review-pr-analysis name and describes its required arguments.
Invoke the named workflow with fallback
pr-review-toolkit/skills/review-pr/SKILL.md, pr-review-toolkit/README.md
The skill invokes pr-review-toolkit:review-pr-analysis and retries with scriptPath when the workflow is unavailable. The README documents the renamed workflow and both execution paths.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 9f0b3

The PR changes review workflow launch and compatibility handling; no actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant ReviewSkill
  participant ClaudeCode
  participant ReviewScript
  ReviewSkill->>ClaudeCode: Invoke pr-review-toolkit:review-pr-analysis with args
  ClaudeCode->>ReviewScript: Load registered plugin workflow
  ClaudeCode-->>ReviewSkill: Return workflow result
  ClaudeCode-->>ReviewSkill: Report workflow name not found
  ReviewSkill->>ClaudeCode: Retry with scriptPath and args
  ClaudeCode->>ReviewScript: Execute review-pr.js
  ClaudeCode-->>ReviewSkill: Return fallback result
Loading
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: launching the review workflow by its plugin-workflow name.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/pr-review-toolkit-scriptpath-break-rszvsv

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI 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.

🟢 Approval recommended

The manifest, skill instructions, documentation, and version bump are consistent and complete.

Pull request overview

Registers the review script as a named plugin workflow to remain compatible with Claude Code’s hardened path validation.

Changes:

  • Adds named workflow registration and bumps the plugin version.
  • Uses name-based invocation with a legacy fallback.
  • Documents the workflow and compatibility behavior.
File summaries
File Description
pr-review-toolkit/.claude-plugin/plugin.json Registers the workflow and bumps version.
pr-review-toolkit/skills/review-pr/SKILL.md Updates launch and fallback instructions.
pr-review-toolkit/README.md Documents named invocation and compatibility.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

…kill

Plugin workflows register as <plugin>:<meta.name> and surface as slash
commands, so a workflow named review-pr claimed the same qualified name
as the review-pr skill and won slash dispatch: bare invocations skipped
the skill's setup (PR resolution, head verification, merge-base pinning)
and hit the workflow's arg guards. Rename the workflow to
review-pr-analysis, update the skill's name-mode launch to match, and
mark the workflow description as internal so its command wrapper steers
users back to /pr-review-toolkit:review-pr. Verified in a fresh install:
the workflow registry lists only the new name, and slash dispatch of
/pr-review-toolkit:review-pr reaches the skill's flow again.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014c2jqqgQhooKnviBPN8tjY
Copilot AI review requested due to automatic review settings August 31, 2026 19:06

Copilot AI 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.

🟡 Changes recommended

The PR description advertises and claims verification of a workflow name different from the implemented name.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread pr-review-toolkit/skills/review-pr/review-pr.js
@cblecker
cblecker merged commit bf6c70b into main Aug 31, 2026
14 checks passed
@cblecker
cblecker deleted the claude/pr-review-toolkit-scriptpath-break-rszvsv branch August 31, 2026 20:13
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.

3 participants