Skip to content

fix(tui): preserve quotes in Windows status line commands - #2377

Open
zhuyuy wants to merge 2 commits into
MoonshotAI:mainfrom
zhuyuy:fix/issue-2332-status-line-quotes
Open

fix(tui): preserve quotes in Windows status line commands#2377
zhuyuy wants to merge 2 commits into
MoonshotAI:mainfrom
zhuyuy:fix/issue-2332-status-line-quotes

Conversation

@zhuyuy

@zhuyuy zhuyuy commented Jul 29, 2026

Copy link
Copy Markdown

Related Issue

Resolves #2332

Problem

On Windows, status_line.command is passed to cmd.exe /d /s /c as one argv element. Node/libuv escapes embedded double quotes while serializing that argument, so commands that quote an executable or a path arrive at cmd.exe with literal backslashes and silently produce no status line output.

What changed

  • Wrap the Windows command in the outer quote pair required by cmd /s /c and enable windowsVerbatimArguments, preserving the command's nested quotes.
  • Keep the existing POSIX sh -c path unchanged.
  • Add a Windows-only regression test that invokes the current Node executable through the real status-line spawn path with quoted arguments.
  • Add a patch changeset for @moonshot-ai/kimi-code.

Validation

  • Windows 11 10.0.26100, PowerShell 7.6.3, code page 936
  • Node.js 24.15.0, pnpm 10.33.0
  • Focused footer status-line tests: 17 passed
  • @moonshot-ai/kimi-code TypeScript check: passed
  • Type-aware Oxlint on the changed source and test: 0 warnings, 0 errors
  • changeset status --since=origin/main: patch bump detected
  • Independent complete-diff review: No findings.
  • Internal-identifier audit: no private paths, accounts, endpoints, or environment-specific identifiers found

No documentation update is needed: the existing [status_line].command documentation already describes the intended command contract, and this change restores that documented behavior on Windows without changing configuration or usage.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b7f549e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@zhuyuy
zhuyuy marked this pull request as ready for review July 29, 2026 16:21

@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: a555f1febe

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

async () => {
const command = `"${process.execPath}" -e "process.stdout.write('quoted-ok')"`;

expect(await runStatusLineCommand(command, payload)).toBe('quoted-ok');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Give the Windows quote test a generous timeout

On a busy Windows CI runner, this launches both cmd.exe and a fresh Node process but leaves timeoutMs at the production default of 300 ms. If process startup exceeds that deadline, runStatusLineCommand returns null, so the regression test can fail even when quote handling is correct. Pass a generous explicit timeout here to isolate the quoting contract; timeout behavior already has separate coverage.

Useful? React with 👍 / 👎.

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.

Windows: status_line.command containing double quotes is mangled by the cmd spawn

1 participant