fix(codex): avoid replaying static config on websocket continuations

This commit is contained in:
ZheFox
2026-08-20 00:40:40 +08:00
parent 342f8b6a5f
commit d21d8ce9f5
2 changed files with 167 additions and 1 deletions
@@ -388,6 +388,54 @@ mod tests {
assert_eq!(normalized["previous_response_id"], "resp_123");
}
#[test]
fn lite_continuations_forward_only_each_turns_incremental_input() {
let normalization = ResponsesWebSocketBodyNormalization::for_tests("gpt-5.6-sol")
.with_provider_type_for_tests("codex");
for turn in 1..=4 {
let event = json!({
"type": "response.create",
"model": "gpt-5.6-sol",
"previous_response_id": format!("resp_{turn}"),
"instructions": "The same large developer instructions.",
"tools": [{
"type": "function",
"name": "shell",
"parameters": {"type": "object"}
}],
"input": [
{
"type": "reasoning",
"id": format!("rs_{turn}"),
"content": [{
"type": "reasoning_text",
"text": format!("reasoning state {turn}")
}],
"encrypted_content": format!("opaque-{turn}")
},
{
"type": "function_call_output",
"call_id": format!("call_{turn}"),
"output": format!("result {turn}")
}
]
});
let normalized = normalized_continuation(&event, &normalization);
let input = normalized["input"].as_array().expect("incremental input");
assert_eq!(input.len(), 2);
assert_eq!(input[0]["type"], "reasoning");
assert_eq!(input[0]["content"][0]["type"], "reasoning_text");
assert_eq!(input[1]["type"], "function_call_output");
assert!(normalized.get("instructions").is_none());
assert!(normalized.get("tools").is_none());
assert!(!input.iter().any(|item| item["type"] == "additional_tools"));
assert!(!input.iter().any(|item| item["role"] == "developer"));
assert_eq!(normalized["previous_response_id"], format!("resp_{turn}"));
}
}
#[test]
fn continuation_keeps_a_warmup_generate_flag() {
let event = json!({