Skip to content

Fix Windows ARM64 managed Node provisioning + preserve agent error data - #4121

Open
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:claude/issue4069-arm64-node-20260802
Open

Fix Windows ARM64 managed Node provisioning + preserve agent error data#4121
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:claude/issue4069-arm64-node-20260802

Conversation

@iroiro147

Copy link
Copy Markdown

Fix Windows ARM64 managed Node provisioning + preserve agent error data

Summary

Fix two compounding defects that break Windows ARM64 hosts running the x64 Buzz desktop build under emulation (issue #4069):

  1. Runtime architecture detection for managed Node provisioning: Previously, managed_node_paths.rs and agent_discovery/managed_node.rs used std::env::consts::ARCH (a compile-time constant) to select the Node platform. An x64-built Buzz binary running under Windows x64 emulation on ARM64 hardware always reports x86_64, causing it to download and install win-x64 Node. The agent adapter's npm packages (installed under the system ARM64 Node) were therefore mismatched, and the claude.exe launch failed with binary-not-found errors.

  2. Preserve JSON-RPC error.data in agent_error_from_json: When the adapter returned {code, message, data}, the data payload was silently dropped if message was a string, hiding the actionable diagnostic ("Claude native binary not found for win32-x64...") from the user.

Changes

  • desktop/src-tauri/src/managed_agents/managed_node_paths.rs: On Windows, resolve the actual machine architecture at runtime via IsWow64Process2; fall back to compile-time arch if the API is unavailable (e.g., pre-Windows 10 1709) or fails. Add unit tests covering the runtime resolver and the artifact-selection path. Non-Windows behavior is unchanged (compile-time arch remains authoritative).
  • desktop/src-tauri/src/commands/agent_discovery/managed_node.rs: Replace the compile-time MANAGED_NODE_ARTIFACT constant with a runtime resolver managed_node_artifact() that selects the correct Windows artifact (win-x64 or win-arm64) based on the actual machine architecture, matching the behavior in managed_node_paths.rs.
  • crates/buzz-acp/src/acp.rs: Append the serialized error.data payload to the error message when both message and data fields are present in a JSON-RPC error.

Testing

  • Added tests:
    • managed_node_paths.rs::target_arch_returns_compile_time_value_on_non_windows (verifies non-Windows platforms defer to compile-time arch)
    • managed_node_paths.rs::target_arch_returns_known_value_on_windows (verifies Windows runtime detection returns a valid arch)
    • agent_discovery/managed_node.rs::managed_node_artifact_returns_artifact_matching_runtime_platform (verifies the artifact resolver selects the correct platform string)
    • acp.rs::agent_error_from_json_appends_data_when_message_and_data_present (verifies error.data is preserved in the error message)
  • All existing tests pass:
    • buzz-desktop lib: 2090 passed, 0 failed
    • buzz-acp lib: 662 passed, 0 failed
    • Clippy: clean for both crates

Compatibility

  • No breaking changes to APIs or file formats.
  • Non-Windows platforms: no behavior change (compile-time arch remains authoritative).
  • Windows x64 native: no behavior change (runtime detection returns x86_64).
  • Windows ARM64: fixes managed Node provisioning; existing win-x64 installs remain untouched (no forced migration).

Fixes #4069

Fix two compounding defects breaking Windows ARM64 hosts (issue block#4069):

1. **Runtime architecture detection for managed Node provisioning**
   - Previously, both `managed_node_paths.rs` and
     `agent_discovery/managed_node.rs` used `std::env::consts::ARCH`
     (compile-time) to select the Node platform. An x64-built Buzz
     binary running under Windows x64 emulation on ARM64 hardware
     always reports `x86_64`, so it downloaded and installed win-x64
     Node. The agent adapter's npm packages (installed under the
     system ARM64 Node) were then mismatched, and the launch failed
     with `claude.exe` not found.
   - Fix: on Windows, resolve the actual machine architecture at
     runtime via `IsWow64Process2`; fall back to compile-time arch
     if the API is missing or fails. Add unit tests covering the
     runtime resolver and the artifact-selection path. Non-Windows
     behavior is unchanged (compile-time arch remains authoritative).

2. **Preserve JSON-RPC `error.data` in `agent_error_from_json`**
   - Previously, when the adapter returned `{code, message, data}`,
     `data` was silently dropped if `message` was a string. The
     actionable payload ("Claude native binary not found for
     win32-x64...") was hidden from the user.
   - Fix: append the serialized `data` payload to the message when
     both fields are present. Add a unit test covering this case.

Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
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 on ARM64: Claude managed agents fail every session/new with -32603 (win-x64 Node provisioned on ARM64 host; error.data dropped from logs)

1 participant