Skip to content

fix(windows): preserve source extension when copying CLI to versioned dir#249

Open
AgentA-asaf wants to merge 7 commits intomainfrom
agenta/fix-cli-exe-cmd-windows
Open

fix(windows): preserve source extension when copying CLI to versioned dir#249
AgentA-asaf wants to merge 7 commits intomainfrom
agenta/fix-cli-exe-cmd-windows

Conversation

@AgentA-asaf
Copy link
Copy Markdown
Contributor

Summary

  • Root cause: cf1710f hardcoded .cmd as the versioned bin destination on Windows to fix npm-based providers (codex/gemini). This broke full-package installs: claude.exe was copied into claude.cmd — a PE binary with a batch filename — causing cmd.exe /C to fail and get_cli_version to return (unknown).
  • Fix: Step 1 (already-installed check) now probes both .exe and .cmd candidates. Fast-path copy derives the destination extension from the source file (.exe.exe, .cmd.cmd). Slow-path (post-npm-install) still uses .cmd since npm always produces .cmd wrappers on Windows.
  • Retro doc: docs/retro-cli-exe-cmd-regression.md

Affected providers

Provider Install method Before After
claude Full package installer .exe copied as .cmd .exe copied as .exe
codex npm install .cmd.cmd unchanged ✅
gemini npm install .cmd.cmd unchanged ✅

Test plan

  • Clear ~/.agentmux/<version>/cli/claude/ and relaunch — should detect ~/.local/bin/claude.exe and copy as claude.exe, not claude.cmd
  • Version should show real version string, not (unknown)
  • Auth flow should work end-to-end
  • Codex/Gemini npm install path unchanged (still produces .cmd)

🤖 Generated with Claude Code

AgentA and others added 5 commits March 28, 2026 14:08
- run_cli_login returns OAuth URL synchronously (waits up to 15s);
  frontend displays URL in launch panel and opens browser from host
- Add RunCliLogin/CancelCliLogin Tauri commands; wire frontend setAuthUrl
- Fix Windows CLI versioned-install path: derive copy destination extension
  from source binary (.exe→.exe, .cmd→.cmd) instead of hardcoding .cmd
  (cf1710f broke full-package installs by copying claude.exe→claude.cmd)
- Add retro doc: docs/retro-cli-exe-cmd-regression.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… dir

cf1710f hardcoded .cmd as the versioned bin destination on Windows to fix
npm-based providers (codex/gemini). This broke full-package installs:
claude.exe was copied into claude.cmd — a PE binary with a batch filename —
causing cmd.exe /C to fail and get_cli_version to return "unknown".

Fix:
- Step 1 (already-installed check) now probes both .exe and .cmd candidates
- Fast-path copy derives the destination extension from the source file
  (.exe source → .exe dest, .cmd source → .cmd dest)
- Slow-path (post-npm-install) still uses .cmd since npm always produces
  .cmd wrappers on Windows

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@reagentx-workflow reagentx-workflow Bot left a comment

Choose a reason for hiding this comment

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

ReAgent Diagnostics
Field Value
ReAgent Version 5.12.4
Project Context CLAUDE.md loaded
Model claude-opus-4-6
Effort high
Ref Repos Disabled
Merge Analysis Clean
Review Time 125.6s
Timestamp 2026-03-28T21:12:57Z
Repository agentmuxai/agentmux
PR #249

Issues:

  • agentmuxsrv-rs/src/server/websocket.rs:1733 - installsysdep timeout (5 min) drops the child without killing it; tokio's Child::drop detaches but does not kill the process, so a timed-out winget/brew installer will continue running as an orphan. Need to child.kill() before returning the timeout error.
  • Cargo.toml:7-8 - Unrelated release profile changes (lto = true"thin", codegen-units = 14) not mentioned in PR description. These weaken release binary optimization for faster compile times — should be a separate commit/PR or at least documented.

When the OAuth browser redirect to localhost fails, the auth server shows
a manual authentication code. Added a paste input + Submit button below
the login URL so users can enter it without leaving the app.

- run_cli_login: stdin now piped; background task forwards codes via mpsc
- New Tauri command: write_cli_login_stdin(code) → sends to CLI stdin
- AppState: cli_login_stdin_tx replaces cli_login_stdin (Send-safe channel)
- AgentDocumentView: auth code input field + Submit button (Enter or click)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@reagentx-workflow reagentx-workflow Bot left a comment

Choose a reason for hiding this comment

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

ReAgent Diagnostics
Field Value
ReAgent Version 5.12.4
Project Context CLAUDE.md loaded
Model claude-opus-4-6
Effort high
Ref Repos Enabled (dev-tools, shared-infrastructure)
Merge Analysis Clean
Review Time 134.5s
Timestamp 2026-03-28T21:44:39Z
Repository agentmuxai/agentmux
PR #249

Issues:

  • agentmuxsrv-rs/src/server/websocket.rs:1778 - installsysdep timeout (5 min) drops the future containing child without killing it; tokio::process::Child::drop detaches but does not kill the process, so a timed-out winget/brew installer continues running as an orphan. Call child.kill() before returning the timeout error.
  • Cargo.toml:7-8 - Unrelated release profile changes (lto = true"thin", codegen-units = 14) not mentioned in PR description. These weaken release binary optimization — should be a separate commit/PR or documented.
  • src-tauri/src/commands/platform.rs:341 - stdout reader task breaks after capturing the OAuth URL, dropping the pipe handle. On Linux/macOS the CLI process receives SIGPIPE on its next stdout write, which can terminate the login process before the OAuth callback completes. Continue draining the pipe after URL capture instead of breaking.
  • src-tauri/src/commands/platform.rs:356 - Same pipe-drop issue on the stderr reader task — break after URL capture can kill the CLI via SIGPIPE on subsequent stderr writes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@reagentx-workflow reagentx-workflow Bot left a comment

Choose a reason for hiding this comment

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

ReAgent Diagnostics
Field Value
ReAgent Version 5.12.4
Project Context CLAUDE.md loaded
Model claude-opus-4-6
Effort high
Ref Repos Disabled
Merge Analysis 22 regression(s) detected
Review Time 90.6s
Timestamp 2026-03-29T04:02:46Z
Repository agentmuxai/agentmux
PR #249

Issues:

  • agentmuxsrv-rs/src/server/websocket.rs:1778 - installsysdep timeout drops the future containing child without killing it; tokio::process::Child::drop detaches but does not kill the process, so a timed-out winget/brew installer continues running as an orphan. Call child.kill().await before returning the timeout error.
  • src-tauri/src/commands/platform.rs:341 - stdout reader task breaks after capturing the OAuth URL, dropping the pipe. On Linux/macOS the CLI process receives SIGPIPE on its next stdout write, which can terminate the login process before the OAuth redirect callback completes. Continue draining the pipe after capturing the URL instead of breaking.
  • src-tauri/src/commands/platform.rs:356 - Same SIGPIPE issue on stderr reader — break after URL capture drops the pipe and can kill the CLI via SIGPIPE on subsequent writes.
  • Cargo.toml:7-8 - Unrelated release profile changes (lto = true"thin", codegen-units = 14) weaken release binary optimization; not mentioned in PR description and should be a separate commit or documented.

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