Skip to content

fix(plugin-profiles): refuse a second /plugin-profile while its picker pane is open - #17071

Merged
kyle-sexton merged 2 commits into
mainfrom
fix/16816-picker-guard
Nov 18, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
fix/16816-picker-guard

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #16816

Summary

A second /plugin-profile while the picker pane is open is now refused with a line saying a pick is already open, and the pick in the pane still completes. This fix also covers the two edge cases pr-verify noted on #16827, both listed in the issue's comments: a pick that ignored a switch already waiting for its reload, and an open-pane flag that a reload of the plugin's code reset.

Fix

plugins/plugin-profiles/hooks/register.tsx:

  • Refusal. switchProfile first asks $.ui.panes() whether the picker pane is open. If it is, /plugin-profile is refused with or without a profile name, so a named profile can no longer arm a second switch beside the open pick. The refusal line: A profile pick is already open in its pane; pick there, or press Cancel and run /plugin-profile again.
  • No module flag. The module-level picking flag is removed, because a reload of the plugin's code reset it. Whether the pane is open now comes from $.ui.panes(), which is Claude Code's own record and outlives a reload. A short-lived settling flag is kept only so a double press settles once.
  • A switch already waiting. picked checks for a switch waiting for its reload again before it switches, and reports the same waiting line /plugin-profile gives.
  • Closing the pane. The ui.close hook reports "No profile chosen" only when the close's origin.kind is person. A row press or Cancel closes the pane through picked, which reports the outcome itself.
  • No pane placed. Where the pane cannot be placed, the open is closed before the paged picker asks, so a pane left waiting undrawn cannot block the next /plugin-profile.

CI already runs the mod tests

The issue asked to check this. The Check Catalog job runs scripts/validate-plugins.sh, which runs scripts/test-plugin-mods.sh, which runs claude plugin test plugins/plugin-profiles. Evidence: Check Catalog run on #17045, job 134605969292, log line === claude plugin test plugins/plugin-profiles === followed by 34 pass. No workflow names claude plugin test directly, which is why the comment on the issue found none. Like the other test lanes, Check Catalog skips draft PRs.

Verification

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01VcupooMdcrBzDGnAi3Mejz

…r pane is open

The picker kept whether its pane was open in a module variable, which a
reload of the mod reset, and nothing refused a second /plugin-profile while
the pane was up, so a named profile could arm a second switch beside the
open pick. The command now asks Claude Code whether the pane is open
($.ui.panes(), which outlives a reload), refuses a second run with a line
saying a pick is already open, and a pick in the pane is refused while a
switch from before waits for its reload. The person's own close is told
apart by the close's origin instead of the variable.

Closes #16816

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VcupooMdcrBzDGnAi3Mejz
@kyle-sexton

Copy link
Copy Markdown
Member Author

Owned by the hub session Plugin Presets; it watches checks and review threads and merges.

@kyle-sexton
kyle-sexton marked this pull request as ready for review November 18, 2026 06:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 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-18T09:34:04.124251Z 4005824 Manual request
ℹ️ 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: ec39443207

ℹ️ 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".

Two row presses could both read settling as false while the first
pickerOpen lookup was pending, so both closed the pane and ran a
switch. The guard is now set before that lookup and released in
finally, including when the pane is already closed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

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

Security review: PR #17071, plugin-profiles picker guard

I found no security issues. I read every hunk of all 3 changed files: the changelog fragment, plugins/plugin-profiles/hooks/plugin-profile.test.ts and plugins/plugin-profiles/hooks/register.tsx.

What the change does. It changes how the local /plugin-profile picker decides its state, inside the user's own session:

  • Pane check. A module-level picking flag is replaced by a check of $.ui.panes().
  • Double-press guard. A short-lived settling flag stops two row presses from settling twice. It is taken before the first await and released in finally.
  • Pending-switch check. picked now checks for a switch still waiting for its reload before it switches.
  • Close message. The ui.close hook logs "No profile chosen" only when a person closed the pane.
  • No pane placed. When the pane cannot be placed, it is closed before the paged picker asks.

