Skip to content

opencode: quote Windows spawn arguments - #71

Merged
Siddhesh2377 merged 1 commit into
mainfrom
siddhesh/opencode-win-quote
Sep 9, 2026
Merged

Siddhesh2377 merged 1 commit into
mainfrom
siddhesh/opencode-win-quote

Conversation

@Siddhesh2377

@Siddhesh2377 Siddhesh2377 commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

wally opencode's Spawn has the same Windows bug the codex review (#70) found:
the _spawn* family joins argv into a command line without quoting, so a
passthrough argument containing a space arrives at opencode split in two. On
POSIX execvp passes argv verbatim, so only the Windows branch is affected.

Adds the same MSVCRT-rule quoting used in the codex fix (double the backslash
run before a quote or the closing quote; backslash-escape embedded quotes),
applied to each argument on the Windows path only. Algorithm verified against
spaces, embedded quotes, trailing backslashes, and empty; POSIX path unchanged.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Windows process launching when executable paths or arguments contain spaces or quotation marks.
    • Preserved arguments correctly during application startup and command execution on Windows.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 1b105362-9636-4252-aea8-03b6a7455570

📥 Commits

Reviewing files that changed from the base of the PR and between 61191dc and c9c5ed2.

📒 Files selected for processing (1)
  • src/harness/opencode.cpp

Included review availability: Your plan provides up to 4 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

Windows process spawning now quotes the executable and arguments according to MSVCRT rules. The POSIX spawning path remains unchanged.

Changes

Windows spawn argument handling

Layer / File(s) Summary
Quote and pass Windows spawn arguments
src/harness/opencode.cpp
Adds QuoteWindowsArg for whitespace and quote escaping. The Windows Spawn path applies it to the executable and each argument, while the POSIX path retains its existing behavior.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~15–30 minutes

Merge Risk: ⚪ Minimal · up to c9c5e

Windows passthrough arguments with spaces, quotes, trailing backslashes, or empty values are preserved when launching OpenCode, without changing POSIX behavior. No current merge-blocking risk remains.

Suggested reviewers: sanchitmonga22

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: quoting Windows spawn arguments in opencode.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch siddhesh/opencode-win-quote

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Siddhesh2377
Siddhesh2377 merged commit 6d92b83 into main Sep 9, 2026
10 of 11 checks passed
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