fix(responses): provenance-gate foreign turns (Pi transform-messages)
Cross-provider audit R5 + R2-residual: BackendToolCall items round-trip as their typed shapes with provider-issued ids (grok x_search CustomToolCall, web_search/code_interpreter calls) and Reasoning items carry model-bound encrypted payloads — replaying either to a DIFFERENT Responses target names undeclared tools / undecryptable material → 400. New transform_items_for_responses pre-pass: each [Reasoning| BackendToolCall]* Assistant run carries provenance in AssistantItem.model_id; on confirmed mismatch with the request's target model, Reasoning siblings are dropped and BackendToolCall demoted to the same text summary the Messages/ChatCompletions builders already emit. Same-model and unknown-provenance turns stay byte-verbatim (KV-cache prefix stability preserved). The legacy-upgrade round-trip test now models the same-model continuation it always described. Part 5 of the cross-provider replay audit. Verified: sampling-types 290 + downstream 5794 green, clippy clean.
This commit is contained in:
@@ -472,7 +472,12 @@ async fn responses_upgrade_roundtrips_reconstructed_reasoning_as_typed_input() {
|
||||
"\n",
|
||||
r#"{"type":"user","content":[{"type":"text","text":"q1"}]}"#,
|
||||
"\n",
|
||||
r#"{"type":"assistant","content":"a1","reasoning":{"text":"legacy kigi reasoning","encrypted":"ENC_BLOB_xyz","id":"rs_kigibuild_legacy"},"model_id":"kigi"}"#,
|
||||
// model_id matches the test client's request model: this test
|
||||
// covers the SAME-MODEL continuation (the byte-stable
|
||||
// SGLang-prefix path). A mismatched model_id is the provenance
|
||||
// gate's territory (`transform_items_for_responses`) and drops
|
||||
// the reasoning by design.
|
||||
r#"{"type":"assistant","content":"a1","reasoning":{"text":"legacy kigi reasoning","encrypted":"ENC_BLOB_xyz","id":"rs_kigibuild_legacy"},"model_id":"test-model"}"#,
|
||||
"\n",
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user