What I checked:

  • Untrusted input. None reaches this code. The profile name still comes from the session user's own slash-command argument or a pane row press, as on the base. It still goes to the CLI as a separate argv element ($.process.run(['node', ..., ...args])), so the change adds no shell or injection surface.
  • Tokens, credentials and network. No token, credential or network handling is added. The CLAUDE_CODE_SESSION_ID env passing is unchanged.
  • Plugin manifests. No .claude-plugin/plugin.json or marketplace.json is touched. There are no userConfig, hooks or mcpServers changes.
  • Trusted paths and controls. No changed file matches a TRUSTED PATHS: glob. No trust control, merge hold, kill switch or token scope is touched.
  • Instruction surface. No standing instruction (skill, agent, CLAUDE.md or hook allowlist) is deleted or softened.
  • Earlier threads. One owner-replied thread on register.tsx (the settling race, fixed in 4005824) shows no lines changed since it was resolved. Its point is settled and I did not raise it again.
  • Embedded instructions. The PR context holds no text telling this lane to pass the PR, skip a check or drop a finding.

Spend. The change starts no charge and spends no extra credits.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #17071, fix(plugin-profiles): refuse a second /plugin-profile while its picker pane is open

No blocking or advisory findings. I read all 3 changed files in full: the changelog fragment, register.tsx and plugin-profile.test.ts.

Closing issue #16816

  • "A second /plugin-profile while the pane is open is refused … and the first command still settles": met. Before it does anything else, switchProfile returns PICK_OPEN when $.ui.panes() lists the picker (register.tsx#L144). This refuses both the bare form and the named form, and the open pane's pick still settles through picked.
  • "A claude plugin test case covers it": met. The new test "Refuse a second /plugin-profile while its picker pane is open #16816: a second /plugin-profile while the pane is open is refused, and the first pick still settles" checks both forms of the refusal, that only one pane opened, and that the pane's pick still runs.
  • Edge cases from the issue comments: both are handled and tested.
    • picked checks for a switch still waiting for its reload before it switches (L83).
    • The module-level picking flag is gone; whether the pane is open now comes from the engine's pane record. This matches how plugins/context-budget/hooks/register.tsx already checks its own pane (paneOpen).
  • Mod tests in CI: the PR says the Check Catalog job runs claude plugin test plugins/plugin-profiles through scripts/test-plugin-mods.sh. That claim, and the reported test counts (37 in the PR, 38 in the thread reply), come from the author; I have not checked them.

Other checks

  • Settled thread on the double-press race (register.tsx, original line 79): the job reports no lines changed since resolution. At this head, settling is set before the first await and cleared in finally. The new two-press test covers it, so I am not raising it again.
  • Concurrency of picked: at this head, a second press returns before its first await. A press after the pane closed returns early, and settling is cleared on every path.
  • ui.close hook (L275): it now logs "No profile chosen" only when a person closes the pane. When picked closes the pane itself, the existing Cancel test asserts the message is logged exactly once.
  • No pane placed: closing the unplaced open before the paged picker asks keeps a pane that never drew from blocking the next /plugin-profile.
  • Changelog fragment: the patch bump fits a bug fix with no API or config change. No plugin manifest changed.
  • Embedded text: none of the PR context, settled-threads or prior-findings files tells the lane to approve, skip a check or post elsewhere.
  • Paved paths: I did not resolve the standards index, so this review reports nothing about paved paths.

Checks that loosen

None: the PR only adds tests and changes no existing assertion.

Loosened-check verdict: fail (default; no loosened_check_verdict: or loosened_check_patterns: line in the prompt); patterns: 0

Verifier dropped 0 of 0 candidates.

@kyle-sexton

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 4005824ecc

ℹ️ 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
kyle-sexton added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit da09751 Nov 18, 2026
52 checks passed
@kyle-sexton
kyle-sexton deleted the fix/16816-picker-guard branch November 18, 2026 09:41
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 18, 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.

Refuse a second /plugin-profile while its picker pane is open

1 participant