Skip to content

Fix proactivity spawn prompt quoting on Windows (0.5.5) - #8

Merged
inchwormz merged 2 commits into
mainfrom
fix/spawn-quoting
Apr 20, 2026
Merged

inchwormz merged 2 commits into
mainfrom
fix/spawn-quoting

Conversation

@inchwormz

@inchwormz inchwormz commented Apr 20, 2026 •

Copy link
Copy Markdown
Owner

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_cmd doubled 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-id as 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, and ANTHROPIC_AUTH_TOKEN before starting the spawned session.

Companion fix (outside this repo)

The original failure also surfaced as AmbiguousParameter: error in the user's local ~/bin/claude.ps1 wrapper, because [Parameter(ValueFromRemainingArguments)] made the script an advanced function and PowerShell auto-added -ErrorAction/-ErrorVariable. That wrapper was patched separately to use $args directly. With both fixes in place, the full chain (munin spawn → cmd → claude.cmd → claude.ps1 → claude.exe) delivers the prompt intact.

Verification

  • cargo fmt --check
  • cargo test --lib core::proactivity: 17/17 pass
  • cargo build
  • cargo test: 313 lib tests, 14 integration tests, and 24 doc tests pass
  • munin proactivity run --no-spawn preview now shows single-quoted placeholders, no ""
  • Simulated full spawn chain with CLAUDE_WRAPPER_DEBUG=1: prompt arrives as one intact forwarded_args[3] element

Test plan

  • Proactivity unit tests pass
  • Full local Rust test suite passes
  • cargo fmt --check passes
  • munin proactivity run --no-spawn preview format matches expected single-quote shape
  • Wrapper chain forwards embedded --error without crashing

🤖 Generated with Claude Code

inchwormz and others added 2 commits April 20, 2026 13:11
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>
@inchwormz
inchwormz merged commit 10a87c8 into main Apr 20, 2026
4 checks passed
@inchwormz
inchwormz deleted the fix/spawn-quoting branch April 20, 2026 18:21
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.

1 participant