mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Mark finished empty Code Mode tool inventories as complete (#46081)
## Why Code Mode cells that finish without invoking tools omit completeness metadata, leaving a verified empty inventory indistinguishable from an unverified one. ## What changed - Retain completed, losslessly recorded cells even when they contain no tool calls. - Always include `executed_tool_calls` when setting `tool_calls_complete`, using `[]` for empty inventories or terminal waits with no new calls. - Preserve completeness across request retries while revalidating history and rejecting late calls or ambiguous output mappings. ## Testing Add regression coverage for empty tool discovery, errors, termination, feature gating, retries, and fresh-session requirements for waits. Update protocol assertions to require an explicit empty call list with completeness metadata. GitOrigin-RevId: 24affe47f46068b6559d04a0103958ae83a00b92
This commit is contained in:
1 parent
1e9564fb85
commit
8452164c76
5 files changed
+210
-15
No files matched your search
@@ -464,8 +464,10 @@ impl ResponseItem {
|
||||
}
|
||||
|
||||
/// Marks a host-owned direct invocation or Code Mode cell's call inventory as complete.
|
||||
/// Always includes this output's call list, which can be an empty delta for a terminal wait.
|
||||
pub fn mark_tool_calls_complete(&mut self) {
|
||||
if let Some(metadata) = self.ensure_tool_call_metadata() {
|
||||
metadata.executed_tool_calls.get_or_insert_default();
|
||||
metadata.tool_calls_complete = Some(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,7 +396,9 @@ fn tool_call_completeness_is_host_only_and_fail_closed() -> Result<()> {
|
||||
bound_executed_tool_calls_for_prompt(std::slice::from_mut(&mut item));
|
||||
assert_eq!(
|
||||
serde_json::to_value(&item)?["internal_chat_message_metadata_passthrough"],
|
||||
serde_json::json!({ "cell_id": "cell-1", "tool_calls_complete": true }),
|
||||
serde_json::json!({
|
||||
"cell_id": "cell-1", "executed_tool_calls": [], "tool_calls_complete": true
|
||||
}),
|
||||
);
|
||||
item.append_executed_tool_calls(vec![call]);
|
||||
item.clear_executed_tool_calls();
|
||||
|
||||
Reference in new issue
Block a user