Skip to content

fix(plugin-profiles): print a PowerShell launch line on Windows - #18250

Merged
kyle-sexton merged 2 commits into
mainfrom
fix/18219-profiles-windows-launch
Nov 22, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
fix/18219-profiles-windows-launch

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #18219

Summary

profiles.mjs launch always printed env -u ... claude --settings <file>, which PowerShell and cmd cannot run, so a Windows lane or handoff could not start a session in a profile from that line.

Fix

  • scripts/profiles.mjs: new exported launchCommand(argv, platform). On win32 it prints Remove-Item Env:PLUGIN_PROFILES_SESSION, Env:PLUGIN_PROFILES_SESSION_FILE, Env:SESSION_SETTINGS_FILE -ErrorAction Ignore; claude --settings '<file>', with PowerShell single-quote quoting; other platforms keep the env -u line.
  • argv keeps its shape, because the fleet relay's Windows script reads the variables after -u and the words after claude from it.
  • plugins/fleet/skills/reach/reference/relay.md: drops the sentence calling the printed command a POSIX line on Windows.

Verification

  • New test #18219 checks the Windows line (a path with a space and an apostrophe) and the unchanged POSIX line; the launch tests pass (16).
  • The Remove-Item line clears a set variable in Windows PowerShell 5.1 and pwsh 7 on a Windows host.

Related

  • Item 3 of the plugin-profiles acceptance run (start and resume in a profile on native Windows) needs this.
  • Known limit: Remove-Item Env: clears the variables in the PowerShell session it runs in, not only for claude; they are profile markers inherited from an earlier session, so clearing them is the intent.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RAoAtSsNvSGmqHFVRFAugW

@kyle-sexton
kyle-sexton marked this pull request as ready for review November 22, 2026 21:49
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 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-22T21:51:52.712290Z 16c3c97 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: 16c3c97b69

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

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

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

Security review: PR #18250, incremental since 16c3c97

No security issues found. This was a blocking-only review: the lane already reviewed an earlier head, so only CRITICAL and IMPORTANT findings would be reported.

I read every hunk of all 3 files in scope: the changeset fragment, plugins/plugin-profiles/scripts/profiles.mjs and plugins/plugin-profiles/scripts/profiles.test.mjs. None of them matches a trusted-path glob. None touches a trust control, a merge hold, a plugin manifest, a workflow or a standing instruction.

What was checked

The new branch in launchSettings (profiles.mjs#L732-L738). When launch gets inline --with JSON and no profile, it now writes that JSON to a session file. Before, it passed the raw JSON to --settings.

  • What gets written. The content is JSON.stringify(own). own is the JSON object that launcherSettings parsed from the user's own argument (L661-L673), and only an object is accepted.
  • Where it is written. The path comes from sessionFile(where, "with", text) (L377-L378). It sits under the user's own data folder (dataDir/sessions). The file name is built from a hash of the project path, the fixed word with and a hash of the content, so no input can move the path outside that folder.
  • Cleanup. sweepSessions keeps the file just written and removes only .json files older than SESSION_DAYS in the same sessions folder (L676-L687). The profile branch already did the same, so this deletes nothing it did not delete before.
  • Dry run. A dry run prints the path and writes nothing.
  • The printed launch line. It now carries only a file path, so no JSON reaches the shell line. That removes the quoting surface the settled thread raised, rather than adding one.
  • Who controls the input. Only the local user who runs the command. No pull request, repository or remote input reaches this code.

The test only updates its assertions to the new file-based behaviour.

Settled threads. Both threads on profiles.mjs line 744 are marked lines changed since resolution: no. The owner replied with a decision, and this head carries that fix. I raised nothing again.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-review: 1 inline finding(s) on 16c3c97b6980f14972e516fc5fd974230fe95596; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

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

Code review (incremental, blocking only): PR #18250, d7703c7

This was an incremental review of the push since 16c3c97b. It covered three files: the changelog fragment, profiles.mjs and profiles.test.mjs. This lane had already reviewed an earlier head of this PR, so it reported blocking findings only.

What changed. In launchSettings, inline --with JSON used with no profile is now written to a session file, <folder-hash>-with-<content-hash>.json. --settings gets that file's path instead of raw JSON. The change applies on every platform, so the PowerShell line no longer carries a JSON argument with embedded ". This resolves this lane's earlier finding (thread r4660204752, settled by the owner's reply on unchanged lines).

Checked, no finding:

  • The file name cannot collide with a profile's session file. A profile's file has no content suffix, or a hash of the merged document.
  • A dry run computes the path but writes nothing, as the profile branch already does.
  • sweepSessions keeps the new file and runs after replaceFile, so the sessions directory exists before it is read.
  • The with file sets none of the profile session variables, so nothing will mistake it for a profile session.
  • start shares launchSettings and gets the same file path.
  • The updated test checks three things: the argv path, the file's content, and that no { appears in the printed command.

Closing issue #18219. "A command a Windows shell can run" is now met for the inline-JSON case as well. The new test covers that case through the launch path, not only through launchCommand.

Not verified by me: that the tests pass, and that the printed line works on Windows PowerShell 5.1. Both are the author's claims; I ran nothing.

Loosened checks would be marked: fail (the prompt had no loosened_check_verdict: or loosened_check_patterns: line, so the default was used); patterns: 0. No loosening found. With no loosened_check_decision_record: line, the citation requirement was not checked.

No plugin manifest changed in this push. The fragment stays bump: patch, which fits a bug fix. No embedded instructions were found in the PR context, settled threads or prior findings.

Verifier dropped 0 of 0 candidates.

With no profile, launch put inline --with JSON straight into
--settings. Windows PowerShell 5.1 strips the quotes inside a native
command's argument, so claude received invalid JSON. Write the JSON to a
session file on every platform and pass its path, as the profile branch
already does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit 178370a Nov 22, 2026
56 checks passed
@kyle-sexton
kyle-sexton deleted the fix/18219-profiles-windows-launch branch November 22, 2026 22:41
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 22, 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.

plugin-profiles: launch prints an env -u command that Windows cannot run

1 participant