Fix Windows ARM64 managed Node provisioning + preserve agent error data - #4121
Open
iroiro147 wants to merge 1 commit into
Open
Fix Windows ARM64 managed Node provisioning + preserve agent error data#4121iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):
Runtime architecture detection for managed Node provisioning: Previously,
managed_node_paths.rsandagent_discovery/managed_node.rsusedstd::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 reportsx86_64, causing it to download and installwin-x64Node. The agent adapter's npm packages (installed under the system ARM64 Node) were therefore mismatched, and theclaude.exelaunch failed with binary-not-found errors.Preserve JSON-RPC
error.datainagent_error_from_json: When the adapter returned{code, message, data}, thedatapayload was silently dropped ifmessagewas 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 viaIsWow64Process2; 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-timeMANAGED_NODE_ARTIFACTconstant with a runtime resolvermanaged_node_artifact()that selects the correct Windows artifact (win-x64orwin-arm64) based on the actual machine architecture, matching the behavior inmanaged_node_paths.rs.crates/buzz-acp/src/acp.rs: Append the serializederror.datapayload to the error message when bothmessageanddatafields are present in a JSON-RPC error.Testing
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(verifieserror.datais preserved in the error message)buzz-desktoplib: 2090 passed, 0 failedbuzz-acplib: 662 passed, 0 failedCompatibility
x86_64).win-x64installs remain untouched (no forced migration).Fixes #4069