Skip to content

fix(fleet): remove the Windows relay prompt file on every exit and refuse a dash-led background prompt - #16641

Merged
kyle-sexton merged 4 commits into
mainfrom
fix/16638-windows-relay-review-notes
Nov 16, 2026
Merged

kyle-sexton merged 4 commits into
mainfrom
fix/16638-windows-relay-review-notes

Conversation

@kyle-sexton

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

Copy link
Copy Markdown
Member

Closes #16638

Summary

Closes the three review notes left on #16631's Windows-lane profile start in plugins/fleet/skills/reach/reference/relay.md. A background prompt that begins with - no longer reaches claude.exe. The prompt file is removed on every path the script exits by. An eval grader fails a background prompt passed outside Q.

Fix

  • Option-shaped prompt. A background start gets one more line before the start line: when the prompt file begins with -, $stop is set to "not started: a background prompt must not begin with -", and the section says to begin such a prompt with a word instead. Basis: on R1, Q '--version' passed as the only argument made claude.exe print its version, so a quoted argument starting with - is read as an option. A -p prompt arrives on stdin and is not affected.
  • Prompt file removal. Each stop now goes into $stop instead of exiting where it happens, and Remove-Item $p -ErrorAction Ignore runs on a line of its own before the exit line. Two parts of this are new:
    • The argv line presets $stop and clears it only when it finds claude, so a launch that prints no JSON stops instead of starting without the profile.
    • The exit line reports "claude.exe did not start" when Start-Process returns nothing.
    • The section names the one path that leaves the file: a PowerShell killed, or a connection lost, before the removal line. It says why that is accepted: the next start with the same <name> overwrites the file, and it holds only the prompt this session already wrote.
  • Eval grader. background-prompt-through-q in reach-start-in-profile-windows fails an answer that starts the background session with & $claude … --bg or appends [IO.File]::ReadAllText($p) after the Q-joined arguments. Its pass samples are the documented -p script and its background form.
  • launch-refusal-stops now matches the $LASTEXITCODE guard followed by exit 1 anywhere after it, because the refusal now exits through $stop.
  • The samples are built from the script lines in relay.md, so they match the documented text.

Review round 1 (code lane):

  • Dash line. It now goes "immediately before the start line" and reads if (-not $stop -and …StartsWith('-')), so it cannot overwrite an earlier stop. Rerun on R1:
    • With launch also refused, the refusal's reason was reported.
    • A dash-led prompt alone stopped.
    • The profile applied with a plain background prompt started.
    • No path left the file.
  • launch-refusal-stops. The match is now tied to the guard's own body ($stop = or exit 1 inside its braces). A new fail sample has a guard that prints but does not stop.
  • New graders: background-dash-guard (required when an answer uses --bg) and removes-prompt-file-before-exit (a Remove-Item $p line of its own). Each has a fail sample.
  • Samples. Every sample now has its own label. The background pass sample is the full documented background form: the dash line, then the start line.

Done-when, item by item:

  • A background start whose prompt begins with - cannot be read as an option. Shown on a Windows lane (R1) with --version: the guarded script printed the stop line and exited 1 without starting claude.exe, and the unguarded Q '--version' printed the version.
  • The prompt file is removed on every path the script exits by. Each path was run on R1, and the section names the killed or disconnected case and why it is accepted.
  • A grader in reach-start-in-profile-windows fails an answer that passes the background prompt outside Q, with pass and fail samples.

Verification

