Repository navigation
Fix proactivity spawn prompt quoting on Windows (0.5.5) - #8
Merged
Merged
Conversation
The spawn command wrapped inner placeholders like brief_path, job_id, and --error "<concrete error>" in double quotes. quote_for_cmd then doubled them to "" which cmd interpreted as quote-close-then-open, fragmenting the prompt into 28+ separate tokens. Spawned Claude sessions received stray --error / --summary / --job-id args and rejected them. Switch inner placeholders to single quotes. cmd passes ' through verbatim, so the whole prompt reaches the spawned session as one intact argument. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Morning proactivity spawn on Windows was shipping a fragmented prompt to the spawned Claude session.
Before: inner placeholders (
"{brief_path}","{job_id}",--error "<concrete error>") used double quotes.quote_for_cmddoubled them to""..."".cmd interpreted each""as quote-close-then-open and split the prompt into 28+ separate tokens. The spawned session received stray args like--error,--summary,--job-idas bare CLI flags and rejected them before ever reading the brief.After: placeholders use single quotes. cmd doesn't treat
'as a quote char, so the whole prompt survives as one intact argument.This PR also folds the Claude-side proactivity fix into Munin: Claude proactivity launches now preserve the inherited Claude/Anthropic environment instead of clearing
CLAUDECODE,ANTHROPIC_API_KEY, andANTHROPIC_AUTH_TOKENbefore starting the spawned session.Companion fix (outside this repo)
The original failure also surfaced as
AmbiguousParameter: errorin the user's local~/bin/claude.ps1wrapper, because[Parameter(ValueFromRemainingArguments)]made the script an advanced function and PowerShell auto-added-ErrorAction/-ErrorVariable. That wrapper was patched separately to use$argsdirectly. With both fixes in place, the full chain (munin spawn → cmd → claude.cmd → claude.ps1 → claude.exe) delivers the prompt intact.Verification
cargo fmt --checkcargo test --lib core::proactivity: 17/17 passcargo buildcargo test: 313 lib tests, 14 integration tests, and 24 doc tests passmunin proactivity run --no-spawnpreview now shows single-quoted placeholders, no""CLAUDE_WRAPPER_DEBUG=1: prompt arrives as one intactforwarded_args[3]elementTest plan
cargo fmt --checkpassesmunin proactivity run --no-spawnpreview format matches expected single-quote shape--errorwithout crashing🤖 Generated with Claude Code