Skip to content

fix(ai): harden Windows CLI spawning and surface suggest failures (DAN-11)#37

Merged
danielss-dev merged 3 commits into
mainfrom
fix/ai-cli-windows-spawn
Jul 7, 2026
Merged

fix(ai): harden Windows CLI spawning and surface suggest failures (DAN-11)#37
danielss-dev merged 3 commits into
mainfrom
fix/ai-cli-windows-spawn

Conversation

@danielss-dev

Copy link
Copy Markdown
Owner

Summary

Fixes DAN-11 — AI does not work. Root causes reproduced against the running app over CDP; full RCA posted on the Linear issue.

  • ai/bin.rs: on Windows resolve only .exe/.cmd/.bat — never npm's extensionless POSIX-shell shims, which resolved first, can't be spawned, and made Codex report "installed but not signed in" on a signed-in machine. Batch shims run via cmd /C; prompts travel over stdin (immune to cmd /C re-parsing and the 32K argv ceiling); null stdin + 30s/120s timeouts so an interactive CLI prompt errors visibly instead of spinning forever; CREATE_NO_WINDOW stops per-call console flashes in the release build (same rationale as strand_core::git_command).
  • ai/claude.rs: auth-status parsing recognizes explicit "not logged in" text instead of treating any non-JSON success as signed in.
  • LocalChanges.tsx: a missing CLI no longer disables the sparkle into a silent no-op — clicking surfaces the backend's install/sign-in hint inline; errors are labeled "Suggestion failed: …" instead of the misleading "Commit failed: …".
  • Docs: docs/learnings.md rule for vendor-CLI spawning on Windows; TASKS.md row.

Test plan

  • cargo test -p strand-tauri ai:: — 19 pass, incl. new tests: shim-vs-.cmd resolution, extensionless skip, .cmd execution via cmd /C, stdin piping, timeout kill.
  • cargo clippy -p strand-tauri --no-default-features and cargo check -p strand-core -p strand-tauri clean; tsc --noEmit clean (known App.tsx noise only).
  • Live E2E against the running dev app over WebView2 CDP: both providers return real suggestions — Codex through its npm .cmd shim (impossible before), Claude via claude.exe; Codex status now correctly reports signed in.

🤖 Generated with Claude Code

Resolution now only accepts .exe/.cmd/.bat on Windows: npm installs an
extensionless POSIX-shell shim next to every .cmd, and resolving it made
provider_status report the CLI as installed while every spawn failed --
Settings showed Codex as "installed but not signed in" on a signed-in
machine, and suggest could never work. Batch shims run through cmd /C
(CreateProcess cannot execute them directly), so prompts move from argv
to stdin, which also sidesteps the 32K command-line ceiling.

run_capture gains a null-stdin default plus 30s/120s timeouts so a CLI
that stops to ask a question fails with a visible error instead of
spinning forever, and CREATE_NO_WINDOW stops the release build flashing
a console window per AI call (same rationale as strand_core's
git_command). Claude auth-status parsing now recognizes explicit
logged-out text instead of treating every non-JSON success as signed in.
A missing CLI no longer disables the sparkle button into a silent
no-op: clicking now surfaces the backend's install/sign-in hint in the
commit-bar error slot. Error messages carry their own prefix so a
suggestion failure reads "Suggestion failed: ..." instead of the
misleading "Commit failed: ..." (which also mislabeled the
"Browser opened -- complete sign-in" notice).
@danielss-dev danielss-dev merged commit b6fc1b6 into main Jul 7, 2026
2 checks passed
@danielss-dev danielss-dev deleted the fix/ai-cli-windows-spawn branch July 7, 2026 16:23
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