Repository navigation
In review
Description
Summary
Three behaviours of the Responses API surface do not follow the request that produced them.
- The
responseobject always carries"tools": []and"text": {"format": {"type": "text"}},
even when the request declares tools and asks for a required tool call. The same object then
reports"tool_choice": "required"next to the empty list. function_call_outputandcustom_tool_call_outputinput items always decode with
is_error: false, whatever the item body says. The Chat path reads the field, so a Chat history
replayed through Responses loses the failure flag.GET /v1/responsesis answered with 400 and the message "WebSockets are not supported; use POST
/v1/responses with HTTP/SSE".
Environment
- Upstream commit:
25b49519cd3738b9d8509d7c59bd0e78c03c1a72 - Build: cargo with
--locked --offline, Linux arm64 (aarch64), rust 1.94.1
(cargo test --features runtime-core,server --locked --offline --manifest-path helios/Cargo.toml --lib) - No GPU needed: the encoder, both decoder paths and the GET handler are driven directly
Steps to reproduce
From a clean checkout of the commit above:
- Add
helios/src/server/protocol/qc_responses_echo.rswith the first module source below. - Add
helios/src/server/http_qc_responses_echo.rswith the second module source below. - Register the first at the end of
helios/src/server/protocol/mod.rswith:
#[cfg(test)]
#[path = "qc_responses_echo.rs"]
mod qc_responses_echo;- Register the second at the end of
helios/src/server/http.rs(insidemod http, so
super::no_websocketis the exact function the router binds) with:
#[cfg(test)]
#[path = "http_qc_responses_echo.rs"]
mod qc_responses_echo_http;- Run the four tests by full path:
cargo test --features runtime-core,server --locked --offline --manifest-path helios/Cargo.toml --lib \
-- --exact server::protocol::qc_responses_echo::responses_object_reports_request_tools_and_text_format --nocapture
cargo test --features runtime-core,server --locked --offline --manifest-path helios/Cargo.toml --lib \
-- --exact server::protocol::qc_responses_echo::function_call_output_decodes_with_is_error_false --nocapture
cargo test --features runtime-core,server --locked --offline --manifest-path helios/Cargo.toml --lib \
-- --exact server::protocol::qc_responses_echo::chat_tool_result_is_error_is_honoured_control --nocapture
cargo test --features runtime-core,server --locked --offline --manifest-path helios/Cargo.toml --lib \
-- --exact server::http::qc_responses_echo_http::get_v1_responses_is_rejected_with_400 --nocapture
| step | rc |
|---|---|
cargo test … --lib -- --list (all four names present) |
0 |
responses_object_reports_request_tools_and_text_format |
0 (1 passed) |
function_call_output_decodes_with_is_error_false |
0 (1 passed) |
chat_tool_result_is_error_is_honoured_control |
0 (1 passed) |
get_v1_responses_is_rejected_with_400 |
0 (1 passed) |
helios/src/server/protocol/qc_responses_echo.rs:
use super::*;
use crate::server::inference::{Input, Part, Tool, ToolChoice};
use serde_json::json;
fn tools() -> Vec<Tool> {
vec![Tool {
name: "lookup".into(),
namespace: None,
description: "Find a value".into(),
parameters: json!({"type":"object","properties":{"q":{"type":"string"}},"required":["q"]}),
declared_parameters: true,
custom: false,
grammar: None,
}]
}
fn encoder(protocol: Protocol, tool_choice: ToolChoice) -> Encoder {
Encoder::new(
protocol,
"resp_echo".into(),
"model".into(),
1,
1,
vec![PromptUsage {
tokens: 7,
image_tokens: 0,
}],
tools(),
tool_choice,
true,
false,
json!(null),
)
}
fn tool_result_flags(input: &Input) -> Vec<bool> {
let mut flags = vec![];
if let Input::Conversation(messages) = input {
for message in messages {
for part in &message.parts {
if let Part::ToolResult { is_error, .. } = part {
flags.push(*is_error);
}
}
}
}
flags
}
#[test]
fn responses_object_reports_request_tools_and_text_format() {
let encoder = encoder(Protocol::Responses, ToolChoice::Required);
let request_tools = tools().len();
let response = encoder.response();
eprintln!(
"RESP responses_tools request_tools={request_tools} wire_tools={} wire_text={} wire_tool_choice={}",
response["tools"], response["text"], response["tool_choice"]
);
assert_eq!(request_tools, 1);
assert_eq!(response["tools"], json!([]));
assert_eq!(response["text"], json!({"format":{"type":"text"}}));
assert_eq!(response["tool_choice"], json!("required"));
}
#[test]
fn function_call_output_decodes_with_is_error_false() {
let decoded = decode(
Protocol::Responses,
json!({"model":"m","input":[
{"type":"function_call_output","call_id":"c1","output":"boom"},
{"type":"custom_tool_call_output","call_id":"c2","output":"bang"}
]}),
false,
)
.unwrap();
let flags = tool_result_flags(&decoded.request.input);
eprintln!("RESP responses_tool_result_is_error={flags:?}");
assert_eq!(flags.len(), 2);
assert!(flags.iter().all(|flag| !flag));
}
#[test]
fn chat_tool_result_is_error_is_honoured_control() {
let decoded = decode(
Protocol::Chat,
json!({"model":"m","messages":[{"role":"tool","tool_call_id":"c","is_error":true,"content":"timeout"}]}),
false,
)
.unwrap();
let flags = tool_result_flags(&decoded.request.input);
eprintln!("RESP chat_tool_result_is_error={flags:?}");
assert_eq!(flags, vec![true]);
}helios/src/server/http_qc_responses_echo.rs:
use axum::body::to_bytes;
use axum::http::StatusCode;
#[tokio::test]
async fn get_v1_responses_is_rejected_with_400() {
let response = super::no_websocket().await;
let status = response.status();
let body = to_bytes(response.into_body(), 1 << 20).await.unwrap();
let text = String::from_utf8_lossy(&body);
eprintln!("RESP GET /v1/responses status={status} body={text}");
assert_eq!(status, StatusCode::BAD_REQUEST);
assert!(text.contains("WebSockets are not supported"));
}Actual
test server::protocol::qc_responses_echo::responses_object_reports_request_tools_and_text_format ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1533 filtered out; finished in 0.00s
RESP responses_tools request_tools=1 wire_tools=[] wire_text={"format":{"type":"text"}} wire_tool_choice="required"
test server::protocol::qc_responses_echo::function_call_output_decodes_with_is_error_false ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1533 filtered out; finished in 0.00s
RESP responses_tool_result_is_error=[false, false]
test server::protocol::qc_responses_echo::chat_tool_result_is_error_is_honoured_control ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1533 filtered out; finished in 0.00s
RESP chat_tool_result_is_error=[true]
test server::http::qc_responses_echo_http::get_v1_responses_is_rejected_with_400 ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1533 filtered out; finished in 0.00s
RESP GET /v1/responses status=400 Bad Request body={"error":{"type":"invalid_request_error","message":"WebSockets are not supported; use POST /v1/responses with HTTP/SSE","param":null,"code":"invalid_request_error"}}
Expected
- The
responseobject should echo the tools the request sent, and atextformat that reflects
the request rather than a constant. Reporting"tool_choice": "required"together with
"tools": []is self-contradictory for a client reading the object back. function_call_outputandcustom_tool_call_outputshould decode the same way the Chat path
decodes a tool message, so replayed history keeps itsis_errorvalue (the Chat control returns
truefor the same field).- If
GET /v1/responsesis intentionally unsupported, the response and its message should be
documented; today it advertises a POST/SSE endpoint in an error body a client cannot act on.
Source pointers
helios/src/server/protocol/encode.rs:692, inpub fn response(&self)(line 652), Responses arm
literal:"tool_choice":tool_choice,"tools":[],"text":{"format":{"type":"text"}}— the tools
array and text format are constants whileself.toolsis populated byEncoder::newhelios/src/server/protocol/decode.rs:311-318— the
"function_call_output" | "custom_tool_call_output"arm builds
Part::ToolResult { …, is_error: false };is_erroris a literal at line 316 and the item body
is not consultedhelios/src/server/protocol/decode.rs:170and:227— the Chat and Messages decoders read
is_errorfrom the payload, which is why the control seestruehelios/src/server.rs:533—.route("/v1/responses", post(http::generate).get(http::no_websocket)…)helios/src/server/http.rs:19-25—no_websocket()returnsBAD_REQUESTwith
"WebSockets are not supported; use POST /v1/responses with HTTP/SSE" (message at line 23)
Suggested fix
Emit the request's tools and text format in the Responses response object instead of the
constant [] / {"type":"text"} (the encoder already holds both). In the Responses output-item
arm, decode is_error from the item the way decode.rs:170 does for Chat, or document that
Responses tool outputs never carry the flag. For the GET route, either answer with a documented
capability error that names the supported method only, or drop the route.
Activity
yatesdr commentedon Nov 21, 2026
Checked at main 21a40f0:
"tools":[]and"text":{"format":{"type":"text"}}(helios/src/server/protocol/encode.rs:692), whiletool_choiceis echoed from the request.function_call_outputandcustom_tool_call_outputdecode withis_error: false(helios/src/server/protocol/decode.rs:316), while Chat and Messages read the flag. The flag changes the rendered prompt, so a failed Responses tool result replays as a success./v1/responsesreturns 400 because WebSocket transport is unsupported (docs/api.md, "WebSockets"); only the wording of the message is at issue.flare-autobot commentedon Nov 30, 2026
Confirmed all three behaviors on
origin/main(c146d7be):toolsandtext.formatecho:Encoder::response()inhelios/src/server/protocol/encode.rs:744-757echoestool_choiceforProtocol::Responseswhile hardcoding"tools": []and"text": {"format": {"type": "text"}}at line 756. Inhelios/src/server/protocol/decode.rs,decode()(lines 849-858) also concatenated Responses tool namespace descriptions directly intoTool.descriptionand allowed duplicate namespace names, whileoptions()(lines 509-528) droppedjson_schemametadata (name,description,strict) when loweringbody["text"]["format"].is_error:responses_messages()inhelios/src/server/protocol/decode.rs:337-345constructedPart::ToolResultwith literalis_error: false(line 343) for bothfunction_call_outputandcustom_tool_call_output, unlikechat_messages()(decode.rs:191-198) andanthropic_messages()(decode.rs:250-255), dropping tool error signaling beforeinference::template_messages()(helios/src/server/inference.rs:359-363) andTmlV0(helios/src/frontend/tml.rs:437-442).GET /v1/responseserror text and documentation:helios/src/server.rs:585routesGET /v1/responsestohttp::no_websocket()(helios/src/server/http.rs:19-25), which returns HTTP 400 with"WebSockets are not supported; use POST /v1/responses with HTTP/SSE", anddocs/api.mddid not document theGET /v1/responses400 response.Implemented fix
A fix is prepared on branch
fix/issue-450-responses-echo-and-tool-error(commitf4143935), confined to Helios's shared HTTP protocol layer anddocs/api.md(no changes to model contracts, cache schemes, scheduling, or CUDA graphs):toolsecho and namespace preservation: Addednamespace_description: Option<String>toinference::Tool(helios/src/server/inference.rs) with absent and empty descriptions normalized toNone, rejected duplicate Responses namespace names with HTTP 400 indecode(), and moved nonempty namespace-description prepending intorequest::template_inputs()(helios/src/server/request.rs) before custom-tool grammar instructions.Encoder::response()now serializestoolsviaresponses_tools()andresponses_tool_entry()(echoing standalone function and custom tools with unqualifiedname, nullableparameterswhen undeclared,strict, text/Lark/regex custom formats, and first-appearance namespace grouping) across buffered JSON responses and all Responses SSE lifecycle events (response.created,response.in_progress,response.completed,response.incomplete, andresponse.failed).text.formatvalidation and echo: Added single-passresponses_text_format()parsing indecode.rsforProtocol::Responses, validatingtextandtext.formatobject types, object or booleanjson_schema.schemavalues (matchinghelios/src/grammar.rs), and optionalname,description, andstrictfields, and checking mutual exclusion with top-levelgrammarbefore defaulting omitted ornulltext.formatto{"type": "text"}.http::generate()passesDecoded.text_formatintoEncoder::set_text_format()beforeencoder.start().is_errorparity:responses_messages()now decodes optional booleanis_error(omitted ornull->false, non-boolean -> HTTP 400) for bothfunction_call_outputandcustom_tool_call_output, reusing sharedPart::ToolResultlowering acrossJinja,DeepseekV4,DeepseekV41, andTmlV0prompt encoders (including multimodalinput_text+input_imageoutputs).GET /v1/responsesresponse and docs:http::no_websocket()retains HTTP 400 (invalid_request_error) with"GET /v1/responses and WebSocket transport are not supported; use POST /v1/responses with HTTP JSON or SSE", anddocs/api.mdnow documents theGET /v1/responses400 response, Responsestools/text.formatechoing, and Responses tool-outputis_errorsupport.Verification
Executed on Linux aarch64 with external frontend templates prepared via
tests/frontend/prepare_templates.py(FLARE_TEST_TEMPLATE_DIR):cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --target-dir flare-cli/target: 1,805 passed, 0 failed, 83 pre-existing#[ignore]skipped. Includes 6 added tests coveringdecode -> encode -> decodetool/namespace round-trips andtemplate_inputsparity,text.formatvalidation andgrammarmutual exclusion, text and multimodalis_errorparity across all four prompt encoders, productionhttp::generatebuffered and SSE lifecycle echoing, andGET /v1/responses.cargo test --locked --release --manifest-path flare/Cargo.toml --target-dir flare-cli/target: 245 passed, 0 failed, 4 pre-existing#[ignore]skipped.cargo test --locked --release --manifest-path flare-cli/Cargo.toml: 227 passed, 0 failed, 3 pre-existing#[ignore]skipped.Unrun checks: Live-service OpenAI Python SDK v2 contract tests (
FLARE_API_TEST_URL=... .venv/bin/python -m pytest tests/server/test_protocols.py -q) and pre-existing#[ignore]GPU/checkpoint Rust tests were not run because no live native Flare server running an exported model core on NVIDIA GPU hardware was exercised.A pull request containing this fix is open at #638.