docs(TASK-044): review polish — visible-output wording, web-search wire pin note, truncation debug line, thinking-exclusion pin test
This commit is contained in:
3 files changed
+25
-1
No files matched your search
@@ -954,6 +954,10 @@ fn openai_responses_handle_event(data: &Value, handler: &mut SseHandler) -> Resu
|
||||
// partial text or tool calls are returned rather than discarded
|
||||
// by a hard error; only an empty truncated response bails.
|
||||
if handler.has_received_visible_output() {
|
||||
debug!(
|
||||
"response truncated ({}); keeping partial output",
|
||||
data["response"]["incomplete_details"]["reason"]
|
||||
);
|
||||
return Ok(true);
|
||||
}
|
||||
match data["response"]["incomplete_details"]["reason"].as_str() {
|
||||
|
||||
@@ -552,6 +552,23 @@ mod tests {
|
||||
assert!(handler.has_received_content());
|
||||
}
|
||||
|
||||
/// Pins the deliberate exclusion: thinking blocks count as received
|
||||
/// content but not as visible output, so a thinking-only stream is
|
||||
/// still an empty response to the caller.
|
||||
#[test]
|
||||
fn thinking_blocks_do_not_count_as_visible_output() {
|
||||
let (mut handler, _rx) = new_handler();
|
||||
handler.thinking_block(ThinkingBlock::Thinking {
|
||||
thinking: "hmm".to_string(),
|
||||
signature: "sig".to_string(),
|
||||
});
|
||||
assert!(handler.has_received_content());
|
||||
assert!(!handler.has_received_visible_output());
|
||||
|
||||
handler.text("hello").unwrap();
|
||||
assert!(handler.has_received_visible_output());
|
||||
}
|
||||
|
||||
/// Claude splits usage across events: `message_start` carries the input
|
||||
/// and cache counts with a provisional output count, `message_delta`
|
||||
/// carries only the final output count. Later non-None fields must win.
|
||||
|
||||
Reference in new issue
Block a user