[codex] Use input items for Responses Lite tools (#27946)

When using Responses Lite, we should all use `additional_tools` and a
developer item instead of the top level tools array & instructions
field. This keeps things 1-to-1.

Forced namespacing for _all_ tools will land in a following PR after
some coordination & fixes in Responses API (around collisions & return
items).

The goal is to eventually expand the scope of this to _all_ requests
from codex, but that will require larger coordination across providers &
slower rollout.
This commit is contained in:
rka-oai authored and GitHub committed 2026-06-22 23:56:16 -07:00
1 parent a22e3d0b82
commit 33cc928d33
22 files changed
+298 -45

No files matched your search

@@ -37,6 +37,9 @@ pub(super) fn normalize_model_items(
) -> Result<Vec<NormalizedConversationItem>> {
let mut normalized_items = Vec::new();
for item in items {
if item.get("type").and_then(Value::as_str) == Some("additional_tools") {
continue;
}
normalized_items.push(normalize_model_item(item, raw_payload)?);
}
Ok(normalized_items)
@@ -735,6 +735,48 @@ fn unsupported_model_item_is_reducer_error() -> anyhow::Result<()> {
)
}
#[test]
fn additional_tools_are_excluded_from_request_conversation() -> anyhow::Result<()> {
let temp = TempDir::new()?;
let writer = create_started_writer(&temp)?;
start_turn(&writer, "turn-1")?;
let request = writer.write_json_payload(
RawPayloadKind::InferenceRequest,
&json!({
"input": [
{
"type": "additional_tools",
"role": "developer",
"tools": [{
"type": "function",
"name": "lookup",
"parameters": {"type": "object", "properties": {}}
}]
},
message("user", "find it")
]
}),
)?;
append_inference_start(&writer, "inference-1", "turn-1", request)?;
let rollout = replay_bundle(temp.path())?;
let request_item_ids = &rollout.inference_calls["inference-1"].request_item_ids;
assert_eq!(request_item_ids.len(), 1);
assert_eq!(rollout.conversation_items.len(), 1);
assert_eq!(
rollout.conversation_items[&request_item_ids[0]].body,
ConversationBody {
parts: vec![ConversationPart::Text {
text: "find it".to_string(),
}],
}
);
Ok(())
}
#[test]
fn missing_request_input_is_reducer_error() -> anyhow::Result<()> {
let temp = TempDir::new()?;