fix(acp): preserve JSON-RPC error.data when message is present (#4069) - #4084
Open
iroiro147 wants to merge 1 commit into
Open
fix(acp): preserve JSON-RPC error.data when message is present (#4069)#4084iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
…#4069) `agent_error_from_json` previously discarded the `data` payload whenever the agent returned a string `message`. The ACP TypeScript SDK wraps plain thrown exceptions as `{code, message: "Internal error", data: {details: "<real cause>"}}`, which hid actionable adapter remediation hints and made failures look like opaque agent bugs (macOS/Windows ARM64 win-x64 vs win-arm64 misprovision, missing optional native SDK, etc.). Append the data payload to the surfaced message, preferring a nested `details` string when present and truncating oversized data defensively at 2048 chars to keep logs readable. `data: null` is ignored; errors without a string `message` still fall back to the full JSON as before. Adds unit tests covering the new append path (nested `details`, plain string `data`, null suppression, truncation) plus the original message-only behavior. Signed-off-by: iroiro147 <sarthak.singh@juspay.in>
3 tasks
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.
Summary
Fixes #4069 (partial — covers the cross-platform observability defect; the Windows ARM64 Node provisioning half is left to a follow-up).
agent_error_from_jsonincrates/buzz-acp/src/acp.rswas discarding the JSON-RPCerror.datapayload whenever the agent returned a stringmessage. The ACP TypeScript SDK wraps plain thrown exceptions as:{"code": -32603, "message": "Internal error", "data": {"details": "<fully actionable adapter message>"}}so the actionable adapter text never reached Buzz logs — operators saw only
Agent reported error (code -32603): Internal error.What changed
When
messageis a string and a non-nulldatafield is present, append a compact form ofdatato the surfaced message:data.detailsstring when present (matches the ACP TS SDK's wrap shape).datavalue stringified (handles plain string and structureddatacases).data: nullis ignored (no information).messagestill fall back to the full JSON object as before — no behavior change there.Test plan
Five new unit tests in
crates/buzz-acp/src/acp.rs::tests:agent_error_from_json_appends_data_details_when_present— the Windows ARM64 shape from Windows on ARM64: Claude managed agents fail every session/new with -32603 (win-x64 Node provisioned on ARM64 host; error.data dropped from logs) #4069:Internal error+data.detailswith the actionable remediation. Asserts both halves are surfaced.agent_error_from_json_appends_string_data_when_details_missing— plain stringdata.agent_error_from_json_ignores_null_data—data: nullproduces the original message unchanged.agent_error_from_json_truncates_oversized_data— 4096-chardatais truncated with ellipsis.agent_error_from_json_uses_message_field_when_present(nodatakey) — unchanged.Verification:
Notes
The Windows ARM64 side of #4069 (Buzz provisioning win-x64 Node on an ARM64 host because
managed_node_paths.rsreadsstd::env::consts::ARCHat compile time) is not addressed here — that's a runtime detection change requiringIsWow64Process2/PROCESSOR_ARCHITEW6432and would benefit from maintainer input on supported host matrix. This PR ships just the cross-platform logging fix so the next adapter failure of this shape surfaces its own remedy in the log.Closes #4069