Support standalone named function call outputs (#39782)

## Why

External tool events may need to enter thread history without a preceding function call and therefore do not have a `call_id`.

## What changed

- Allow `function_call_output` items to omit `call_id` and carry optional `name` and `namespace` fields.
- Preserve named standalone outputs during history normalization and agent forks while retaining existing pairing behavior for outputs with a `call_id`.
- Accept, persist, and forward these outputs through `thread/inject_items`, and update the app-server schemas and documentation.

## Testing

- Cover paired and standalone JSON round trips, history normalization, agent forks, and injected thread history.

GitOrigin-RevId: a3258163a7dc93777c7c3023116fe204819bdbb0
This commit is contained in:
rka-oai authored and copyberry committed 2026-08-20 19:19:41 +00:00
1 parent 854cbb2fd4
commit 763787d061
42 files changed
+473 -114

No files matched your search

+3 -1
View File
@@ -566,7 +566,9 @@ pub(crate) fn collect_guardian_transcript_entries<'a>(
)
}),
ResponseItem::FunctionCallOutput {
call_id, output, ..
call_id: Some(call_id),
output,
..
}
| ResponseItem::CustomToolCallOutput {
call_id, output, ..
+6 -2
View File
@@ -358,7 +358,9 @@ async fn seed_guardian_parent_history(session: &Arc<Session>, turn: &Arc<TurnCon
},
ResponseItem::FunctionCallOutput {
id: None,
call_id: "call-1".to_string(),
call_id: Some("call-1".to_string()),
name: None,
namespace: None,
output: codex_protocol::models::FunctionCallOutputPayload::from_text(
"repo visibility: public".to_string(),
),
@@ -999,7 +1001,9 @@ fn collect_guardian_transcript_entries_includes_recent_tool_calls_and_output() {
},
ResponseItem::FunctionCallOutput {
id: None,
call_id: "call-1".to_string(),
call_id: Some("call-1".to_string()),
name: None,
namespace: None,
output: codex_protocol::models::FunctionCallOutputPayload::from_text(
"repo is public".to_string(),
),