Repository navigation
api: keep content on blocking replies that open with a refusal prefix (#172) - #205
Conversation
…ix (#172) The blocking chat path moved the first sentence into `message.refusal` and set `content` to null whenever the reply opened with one of the 23 prefixes in refusal.rs, dropping the rest of the answer. The streamed path sends every content piece and appends the refusal at the end, so the same prompt gave a full answer streamed and `content: null` blocking (27/200 on the issue's GLM-5.3 run). The classifier is a prefix heuristic, so a reply such as "I cannot verify that source. Here is ..." lost real content. Blocking now matches streaming: `refusal` is still populated, `content` is kept. ATLAS_DISABLE_REFUSAL_DETECTION=1 is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
This fix covers more than the OpenAI endpoint. I traced which readers depended on the old
🤖 Generated with Claude Code |
|
I ran an adversarial review on this PR (Qwen3.8-Max). Here is what I checked for each concern:
🤖 Generated with Claude Code |
|
Live gate, part 1: BFCL golden ST-995 = 87.44 / 87.32 (n=995, 🤖 Generated with Claude Code |
|
Live gate, part 2: agentic-webserver, 50 iterations, passes: 50/50 webserver_ok, 50/50 followed_directions, 12.344 s/turn, Σwall 4,705 s ( 🤖 Generated with Claude Code |
|
Riding integration train #212 ( |
Fixes #172.
What
When a blocking (non-streaming) reply's text opened with a known refusal pattern and no tool call fired,
build_choice_messagemoved the text intorefusaland setcontent: null. Streaming replies keep the text, so the two paths disagreed: in #172, 27 of 200 blocking replies came back with no content. Most of them were answers that only opened with a hedge ("I cannot verify that source. Here is what the paper says: ...").Now the refusal classifier still fills
refusal, andcontentkeeps the text, so blocking matches streaming.Tests
glm_tool_boundary_tests::blocking_refusal_prefix_keeps_content.cargo test -p spark-server --bin spark -- glm_tool_boundary chat_blocking refusal: 43 passed.cargo test -p spark-server --lib -- refusal: 6 passed.cargo fmt --checkandcargo clippy -p spark-server -p spark-model -D warningsare clean.🤖 Generated with Claude Code