Skip to content

fix: send long Windows Claude prompts via stdin - #125

Merged
delibae merged 3 commits into
delibae:mainfrom
WhiskyChoy:codex/windows-stdin-prompt
Apr 7, 2026
Merged

delibae merged 3 commits into
delibae:mainfrom
WhiskyChoy:codex/windows-stdin-prompt

Conversation

@WhiskyChoy

Copy link
Copy Markdown
Contributor

Summary

  • keep using -p for Claude CLI, but send the prompt through stdin on Windows instead of placing it on the command line
  • preserve the existing non-Windows behavior so Unix shells still receive the prompt as an argument
  • add Rust and frontend coverage for whole-file vs selection context labels and the Windows prompt transport helper

Why

On some Windows machines, mentioning a whole file can make the spawned Claude command exceed the command-line length limit and fail with os error 206. Sending the prompt through stdin avoids that Windows-specific limit without changing the higher-level prompt assembly.

Validation

  • pnpm --filter @claude-prism/desktop test -- claude-chat-send-prompt
  • set VCPKGRS_TRIPLET=x64-windows-static-release
  • set CXXFLAGS=/std:c++17
  • cargo test with_prompt_transport
  • manual verification on Windows: whole-file @file mentions no longer fail with os error 206

Copilot AI review requested due to automatic review settings April 7, 2026 08:04

Copilot AI 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.

Pull request overview

This PR updates the Windows-specific Claude CLI invocation path to avoid command-line length limits by sending long prompts via stdin, while keeping the existing non-Windows behavior unchanged.

Changes:

  • Introduce a with_prompt_transport helper to choose between argv vs stdin prompt transport (Windows uses stdin).
  • Update Claude process spawning to optionally pipe stdin and write the prompt payload to the child process.
  • Add frontend + Rust tests covering context label behavior (whole-file vs selection) and the prompt-transport helper.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
apps/desktop/src/tests/stores/claude-chat-send-prompt.test.ts Adds Vitest coverage for context label + selected-text assembly in sendPrompt for whole-file vs selection cases.
apps/desktop/src-tauri/src/claude.rs Sends prompts via stdin on Windows to avoid OS error 206; adds helper + unit test and updates process spawn logic accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/desktop/src-tauri/src/claude.rs Outdated
@delibae
delibae merged commit 313f47d into delibae:main Apr 7, 2026
1 check 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.

3 participants