All on R1 (melo-lap-001's Windows lane; Windows PowerShell 5.1; Claude Code 2.1.325). The script lines were taken from relay.md, with --version in place of -p -n <name> so no agent started, and a stub profiles.mjs for the launch outcomes:

Path Exit Prompt file left
plugin-profiles not installed (start without the profile) 0 no
launch refused (stub exit 1) 1 no
launch output not JSON 1 ("printed no claude command") no
profile applied (stub argv) 0 no
claude.exe missing 1 ("claude.exe did not start") no
background prompt --version, with the new line 1 ("must not begin with -") no

The stub and probe files were removed. Other checks:

  • validate-cases.py plugins/fleet/evals: no FAIL.
  • scripts/check-as-of-recheck.sh --check: exit 0.
  • The pre-push hooks passed.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_015XWwmchG8Tg8XKYxMrgKKq

@kyle-sexton
kyle-sexton marked this pull request as ready for review November 16, 2026 21:17
@kyle-sexton

Copy link
Copy Markdown
Member Author

Owner: the session plugin-profiles-build-6, working for the control-hub session "Plugin Presets". Ready steps: branch current with main (head 92bdc5e); code and security review left to their CI lanes (both healthy); tests run locally (eval-suite validator, as-of recheck gate, pre-push check-affected, and every exit path of the script run on a Windows lane as the body records). Review findings go through Plugin Presets.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 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-16T21:18:51.326116Z 92bdc5e 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.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

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

Security review: PR #16641 (incremental, 92bdc5e → db6980c)

No security issues found. This was an incremental review covering only the changes since the last head. I read every hunk of all 15 listed files in .claude-lane/incremental.diff. This lane has already reviewed an earlier head, so the review was blocking only: it would have reported CRITICAL and IMPORTANT findings and nothing lower, and there were none. No changed file matches a TRUSTED PATHS glob, and none is a plugin manifest.

What changed:

  • Background dash guard (plugins/fleet/skills/reach/reference/relay.md, around L253-L257). The line now reads if (-not $stop -and [IO.File]::ReadAllText($p).StartsWith('-')) { $stop = ... }, and the doc now says to place it immediately before the start line. The guard is not weakened: when $stop is already set, the dash check is skipped, but the start line is also gated on -not $stop, so claude.exe still does not run. A dash-led prompt still never reaches claude.exe as an option. The only effect is that an earlier stop reason (for example, the launch refusal) is no longer overwritten in the message that gets reported.
  • Verification table row (relay.md around L337). This is prose only: it records the added "launch refused plus dash" exit path.
  • Eval grader (plugins/fleet/evals/reach-start-in-profile-windows/case.yaml). The launch-refusal-stops regex is tightened so that an answer that prints the refusal but does not stop now fails. Two graders are added: background-dash-guard and removes-prompt-file-before-exit. These are regexes over model output and run no code.
  • Eval samples. Two sample files are new. The rest only reword their why strings or replace one fail sample with more targeted ones. They are test data that nothing executes.

Instruction surface: the skill reference narrows where the guard goes and adds a condition that still fails closed. No rule is removed or weakened, so there was nothing to check against the instruction exception register.

Trust controls: none of the trusted-trigger, token-request, kill-switch, broker or merge-hold code is touched.

Untrusted text: nothing in the prior-findings file directs the review. I did not open the PR context file this round, so it was not checked.

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: 5 inline finding(s) on 92bdc5e5e66d1d5e1df34c49e2072d3b356870e7; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

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

Code review: PR #16641 (blocking only)

This lane already reviewed an earlier head, 92bdc5e5, so this round reports blocking findings only. I read every hunk of all 16 changed files. I found nothing blocking.

Earlier findings. The five inline findings from the last round were all resolved in the push ending at db6980c2. I checked each fix against the current head:

  • launch-refusal-stops. The match is now tied to the guard's own braces (case.yaml:45). The new fail sample, whose guard prints "launch exited $LASTEXITCODE", does not match it. The documented $stop = form does.
  • background-dash-guard. It is new at case.yaml:65-69. An answer with no --bg passes through the ^(?![\s\S]*--bg\b) branch, and the documented dash line matches the other branch. The fail sample, the background form without the dash line, matches neither.
  • removes-prompt-file-before-exit. It is new at case.yaml:70-74. With flag m, the standalone Remove-Item $p -ErrorAction Ignore line matches. In the fail sample the removal follows }; at the end of the start line, so it does not.
  • background-prompt-through-q. Neither pass sample matches the not_contains pattern. The & $claude plugin list --json line has no --bg, and in the background form [IO.File]::ReadAllText follows a comma, not a +. Each fail sample matches one branch.
  • Dash-line placement. relay.md now says "immediately before the start line" and guards on -not $stop, so the dash line can no longer replace an earlier stop's reason.

Closing issue #16638, done-when items:

  1. A background prompt that begins with - cannot be read as an option. The section documents the guard, and background-dash-guard fails an answer without it.
  2. The prompt file is removed on every exit path, or the section names the path that leaves it. Every stop goes through $stop, and the unconditional removal line runs before the exit line. The section names the killed or disconnected PowerShell case and why it is accepted. removes-prompt-file-before-exit covers the removal line.
  3. A grader fails a background prompt passed outside Q. background-prompt-through-q has two pass and two fail samples.

The exit-path table and the Q '--version' result on R1 are the author's own runs. I did not repeat them. I had no shell, so I did not run validate-cases.py against the samples. I checked the grader regexes against the sample text by reading them.

The changelog fragment's bump: patch fits a documentation and eval fix. No plugin manifest changed.

The PR context and the settled threads contain no embedded instructions. This change spends nothing.

I started no subagents, so there was no separate verifier pass. Verifier dropped 0 of 0 candidates.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit 0a5115a Nov 16, 2026
45 checks passed
@kyle-sexton
kyle-sexton deleted the fix/16638-windows-relay-review-notes branch November 16, 2026 23:26
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 16, 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.

Close three review notes on the relay's Windows-lane profile start

1 participant