[codex] Trace cancelled inference streams (#19839)

Records cancelled inference streams when Codex stops consuming a
provider response before `response.completed`, preserving complete
output items observed before cancellation.

Also closes still-running inference calls when the owning turn ends, so
reduced rollout traces do not leave stale `Running` inference nodes.

Covered by focused reducer coverage and a core stream-drop test for
partial output preservation.
This commit is contained in:
cassirer-openai authored and GitHub committed 2026-04-27 21:58:29 +00:00
1 parent 2be9fd5a93
commit 30c5c768de
10 files changed
+556 -39

No files matched your search

+1 -1
View File
@@ -134,7 +134,7 @@ fn disabled_thread_context_accepts_trace_calls_without_writing() -> anyhow::Resu
inference_attempt.record_started(&serde_json::json!({ "kind": "inference" }));
let token_usage: Option<codex_protocol::protocol::TokenUsage> = None;
inference_attempt.record_completed("response-1", &token_usage, &[]);
inference_attempt.record_failed("inference failed");
inference_attempt.record_failed("inference failed", &[]);
let compaction_trace = thread_trace.compaction_trace_context(
"turn-1",