mirror of
https://github.com/openai/codex.git
synced 2026-10-25 07:55:34 +00:00
Record attempted tool calls in response metadata (#36181)
## What changed - Add the opt-in `executed_tool_call_metadata` feature to record model-attempted direct and code-mode tool calls. - Attach recorded names and arguments to the matching tool output in the next Responses request, preserving the metadata across sampling retries. - Bound pending calls and argument sizes, and emit truncation metadata when limits are exceeded. ## Testing - Cover disabled-by-default behavior, namespaced and nested calls, blocked or failed attempts, retry handling, and recorder limits. GitOrigin-RevId: 5ce917b73e797b0f6904d46477b9d2cf8ea71bf2
This commit is contained in:
@@ -53,6 +53,9 @@ impl CodeModeExecuteHandler {
|
||||
.await
|
||||
.map_err(FunctionCallError::RespondToModel)?;
|
||||
let cell_id = started_cell.cell_id.clone();
|
||||
if let Some(executed_tool_calls) = exec.session.services.executed_tool_calls.as_ref() {
|
||||
executed_tool_calls.register_cell(&cell_id, &call_id);
|
||||
}
|
||||
let runtime_cell_id = cell_id.to_string();
|
||||
let code_cell_trace = exec
|
||||
.session
|
||||
|
||||
@@ -66,6 +66,7 @@ impl CodeModeWaitHandler {
|
||||
let ToolInvocation {
|
||||
session,
|
||||
turn,
|
||||
call_id,
|
||||
tool_name,
|
||||
payload,
|
||||
..
|
||||
@@ -79,6 +80,11 @@ impl CodeModeWaitHandler {
|
||||
let exec = ExecContext { session, turn };
|
||||
let started_at = std::time::Instant::now();
|
||||
let cell_id = codex_code_mode::CellId::new(args.cell_id);
|
||||
if let Some(executed_tool_calls) =
|
||||
exec.session.services.executed_tool_calls.as_ref()
|
||||
{
|
||||
executed_tool_calls.register_cell(&cell_id, &call_id);
|
||||
}
|
||||
let wait_response = if args.terminate {
|
||||
exec.session
|
||||
.services
|
||||
|
||||
Reference in New Issue
Block a user