huskies: merge 1232 bug Gateway chat bot crashes (CLI exit 1) on a sled MCP tool error instead of surfacing it
This commit is contained in:
@@ -1213,11 +1213,20 @@ async fn gateway_mcp_post_against_disconnected_sled_returns_error_response_fast(
|
||||
|
||||
let body: serde_json::Value = resp.0.into_body().into_json().await.unwrap();
|
||||
assert_eq!(body["id"], 3);
|
||||
// Story 1232: a disconnected sled is a tool-call-time failure, not a
|
||||
// protocol fault — it must come back as a non-fatal MCP tool_result
|
||||
// (isError: true) so the calling `claude` CLI's MCP client treats it as
|
||||
// a normal tool error instead of exiting non-zero, not a top-level
|
||||
// JSON-RPC `error` object.
|
||||
assert!(
|
||||
body.get("error").is_some(),
|
||||
"Expected a JSON-RPC error for a disconnected sled; got: {body}"
|
||||
body.get("error").is_none(),
|
||||
"a disconnected sled must not produce a top-level JSON-RPC error; got: {body}"
|
||||
);
|
||||
let msg = body["error"]["message"].as_str().unwrap_or("");
|
||||
assert_eq!(
|
||||
body["result"]["isError"], true,
|
||||
"expected a non-fatal tool_result for a disconnected sled; got: {body}"
|
||||
);
|
||||
let msg = body["result"]["content"][0]["text"].as_str().unwrap_or("");
|
||||
assert!(
|
||||
msg.contains("offline-sled"),
|
||||
"error message must name the sled; got: {msg}"
|
||||
|
||||
Reference in New Issue
Block a user