From 695b022c8582514a13bea6a9d99a31f446389aa5 Mon Sep 17 00:00:00 2001 From: rhan-oai Date: Thu, 30 Apr 2026 14:09:02 -0700 Subject: [PATCH] [codex-analytics] add protocol-native item timestamps --- .../schema/json/ServerNotification.json | 144 ++++++++++++++++++ .../codex_app_server_protocol.schemas.json | 144 ++++++++++++++++++ .../codex_app_server_protocol.v2.schemas.json | 144 ++++++++++++++++++ .../json/v2/ItemCompletedNotification.json | 144 ++++++++++++++++++ .../json/v2/ItemStartedNotification.json | 144 ++++++++++++++++++ .../schema/json/v2/ReviewStartResponse.json | 144 ++++++++++++++++++ .../schema/json/v2/ThreadForkResponse.json | 144 ++++++++++++++++++ .../schema/json/v2/ThreadListResponse.json | 144 ++++++++++++++++++ .../json/v2/ThreadMetadataUpdateResponse.json | 144 ++++++++++++++++++ .../schema/json/v2/ThreadReadResponse.json | 144 ++++++++++++++++++ .../schema/json/v2/ThreadResumeResponse.json | 144 ++++++++++++++++++ .../json/v2/ThreadRollbackResponse.json | 144 ++++++++++++++++++ .../schema/json/v2/ThreadStartResponse.json | 144 ++++++++++++++++++ .../json/v2/ThreadStartedNotification.json | 144 ++++++++++++++++++ .../json/v2/ThreadTurnsListResponse.json | 144 ++++++++++++++++++ .../json/v2/ThreadUnarchiveResponse.json | 144 ++++++++++++++++++ .../json/v2/TurnCompletedNotification.json | 144 ++++++++++++++++++ .../schema/json/v2/TurnStartResponse.json | 144 ++++++++++++++++++ .../json/v2/TurnStartedNotification.json | 144 ++++++++++++++++++ .../schema/typescript/v2/ThreadItem.ts | 76 ++++++++- .../src/protocol/item_builders.rs | 19 +++ .../src/protocol/thread_history.rs | 125 +++++++++++++++ .../app-server-protocol/src/protocol/v2.rs | 66 ++++++++ .../app-server/src/bespoke_event_handling.rs | 73 +++++++++ .../tests/suite/v2/dynamic_tools.rs | 8 + .../app-server/tests/suite/v2/mcp_tool.rs | 2 + .../tests/suite/v2/thread_resume.rs | 28 +++- .../app-server/tests/suite/v2/turn_start.rs | 57 +++++-- codex-rs/core/src/event_mapping.rs | 6 + codex-rs/core/src/event_mapping_tests.rs | 12 ++ codex-rs/core/src/mcp_tool_call.rs | 19 +++ codex-rs/core/src/session/mod.rs | 15 +- codex-rs/core/src/session/session.rs | 3 + codex-rs/core/src/session/tests.rs | 2 + codex-rs/core/src/tasks/user_shell.rs | 12 ++ codex-rs/core/src/tools/events.rs | 20 +++ codex-rs/core/src/tools/handlers/dynamic.rs | 8 + .../core/src/tools/handlers/mcp_resource.rs | 46 +++++- .../handlers/multi_agents/close_agent.rs | 10 ++ .../handlers/multi_agents/resume_agent.rs | 6 + .../tools/handlers/multi_agents/send_input.rs | 6 + .../src/tools/handlers/multi_agents/spawn.rs | 6 + .../src/tools/handlers/multi_agents/wait.rs | 10 ++ .../src/tools/handlers/multi_agents_common.rs | 27 ++++ .../handlers/multi_agents_v2/close_agent.rs | 10 ++ .../handlers/multi_agents_v2/message_tool.rs | 6 + .../tools/handlers/multi_agents_v2/spawn.rs | 6 + .../tools/handlers/multi_agents_v2/wait.rs | 6 + codex-rs/core/src/turn_timing.rs | 2 +- codex-rs/core/tests/suite/items.rs | 21 +++ codex-rs/core/tests/suite/rmcp_client.rs | 3 + codex-rs/core/tests/suite/user_shell_cmd.rs | 12 +- .../src/event_processor_with_jsonl_output.rs | 1 + .../tests/event_processor_with_json_output.rs | 39 +++++ codex-rs/protocol/src/dynamic_tools.rs | 3 + codex-rs/protocol/src/items.rs | 50 ++++++ codex-rs/protocol/src/protocol.rs | 133 ++++++++++++++++ codex-rs/rollout/src/policy.rs | 3 + codex-rs/tui/src/app/app_server_adapter.rs | 38 ++++- codex-rs/tui/src/app/tests.rs | 6 + codex-rs/tui/src/chatwidget.rs | 97 +++++++++++- codex-rs/tui/src/chatwidget/interrupts.rs | 1 + .../tui/src/chatwidget/tests/app_server.rs | 23 +++ .../tui/src/chatwidget/tests/exec_flow.rs | 15 ++ codex-rs/tui/src/chatwidget/tests/helpers.rs | 5 + .../src/chatwidget/tests/status_and_layout.rs | 3 + codex-rs/tui/src/multi_agents.rs | 25 +++ 67 files changed, 3869 insertions(+), 37 deletions(-) diff --git a/codex-rs/app-server-protocol/schema/json/ServerNotification.json b/codex-rs/app-server-protocol/schema/json/ServerNotification.json index 6dbc66cb41..9782247007 100644 --- a/codex-rs/app-server-protocol/schema/json/ServerNotification.json +++ b/codex-rs/app-server-protocol/schema/json/ServerNotification.json @@ -3313,6 +3313,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -3355,6 +3363,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -3385,9 +3401,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -3411,6 +3451,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -3451,6 +3499,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -3479,6 +3535,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -3505,6 +3569,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -3544,6 +3616,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -3584,6 +3672,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -3632,12 +3728,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -3680,6 +3800,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -3702,6 +3838,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json index 9adc20bd34..9ed4ffb25b 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json @@ -15479,6 +15479,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -15521,6 +15529,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/v2/CommandExecutionStatus" }, @@ -15551,9 +15567,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/v2/PatchApplyStatus" }, @@ -15577,6 +15617,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -15617,6 +15665,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/v2/McpToolCallStatus" }, @@ -15645,6 +15701,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/v2/DynamicToolCallOutputContentItem" @@ -15671,6 +15735,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/v2/DynamicToolCallStatus" }, @@ -15710,6 +15782,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -15750,6 +15838,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -15798,12 +15894,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -15846,6 +15966,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -15868,6 +16004,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json index d581e19b98..e4f7f18283 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json @@ -13365,6 +13365,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -13407,6 +13415,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -13437,9 +13453,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -13463,6 +13503,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -13503,6 +13551,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -13531,6 +13587,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -13557,6 +13621,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -13596,6 +13668,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -13636,6 +13724,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -13684,12 +13780,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -13732,6 +13852,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -13754,6 +13890,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json index 0831483a32..733759a6b1 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json @@ -668,6 +668,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -710,6 +718,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -740,9 +756,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -766,6 +806,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -806,6 +854,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -834,6 +890,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -860,6 +924,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -899,6 +971,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -939,6 +1027,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -987,12 +1083,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1035,6 +1155,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1057,6 +1193,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json index 16bfeece14..22e2c913d1 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json @@ -668,6 +668,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -710,6 +718,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -740,9 +756,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -766,6 +806,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -806,6 +854,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -834,6 +890,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -860,6 +924,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -899,6 +971,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -939,6 +1027,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -987,12 +1083,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1035,6 +1155,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1057,6 +1193,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json index 16abcd7806..c2c689c6fa 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json @@ -812,6 +812,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -854,6 +862,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -884,9 +900,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -910,6 +950,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -950,6 +998,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -978,6 +1034,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1004,6 +1068,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1043,6 +1115,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1083,6 +1171,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1131,12 +1227,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1179,6 +1299,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1201,6 +1337,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json index 653c5f2387..e710d0c0b4 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json @@ -1638,6 +1638,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1680,6 +1688,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1710,9 +1726,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1736,6 +1776,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1776,6 +1824,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1804,6 +1860,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1830,6 +1894,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1869,6 +1941,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1909,6 +1997,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1957,12 +2053,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -2005,6 +2125,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -2027,6 +2163,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json index 2f5cbb9500..17a41f4d53 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json @@ -1088,6 +1088,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1130,6 +1138,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1160,9 +1176,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1186,6 +1226,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1226,6 +1274,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1254,6 +1310,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1280,6 +1344,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1319,6 +1391,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1359,6 +1447,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1407,12 +1503,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1455,6 +1575,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1477,6 +1613,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json index b9ae59708a..f19c058a0a 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json @@ -1088,6 +1088,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1130,6 +1138,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1160,9 +1176,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1186,6 +1226,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1226,6 +1274,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1254,6 +1310,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1280,6 +1344,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1319,6 +1391,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1359,6 +1447,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1407,12 +1503,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1455,6 +1575,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1477,6 +1613,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json index cda474c294..6c62fdefa5 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json @@ -1088,6 +1088,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1130,6 +1138,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1160,9 +1176,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1186,6 +1226,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1226,6 +1274,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1254,6 +1310,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1280,6 +1344,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1319,6 +1391,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1359,6 +1447,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1407,12 +1503,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1455,6 +1575,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1477,6 +1613,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json index 27cf47f2fc..dd329a17ff 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json @@ -1638,6 +1638,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1680,6 +1688,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1710,9 +1726,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1736,6 +1776,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1776,6 +1824,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1804,6 +1860,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1830,6 +1894,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1869,6 +1941,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1909,6 +1997,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1957,12 +2053,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -2005,6 +2125,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -2027,6 +2163,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json index e5339f4e99..81f3b9b0ee 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json @@ -1088,6 +1088,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1130,6 +1138,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1160,9 +1176,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1186,6 +1226,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1226,6 +1274,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1254,6 +1310,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1280,6 +1344,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1319,6 +1391,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1359,6 +1447,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1407,12 +1503,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1455,6 +1575,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1477,6 +1613,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json index 7d93606aa4..995c037734 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json @@ -1638,6 +1638,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1680,6 +1688,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1710,9 +1726,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1736,6 +1776,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1776,6 +1824,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1804,6 +1860,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1830,6 +1894,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1869,6 +1941,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1909,6 +1997,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1957,12 +2053,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -2005,6 +2125,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -2027,6 +2163,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json index 774686e46a..a270327726 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json @@ -1088,6 +1088,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1130,6 +1138,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1160,9 +1176,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1186,6 +1226,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1226,6 +1274,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1254,6 +1310,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1280,6 +1344,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1319,6 +1391,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1359,6 +1447,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1407,12 +1503,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1455,6 +1575,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1477,6 +1613,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadTurnsListResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadTurnsListResponse.json index eaa3becdea..da3fcbbb64 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadTurnsListResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadTurnsListResponse.json @@ -812,6 +812,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -854,6 +862,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -884,9 +900,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -910,6 +950,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -950,6 +998,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -978,6 +1034,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1004,6 +1068,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1043,6 +1115,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1083,6 +1171,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1131,12 +1227,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1179,6 +1299,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1201,6 +1337,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json index 64179af7e1..9675db0916 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json @@ -1088,6 +1088,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1130,6 +1138,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1160,9 +1176,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1186,6 +1226,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1226,6 +1274,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1254,6 +1310,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1280,6 +1344,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1319,6 +1391,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1359,6 +1447,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1407,12 +1503,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1455,6 +1575,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1477,6 +1613,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json index 0739fa31bc..972d64a5e5 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json @@ -812,6 +812,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -854,6 +862,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -884,9 +900,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -910,6 +950,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -950,6 +998,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -978,6 +1034,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1004,6 +1068,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1043,6 +1115,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1083,6 +1171,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1131,12 +1227,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1179,6 +1299,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1201,6 +1337,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json b/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json index bc5917ef15..759376f5c7 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json @@ -812,6 +812,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -854,6 +862,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -884,9 +900,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -910,6 +950,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -950,6 +998,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -978,6 +1034,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1004,6 +1068,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1043,6 +1115,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1083,6 +1171,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1131,12 +1227,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1179,6 +1299,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1201,6 +1337,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json index 22ad85d906..1e6f009597 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json @@ -812,6 +812,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -854,6 +862,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -884,9 +900,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -910,6 +950,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -950,6 +998,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -978,6 +1034,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1004,6 +1068,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1043,6 +1115,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1083,6 +1171,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool call started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1131,12 +1227,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1179,6 +1299,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1201,6 +1337,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ThreadItem.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadItem.ts index f7880c9d32..bfb79723c3 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/ThreadItem.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadItem.ts @@ -50,14 +50,50 @@ aggregatedOutput: string | null, * The command's exit code. */ exitCode: number | null, +/** + * Unix timestamp (in milliseconds) when command execution started, if known. + */ +startedAtMs: number | null, +/** + * Unix timestamp (in milliseconds) when command execution completed, if known. + */ +completedAtMs: number | null, /** * The duration of the command execution in milliseconds. */ -durationMs: number | null, } | { "type": "fileChange", id: string, changes: Array, status: PatchApplyStatus, } | { "type": "mcpToolCall", id: string, server: string, tool: string, status: McpToolCallStatus, arguments: JsonValue, mcpAppResourceUri?: string, result: McpToolCallResult | null, error: McpToolCallError | null, +durationMs: number | null, } | { "type": "fileChange", id: string, changes: Array, status: PatchApplyStatus, +/** + * Unix timestamp (in milliseconds) when patch application started, if known. + */ +startedAtMs: number | null, +/** + * Unix timestamp (in milliseconds) when patch application completed, if known. + */ +completedAtMs: number | null, +/** + * The duration of patch application in milliseconds. + */ +durationMs: number | null, } | { "type": "mcpToolCall", id: string, server: string, tool: string, status: McpToolCallStatus, arguments: JsonValue, mcpAppResourceUri?: string, result: McpToolCallResult | null, error: McpToolCallError | null, +/** + * Unix timestamp (in milliseconds) when MCP tool execution started, if known. + */ +startedAtMs: number | null, +/** + * Unix timestamp (in milliseconds) when MCP tool execution completed, if known. + */ +completedAtMs: number | null, /** * The duration of the MCP tool call in milliseconds. */ durationMs: number | null, } | { "type": "dynamicToolCall", id: string, namespace: string | null, tool: string, arguments: JsonValue, status: DynamicToolCallStatus, contentItems: Array | null, success: boolean | null, +/** + * Unix timestamp (in milliseconds) when dynamic tool call started, if known. + */ +startedAtMs: number | null, +/** + * Unix timestamp (in milliseconds) when dynamic tool call completed, if known. + */ +completedAtMs: number | null, /** * The duration of the dynamic tool call in milliseconds. */ @@ -98,4 +134,40 @@ reasoningEffort: ReasoningEffort | null, /** * Last known status of the target agents, when available. */ -agentsStates: { [key in string]?: CollabAgentState }, } | { "type": "webSearch", id: string, query: string, action: WebSearchAction | null, } | { "type": "imageView", id: string, path: AbsolutePathBuf, } | { "type": "imageGeneration", id: string, status: string, revisedPrompt: string | null, result: string, savedPath?: AbsolutePathBuf, } | { "type": "enteredReviewMode", id: string, review: string, } | { "type": "exitedReviewMode", id: string, review: string, } | { "type": "contextCompaction", id: string, }; +agentsStates: { [key in string]?: CollabAgentState }, +/** + * Unix timestamp (in milliseconds) when collab tool call started, if known. + */ +startedAtMs: number | null, +/** + * Unix timestamp (in milliseconds) when collab tool call completed, if known. + */ +completedAtMs: number | null, +/** + * The duration of the collab tool call in milliseconds. + */ +durationMs: number | null, } | { "type": "webSearch", id: string, query: string, action: WebSearchAction | null, +/** + * Unix timestamp (in milliseconds) when web search started, if known. + */ +startedAtMs: number | null, +/** + * Unix timestamp (in milliseconds) when web search completed, if known. + */ +completedAtMs: number | null, +/** + * The duration of the web search in milliseconds. + */ +durationMs: number | null, } | { "type": "imageView", id: string, path: AbsolutePathBuf, } | { "type": "imageGeneration", id: string, status: string, revisedPrompt: string | null, result: string, savedPath?: AbsolutePathBuf, +/** + * Unix timestamp (in milliseconds) when image generation started, if known. + */ +startedAtMs: number | null, +/** + * Unix timestamp (in milliseconds) when image generation completed, if known. + */ +completedAtMs: number | null, +/** + * The duration of image generation in milliseconds. + */ +durationMs: number | null, } | { "type": "enteredReviewMode", id: string, review: string, } | { "type": "exitedReviewMode", id: string, review: string, } | { "type": "contextCompaction", id: string, }; diff --git a/codex-rs/app-server-protocol/src/protocol/item_builders.rs b/codex-rs/app-server-protocol/src/protocol/item_builders.rs index 546fb1b679..461e315b73 100644 --- a/codex-rs/app-server-protocol/src/protocol/item_builders.rs +++ b/codex-rs/app-server-protocol/src/protocol/item_builders.rs @@ -45,6 +45,9 @@ pub fn build_file_change_approval_request_item( id: payload.call_id.clone(), changes: convert_patch_changes(&payload.changes), status: PatchApplyStatus::InProgress, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } } @@ -53,6 +56,9 @@ pub fn build_file_change_begin_item(payload: &PatchApplyBeginEvent) -> ThreadIte id: payload.call_id.clone(), changes: convert_patch_changes(&payload.changes), status: PatchApplyStatus::InProgress, + started_at_ms: payload.started_at_ms, + completed_at_ms: None, + duration_ms: None, } } @@ -61,6 +67,9 @@ pub fn build_file_change_end_item(payload: &PatchApplyEndEvent) -> ThreadItem { id: payload.call_id.clone(), changes: convert_patch_changes(&payload.changes), status: (&payload.status).into(), + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, + duration_ms: payload.duration_ms, } } @@ -82,6 +91,8 @@ pub fn build_command_execution_approval_request_item( .collect(), aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, } } @@ -102,6 +113,8 @@ pub fn build_command_execution_begin_item(payload: &ExecCommandBeginEvent) -> Th .collect(), aggregated_output: None, exit_code: None, + started_at_ms: payload.started_at_ms, + completed_at_ms: None, duration_ms: None, } } @@ -129,6 +142,8 @@ pub fn build_command_execution_end_item(payload: &ExecCommandEndEvent) -> Thread .collect(), aggregated_output, exit_code: Some(payload.exit_code), + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, duration_ms: Some(duration_ms), } } @@ -158,6 +173,8 @@ pub fn build_item_from_guardian_event( command_actions, aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }) } @@ -194,6 +211,8 @@ pub fn build_item_from_guardian_event( command_actions, aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }) } diff --git a/codex-rs/app-server-protocol/src/protocol/thread_history.rs b/codex-rs/app-server-protocol/src/protocol/thread_history.rs index 019c9fa83e..2814101fb0 100644 --- a/codex-rs/app-server-protocol/src/protocol/thread_history.rs +++ b/codex-rs/app-server-protocol/src/protocol/thread_history.rs @@ -388,6 +388,9 @@ impl ThreadHistoryBuilder { id: payload.call_id.clone(), query: String::new(), action: None, + started_at_ms: payload.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; self.upsert_item_in_current_turn(item); } @@ -397,6 +400,9 @@ impl ThreadHistoryBuilder { id: payload.call_id.clone(), query: payload.query.clone(), action: Some(WebSearchAction::from(payload.action.clone())), + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, + duration_ms: payload.duration_ms, }; self.upsert_item_in_current_turn(item); } @@ -474,6 +480,8 @@ impl ThreadHistoryBuilder { status: DynamicToolCallStatus::InProgress, content_items: None, success: None, + started_at_ms: payload.started_at_ms, + completed_at_ms: None, duration_ms: None, }; if payload.turn_id.is_empty() { @@ -498,6 +506,8 @@ impl ThreadHistoryBuilder { status, content_items: Some(convert_dynamic_tool_content_items(&payload.content_items)), success: Some(payload.success), + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, duration_ms, }; if payload.turn_id.is_empty() { @@ -521,6 +531,8 @@ impl ThreadHistoryBuilder { mcp_app_resource_uri: payload.mcp_app_resource_uri.clone(), result: None, error: None, + started_at_ms: payload.started_at_ms, + completed_at_ms: None, duration_ms: None, }; self.upsert_item_in_current_turn(item); @@ -562,6 +574,8 @@ impl ThreadHistoryBuilder { mcp_app_resource_uri: payload.mcp_app_resource_uri.clone(), result, error, + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, duration_ms, }; self.upsert_item_in_current_turn(item); @@ -582,6 +596,9 @@ impl ThreadHistoryBuilder { revised_prompt: None, result: String::new(), saved_path: None, + started_at_ms: payload.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; self.upsert_item_in_current_turn(item); } @@ -593,6 +610,9 @@ impl ThreadHistoryBuilder { revised_prompt: payload.revised_prompt.clone(), result: payload.result.clone(), saved_path: payload.saved_path.clone(), + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, + duration_ms: payload.duration_ms, }; self.upsert_item_in_current_turn(item); } @@ -611,6 +631,9 @@ impl ThreadHistoryBuilder { model: Some(payload.model.clone()), reasoning_effort: Some(payload.reasoning_effort), agents_states: HashMap::new(), + started_at_ms: payload.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; self.upsert_item_in_current_turn(item); } @@ -646,6 +669,9 @@ impl ThreadHistoryBuilder { model: Some(payload.model.clone()), reasoning_effort: Some(payload.reasoning_effort), agents_states, + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, + duration_ms: payload.duration_ms, }); } @@ -663,6 +689,9 @@ impl ThreadHistoryBuilder { model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: payload.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; self.upsert_item_in_current_turn(item); } @@ -687,6 +716,9 @@ impl ThreadHistoryBuilder { model: None, reasoning_effort: None, agents_states: [(receiver_id, received_status)].into_iter().collect(), + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, + duration_ms: payload.duration_ms, }); } @@ -708,6 +740,9 @@ impl ThreadHistoryBuilder { model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: payload.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; self.upsert_item_in_current_turn(item); } @@ -743,6 +778,9 @@ impl ThreadHistoryBuilder { model: None, reasoning_effort: None, agents_states, + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, + duration_ms: payload.duration_ms, }); } @@ -760,6 +798,9 @@ impl ThreadHistoryBuilder { model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: payload.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; self.upsert_item_in_current_turn(item); } @@ -786,6 +827,9 @@ impl ThreadHistoryBuilder { model: None, reasoning_effort: None, agents_states, + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, + duration_ms: payload.duration_ms, }); } @@ -803,6 +847,9 @@ impl ThreadHistoryBuilder { model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: payload.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; self.upsert_item_in_current_turn(item); } @@ -832,6 +879,9 @@ impl ThreadHistoryBuilder { model: None, reasoning_effort: None, agents_states, + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, + duration_ms: payload.duration_ms, }); } @@ -1426,6 +1476,9 @@ mod tests { revised_prompt: Some("final prompt".into()), result: "Zm9v".into(), saved_path: Some(test_path_buf("/tmp/ig_123.png").abs()), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, })), RolloutItem::EventMsg(EventMsg::TurnComplete(TurnCompleteEvent { turn_id: "turn-image".into(), @@ -1461,6 +1514,9 @@ mod tests { revised_prompt: Some("final prompt".into()), result: "Zm9v".into(), saved_path: Some(test_path_buf("/tmp/ig_123.png").abs()), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, ], } @@ -1810,6 +1866,9 @@ mod tests { query: Some("codex".into()), queries: None, }, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), EventMsg::ExecCommandEnd(ExecCommandEndEvent { call_id: "exec-1".into(), @@ -1829,6 +1888,8 @@ mod tests { duration: Duration::from_millis(12), formatted_output: String::new(), status: CoreExecCommandStatus::Completed, + started_at_ms: None, + completed_at_ms: None, }), EventMsg::McpToolCallEnd(McpToolCallEndEvent { call_id: "mcp-1".into(), @@ -1840,6 +1901,8 @@ mod tests { mcp_app_resource_uri: None, duration: Duration::from_millis(8), result: Err("boom".into()), + started_at_ms: None, + completed_at_ms: None, }), ]; @@ -1859,6 +1922,9 @@ mod tests { query: Some("codex".into()), queries: None, }), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ); assert_eq!( @@ -1875,6 +1941,8 @@ mod tests { }], aggregated_output: Some("hello world\n".into()), exit_code: Some(0), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(12), } ); @@ -1891,6 +1959,8 @@ mod tests { error: Some(McpToolCallError { message: "boom".into(), }), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(8), } ); @@ -1925,6 +1995,8 @@ mod tests { "ui/resourceUri": "ui://widget/lookup.html" })), }), + started_at_ms: None, + completed_at_ms: None, }), ]; @@ -1954,6 +2026,8 @@ mod tests { })), })), error: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(8), } ); @@ -1981,6 +2055,7 @@ mod tests { namespace: Some("codex_app".into()), tool: "lookup_ticket".into(), arguments: serde_json::json!({"id":"ABC-123"}), + started_at_ms: None, }, ), EventMsg::DynamicToolCallResponse(DynamicToolCallResponseEvent { @@ -1995,6 +2070,8 @@ mod tests { success: true, error: None, duration: Duration::from_millis(42), + started_at_ms: None, + completed_at_ms: None, }), ]; @@ -2017,6 +2094,8 @@ mod tests { text: "Ticket is open".into(), }]), success: Some(true), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(42), } ); @@ -2053,6 +2132,8 @@ mod tests { duration: Duration::ZERO, formatted_output: String::new(), status: CoreExecCommandStatus::Declined, + started_at_ms: None, + completed_at_ms: None, }), EventMsg::PatchApplyEnd(PatchApplyEndEvent { call_id: "patch-declined".into(), @@ -2069,6 +2150,9 @@ mod tests { .into_iter() .collect(), status: CorePatchApplyStatus::Declined, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), ]; @@ -2093,6 +2177,8 @@ mod tests { }], aggregated_output: Some("exec command rejected by user".into()), exit_code: Some(-1), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(0), } ); @@ -2106,6 +2192,9 @@ mod tests { diff: "hello\n".into(), }], status: PatchApplyStatus::Declined, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ); } @@ -2184,6 +2273,8 @@ mod tests { }], aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, } ); @@ -2245,6 +2336,8 @@ mod tests { }], aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, } ); @@ -2302,6 +2395,8 @@ mod tests { duration: Duration::from_millis(5), formatted_output: "done\n".into(), status: CoreExecCommandStatus::Completed, + started_at_ms: None, + completed_at_ms: None, }), EventMsg::TurnComplete(TurnCompleteEvent { turn_id: "turn-b".into(), @@ -2336,6 +2431,8 @@ mod tests { }], aggregated_output: Some("done\n".into()), exit_code: Some(0), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(5), } ); @@ -2393,6 +2490,8 @@ mod tests { duration: Duration::from_millis(5), formatted_output: "done\n".into(), status: CoreExecCommandStatus::Completed, + started_at_ms: None, + completed_at_ms: None, }), EventMsg::TurnComplete(TurnCompleteEvent { turn_id: "turn-b".into(), @@ -2454,6 +2553,7 @@ mod tests { )] .into_iter() .collect(), + started_at_ms: None, }), ]; @@ -2484,6 +2584,9 @@ mod tests { diff: "hello\n".into(), }], status: PatchApplyStatus::InProgress, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, ] ); @@ -2549,6 +2652,9 @@ mod tests { diff: "hello\n".into(), }], status: PatchApplyStatus::InProgress, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, ] ); @@ -2734,6 +2840,9 @@ mod tests { receiver_agent_nickname: None, receiver_agent_role: None, status: AgentStatus::Completed(None), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), ]; @@ -2764,6 +2873,9 @@ mod tests { )] .into_iter() .collect(), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ); } @@ -2791,6 +2903,9 @@ mod tests { model: "gpt-5.4-mini".into(), reasoning_effort: codex_protocol::openai_models::ReasoningEffort::Medium, status: AgentStatus::Running, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), ]; @@ -2821,6 +2936,9 @@ mod tests { )] .into_iter() .collect(), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ); } @@ -2847,6 +2965,7 @@ mod tests { sender_thread_id: sender, receiver_thread_id: receiver, prompt: "new task".into(), + started_at_ms: None, }, ), EventMsg::CollabAgentInteractionEnd( @@ -2858,6 +2977,9 @@ mod tests { receiver_agent_role: None, prompt: "new task".into(), status: AgentStatus::Interrupted, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, ), ]; @@ -2889,6 +3011,9 @@ mod tests { )] .into_iter() .collect(), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ); } diff --git a/codex-rs/app-server-protocol/src/protocol/v2.rs b/codex-rs/app-server-protocol/src/protocol/v2.rs index f66078d4b5..a506117546 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2.rs @@ -5867,6 +5867,12 @@ pub enum ThreadItem { aggregated_output: Option, /// The command's exit code. exit_code: Option, + /// Unix timestamp (in milliseconds) when command execution started, if known. + #[ts(type = "number | null")] + started_at_ms: Option, + /// Unix timestamp (in milliseconds) when command execution completed, if known. + #[ts(type = "number | null")] + completed_at_ms: Option, /// The duration of the command execution in milliseconds. #[ts(type = "number | null")] duration_ms: Option, @@ -5877,6 +5883,15 @@ pub enum ThreadItem { id: String, changes: Vec, status: PatchApplyStatus, + /// Unix timestamp (in milliseconds) when patch application started, if known. + #[ts(type = "number | null")] + started_at_ms: Option, + /// Unix timestamp (in milliseconds) when patch application completed, if known. + #[ts(type = "number | null")] + completed_at_ms: Option, + /// The duration of patch application in milliseconds. + #[ts(type = "number | null")] + duration_ms: Option, }, #[serde(rename_all = "camelCase")] #[ts(rename_all = "camelCase")] @@ -5891,6 +5906,12 @@ pub enum ThreadItem { mcp_app_resource_uri: Option, result: Option>, error: Option, + /// Unix timestamp (in milliseconds) when MCP tool execution started, if known. + #[ts(type = "number | null")] + started_at_ms: Option, + /// Unix timestamp (in milliseconds) when MCP tool execution completed, if known. + #[ts(type = "number | null")] + completed_at_ms: Option, /// The duration of the MCP tool call in milliseconds. #[ts(type = "number | null")] duration_ms: Option, @@ -5905,6 +5926,12 @@ pub enum ThreadItem { status: DynamicToolCallStatus, content_items: Option>, success: Option, + /// Unix timestamp (in milliseconds) when dynamic tool call started, if known. + #[ts(type = "number | null")] + started_at_ms: Option, + /// Unix timestamp (in milliseconds) when dynamic tool call completed, if known. + #[ts(type = "number | null")] + completed_at_ms: Option, /// The duration of the dynamic tool call in milliseconds. #[ts(type = "number | null")] duration_ms: Option, @@ -5931,6 +5958,15 @@ pub enum ThreadItem { reasoning_effort: Option, /// Last known status of the target agents, when available. agents_states: HashMap, + /// Unix timestamp (in milliseconds) when collab tool call started, if known. + #[ts(type = "number | null")] + started_at_ms: Option, + /// Unix timestamp (in milliseconds) when collab tool call completed, if known. + #[ts(type = "number | null")] + completed_at_ms: Option, + /// The duration of the collab tool call in milliseconds. + #[ts(type = "number | null")] + duration_ms: Option, }, #[serde(rename_all = "camelCase")] #[ts(rename_all = "camelCase")] @@ -5938,6 +5974,15 @@ pub enum ThreadItem { id: String, query: String, action: Option, + /// Unix timestamp (in milliseconds) when web search started, if known. + #[ts(type = "number | null")] + started_at_ms: Option, + /// Unix timestamp (in milliseconds) when web search completed, if known. + #[ts(type = "number | null")] + completed_at_ms: Option, + /// The duration of the web search in milliseconds. + #[ts(type = "number | null")] + duration_ms: Option, }, #[serde(rename_all = "camelCase")] #[ts(rename_all = "camelCase")] @@ -5952,6 +5997,15 @@ pub enum ThreadItem { #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] saved_path: Option, + /// Unix timestamp (in milliseconds) when image generation started, if known. + #[ts(type = "number | null")] + started_at_ms: Option, + /// Unix timestamp (in milliseconds) when image generation completed, if known. + #[ts(type = "number | null")] + completed_at_ms: Option, + /// The duration of image generation in milliseconds. + #[ts(type = "number | null")] + duration_ms: Option, }, #[serde(rename_all = "camelCase")] #[ts(rename_all = "camelCase")] @@ -6416,6 +6470,9 @@ impl From for ThreadItem { id: search.id, query: search.query, action: Some(WebSearchAction::from(search.action)), + started_at_ms: search.started_at_ms, + completed_at_ms: search.completed_at_ms, + duration_ms: search.duration_ms, }, CoreTurnItem::ImageGeneration(image) => ThreadItem::ImageGeneration { id: image.id, @@ -6423,6 +6480,9 @@ impl From for ThreadItem { revised_prompt: image.revised_prompt, result: image.result, saved_path: image.saved_path, + started_at_ms: image.started_at_ms, + completed_at_ms: image.completed_at_ms, + duration_ms: image.duration_ms, }, CoreTurnItem::ContextCompaction(compaction) => { ThreadItem::ContextCompaction { id: compaction.id } @@ -10297,6 +10357,9 @@ mod tests { query: Some("docs".to_string()), queries: None, }, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }); assert_eq!( @@ -10308,6 +10371,9 @@ mod tests { query: Some("docs".to_string()), queries: None, }), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ); } diff --git a/codex-rs/app-server/src/bespoke_event_handling.rs b/codex-rs/app-server/src/bespoke_event_handling.rs index a54964f411..8a49def8ce 100644 --- a/codex-rs/app-server/src/bespoke_event_handling.rs +++ b/codex-rs/app-server/src/bespoke_event_handling.rs @@ -863,6 +863,8 @@ pub(crate) async fn apply_bespoke_event_handling( status: DynamicToolCallStatus::InProgress, content_items: None, success: None, + started_at_ms: request.started_at_ms, + completed_at_ms: None, duration_ms: None, }; let notification = ItemStartedNotification { @@ -916,6 +918,8 @@ pub(crate) async fn apply_bespoke_event_handling( .collect(), ), success: Some(response.success), + started_at_ms: response.started_at_ms, + completed_at_ms: response.completed_at_ms, duration_ms, }; let notification = ItemCompletedNotification { @@ -961,6 +965,9 @@ pub(crate) async fn apply_bespoke_event_handling( model: Some(begin_event.model), reasoning_effort: Some(begin_event.reasoning_effort), agents_states: HashMap::new(), + started_at_ms: begin_event.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; let notification = ItemStartedNotification { thread_id: conversation_id.to_string(), @@ -1000,6 +1007,9 @@ pub(crate) async fn apply_bespoke_event_handling( model: Some(end_event.model), reasoning_effort: Some(end_event.reasoning_effort), agents_states, + started_at_ms: end_event.started_at_ms, + completed_at_ms: end_event.completed_at_ms, + duration_ms: end_event.duration_ms, }; let notification = ItemCompletedNotification { thread_id: conversation_id.to_string(), @@ -1022,6 +1032,9 @@ pub(crate) async fn apply_bespoke_event_handling( model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: begin_event.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; let notification = ItemStartedNotification { thread_id: conversation_id.to_string(), @@ -1050,6 +1063,9 @@ pub(crate) async fn apply_bespoke_event_handling( model: None, reasoning_effort: None, agents_states: [(receiver_id, received_status)].into_iter().collect(), + started_at_ms: end_event.started_at_ms, + completed_at_ms: end_event.completed_at_ms, + duration_ms: end_event.duration_ms, }; let notification = ItemCompletedNotification { thread_id: conversation_id.to_string(), @@ -1076,6 +1092,9 @@ pub(crate) async fn apply_bespoke_event_handling( model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: begin_event.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; let notification = ItemStartedNotification { thread_id: conversation_id.to_string(), @@ -1114,6 +1133,9 @@ pub(crate) async fn apply_bespoke_event_handling( model: None, reasoning_effort: None, agents_states, + started_at_ms: end_event.started_at_ms, + completed_at_ms: end_event.completed_at_ms, + duration_ms: end_event.duration_ms, }; let notification = ItemCompletedNotification { thread_id: conversation_id.to_string(), @@ -1135,6 +1157,9 @@ pub(crate) async fn apply_bespoke_event_handling( model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: begin_event.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; let notification = ItemStartedNotification { thread_id: conversation_id.to_string(), @@ -1177,6 +1202,9 @@ pub(crate) async fn apply_bespoke_event_handling( model: None, reasoning_effort: None, agents_states, + started_at_ms: end_event.started_at_ms, + completed_at_ms: end_event.completed_at_ms, + duration_ms: end_event.duration_ms, }; let notification = ItemCompletedNotification { thread_id: conversation_id.to_string(), @@ -1566,6 +1594,8 @@ pub(crate) async fn apply_bespoke_event_handling( command_actions, aggregated_output: None, exit_code: None, + started_at_ms: exec_command_begin_event.started_at_ms, + completed_at_ms: None, duration_ms: None, }; let notification = ItemStartedNotification { @@ -1947,6 +1977,8 @@ async fn start_command_execution_item( command_actions, aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }, }; @@ -1991,6 +2023,8 @@ async fn complete_command_execution_item( command_actions, aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }; let notification = ItemCompletedNotification { @@ -2532,6 +2566,9 @@ async fn on_file_change_request_approval_response( id: item_id.clone(), changes, status, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, event_turn_id.clone(), &outgoing, @@ -2689,6 +2726,9 @@ fn collab_resume_begin_item( model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: begin_event.started_at_ms, + completed_at_ms: None, + duration_ms: None, } } @@ -2715,6 +2755,9 @@ fn collab_resume_end_item(end_event: codex_protocol::protocol::CollabResumeEndEv model: None, reasoning_effort: None, agents_states, + started_at_ms: end_event.started_at_ms, + completed_at_ms: end_event.completed_at_ms, + duration_ms: end_event.duration_ms, } } @@ -2733,6 +2776,8 @@ async fn construct_mcp_tool_call_notification( mcp_app_resource_uri: begin_event.mcp_app_resource_uri, result: None, error: None, + started_at_ms: begin_event.started_at_ms, + completed_at_ms: None, duration_ms: None, }; ItemStartedNotification { @@ -2781,6 +2826,8 @@ async fn construct_mcp_tool_call_end_notification( mcp_app_resource_uri: end_event.mcp_app_resource_uri, result, error, + started_at_ms: end_event.started_at_ms, + completed_at_ms: end_event.completed_at_ms, duration_ms, }; ItemCompletedNotification { @@ -3153,6 +3200,8 @@ mod tests { command_actions: completion_item.command_actions.clone(), aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, } ); @@ -3828,6 +3877,7 @@ mod tests { receiver_thread_id: ThreadId::new(), receiver_agent_nickname: None, receiver_agent_role: None, + started_at_ms: None, }; let item = collab_resume_begin_item(event.clone()); @@ -3841,6 +3891,9 @@ mod tests { model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }; assert_eq!(item, expected); } @@ -3854,6 +3907,9 @@ mod tests { receiver_agent_nickname: None, receiver_agent_role: None, status: codex_protocol::protocol::AgentStatus::NotFound, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }; let item = collab_resume_end_item(event.clone()); @@ -3873,6 +3929,9 @@ mod tests { )] .into_iter() .collect(), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }; assert_eq!(item, expected); } @@ -4255,6 +4314,7 @@ mod tests { arguments: Some(serde_json::json!({"server": ""})), }, mcp_app_resource_uri: Some("ui://widget/list-resources.html".to_string()), + started_at_ms: None, }; let thread_id = ThreadId::new().to_string(); @@ -4278,6 +4338,8 @@ mod tests { mcp_app_resource_uri: Some("ui://widget/list-resources.html".to_string()), result: None, error: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }, }; @@ -4420,6 +4482,7 @@ mod tests { arguments: None, }, mcp_app_resource_uri: None, + started_at_ms: None, }; let thread_id = ThreadId::new().to_string(); @@ -4443,6 +4506,8 @@ mod tests { mcp_app_resource_uri: None, result: None, error: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }, }; @@ -4475,6 +4540,8 @@ mod tests { mcp_app_resource_uri: Some("ui://widget/list-resources.html".to_string()), duration: Duration::from_nanos(92708), result: Ok(result), + started_at_ms: None, + completed_at_ms: None, }; let thread_id = ThreadId::new().to_string(); @@ -4504,6 +4571,8 @@ mod tests { })), })), error: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(0), }, }; @@ -4523,6 +4592,8 @@ mod tests { mcp_app_resource_uri: None, duration: Duration::from_millis(1), result: Err("boom".to_string()), + started_at_ms: None, + completed_at_ms: None, }; let thread_id = ThreadId::new().to_string(); @@ -4548,6 +4619,8 @@ mod tests { error: Some(McpToolCallError { message: "boom".to_string(), }), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(1), }, }; diff --git a/codex-rs/app-server/tests/suite/v2/dynamic_tools.rs b/codex-rs/app-server/tests/suite/v2/dynamic_tools.rs index 7ee21a2068..7b8344e822 100644 --- a/codex-rs/app-server/tests/suite/v2/dynamic_tools.rs +++ b/codex-rs/app-server/tests/suite/v2/dynamic_tools.rs @@ -333,6 +333,8 @@ async fn dynamic_tool_call_round_trip_sends_text_content_items_to_model() -> Res status, content_items, success, + started_at_ms, + completed_at_ms, duration_ms, } = started.item else { @@ -345,6 +347,8 @@ async fn dynamic_tool_call_round_trip_sends_text_content_items_to_model() -> Res assert_eq!(status, DynamicToolCallStatus::InProgress); assert_eq!(content_items, None); assert_eq!(success, None); + assert!(started_at_ms.is_some()); + assert_eq!(completed_at_ms, None); assert_eq!(duration_ms, None); // Read the tool call request from the app server. @@ -389,6 +393,8 @@ async fn dynamic_tool_call_round_trip_sends_text_content_items_to_model() -> Res status, content_items, success, + started_at_ms, + completed_at_ms, duration_ms, } = completed.item else { @@ -406,6 +412,8 @@ async fn dynamic_tool_call_round_trip_sends_text_content_items_to_model() -> Res }]) ); assert_eq!(success, Some(true)); + assert!(started_at_ms.is_some()); + assert!(completed_at_ms.is_some()); assert!(duration_ms.is_some()); timeout( diff --git a/codex-rs/app-server/tests/suite/v2/mcp_tool.rs b/codex-rs/app-server/tests/suite/v2/mcp_tool.rs index 03f3db95f1..954ca5477e 100644 --- a/codex-rs/app-server/tests/suite/v2/mcp_tool.rs +++ b/codex-rs/app-server/tests/suite/v2/mcp_tool.rs @@ -286,6 +286,8 @@ url = "{mcp_server_url}/mcp" mcp_app_resource_uri: None, result: Some(result), error: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, })?; assert!(serialized_item.len() < DEFAULT_OUTPUT_BYTES_CAP * 2 + 2048); diff --git a/codex-rs/app-server/tests/suite/v2/thread_resume.rs b/codex-rs/app-server/tests/suite/v2/thread_resume.rs index d9f5f039de..7d2b295d33 100644 --- a/codex-rs/app-server/tests/suite/v2/thread_resume.rs +++ b/codex-rs/app-server/tests/suite/v2/thread_resume.rs @@ -2193,16 +2193,30 @@ async fn thread_resume_replays_pending_file_change_request_approval() -> Result< }) .await??; let expected_readme_path = workspace.join("README.md"); - let expected_file_change = ThreadItem::FileChange { - id: "patch-call".to_string(), - changes: vec![codex_app_server_protocol::FileUpdateChange { + let ThreadItem::FileChange { + id, + changes, + status, + started_at_ms, + completed_at_ms, + duration_ms, + } = original_started + else { + unreachable!("loop ensures we break on file change items"); + }; + assert_eq!(id, "patch-call"); + assert_eq!( + changes, + vec![codex_app_server_protocol::FileUpdateChange { path: expected_readme_path.to_string_lossy().into_owned(), kind: PatchChangeKind::Add, diff: "new line\n".to_string(), - }], - status: PatchApplyStatus::InProgress, - }; - assert_eq!(original_started, expected_file_change); + }] + ); + assert_eq!(status, PatchApplyStatus::InProgress); + assert!(started_at_ms.is_some()); + assert_eq!(completed_at_ms, None); + assert_eq!(duration_ms, None); let original_request = timeout( DEFAULT_READ_TIMEOUT, diff --git a/codex-rs/app-server/tests/suite/v2/turn_start.rs b/codex-rs/app-server/tests/suite/v2/turn_start.rs index aa507f39e4..e393937ce5 100644 --- a/codex-rs/app-server/tests/suite/v2/turn_start.rs +++ b/codex-rs/app-server/tests/suite/v2/turn_start.rs @@ -2159,6 +2159,7 @@ async fn turn_start_file_change_approval_v2() -> Result<()> { ref id, status, ref changes, + .. } = started_file_change else { unreachable!("loop ensures we break on file change items"); @@ -2616,20 +2617,35 @@ async fn turn_start_emits_spawn_agent_item_with_model_metadata_v2() -> Result<() } }) .await??; - assert_eq!( - spawn_started, - ThreadItem::CollabAgentToolCall { - id: SPAWN_CALL_ID.to_string(), - tool: CollabAgentTool::SpawnAgent, - status: CollabAgentToolCallStatus::InProgress, - sender_thread_id: thread.id.clone(), - receiver_thread_ids: Vec::new(), - prompt: Some(CHILD_PROMPT.to_string()), - model: Some(REQUESTED_MODEL.to_string()), - reasoning_effort: Some(REQUESTED_REASONING_EFFORT), - agents_states: HashMap::new(), - } - ); + let ThreadItem::CollabAgentToolCall { + id, + tool, + status, + sender_thread_id, + receiver_thread_ids, + prompt, + model, + reasoning_effort, + agents_states, + started_at_ms, + completed_at_ms, + duration_ms, + } = spawn_started + else { + panic!("expected collab agent tool call item"); + }; + assert_eq!(id, SPAWN_CALL_ID); + assert_eq!(tool, CollabAgentTool::SpawnAgent); + assert_eq!(status, CollabAgentToolCallStatus::InProgress); + assert_eq!(sender_thread_id, thread.id); + assert_eq!(receiver_thread_ids, Vec::::new()); + assert_eq!(prompt.as_deref(), Some(CHILD_PROMPT)); + assert_eq!(model.as_deref(), Some(REQUESTED_MODEL)); + assert_eq!(reasoning_effort, Some(REQUESTED_REASONING_EFFORT)); + assert_eq!(agents_states, HashMap::new()); + assert!(started_at_ms.is_some()); + assert_eq!(completed_at_ms, None); + assert_eq!(duration_ms, None); let spawn_completed = timeout(DEFAULT_READ_TIMEOUT, async { loop { @@ -2656,6 +2672,9 @@ async fn turn_start_emits_spawn_agent_item_with_model_metadata_v2() -> Result<() model, reasoning_effort, agents_states, + started_at_ms, + completed_at_ms, + duration_ms, } = spawn_completed else { unreachable!("loop ensures we break on collab agent tool call items"); @@ -2667,6 +2686,9 @@ async fn turn_start_emits_spawn_agent_item_with_model_metadata_v2() -> Result<() assert_eq!(id, SPAWN_CALL_ID); assert_eq!(tool, CollabAgentTool::SpawnAgent); assert_eq!(status, CollabAgentToolCallStatus::Completed); + assert!(started_at_ms.is_some()); + assert!(completed_at_ms.is_some()); + assert!(duration_ms.is_some()); assert_eq!(sender_thread_id, thread.id); assert_eq!(receiver_thread_ids, vec![receiver_thread_id.clone()]); assert_eq!(prompt, Some(CHILD_PROMPT.to_string())); @@ -2840,6 +2862,9 @@ config_file = "./custom-role.toml" model, reasoning_effort, agents_states, + started_at_ms, + completed_at_ms, + duration_ms, } = spawn_completed else { unreachable!("loop ensures we break on collab agent tool call items"); @@ -2851,6 +2876,9 @@ config_file = "./custom-role.toml" assert_eq!(id, SPAWN_CALL_ID); assert_eq!(tool, CollabAgentTool::SpawnAgent); assert_eq!(status, CollabAgentToolCallStatus::Completed); + assert!(started_at_ms.is_some()); + assert!(completed_at_ms.is_some()); + assert!(duration_ms.is_some()); assert_eq!(sender_thread_id, thread.id); assert_eq!(receiver_thread_ids, vec![receiver_thread_id.clone()]); assert_eq!(prompt, Some(CHILD_PROMPT.to_string())); @@ -3158,6 +3186,7 @@ async fn turn_start_file_change_approval_decline_v2() -> Result<()> { ref id, status, ref changes, + .. } = started_file_change else { unreachable!("loop ensures we break on file change items"); diff --git a/codex-rs/core/src/event_mapping.rs b/codex-rs/core/src/event_mapping.rs index e7c79e6dd2..0af0aec0ea 100644 --- a/codex-rs/core/src/event_mapping.rs +++ b/codex-rs/core/src/event_mapping.rs @@ -188,6 +188,9 @@ pub fn parse_turn_item(item: &ResponseItem) -> Option { id: id.clone().unwrap_or_default(), query, action, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, })) } ResponseItem::ImageGenerationCall { @@ -202,6 +205,9 @@ pub fn parse_turn_item(item: &ResponseItem) -> Option { revised_prompt: revised_prompt.clone(), result: result.clone(), saved_path: None, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, )), _ => None, diff --git a/codex-rs/core/src/event_mapping_tests.rs b/codex-rs/core/src/event_mapping_tests.rs index 85e7034405..cac92ad60a 100644 --- a/codex-rs/core/src/event_mapping_tests.rs +++ b/codex-rs/core/src/event_mapping_tests.rs @@ -413,6 +413,9 @@ fn parses_web_search_call() { query: Some("weather".to_string()), queries: None, }, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ), other => panic!("expected TurnItem::WebSearch, got {other:?}"), @@ -440,6 +443,9 @@ fn parses_web_search_open_page_call() { action: WebSearchAction::OpenPage { url: Some("https://example.com".to_string()), }, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ), other => panic!("expected TurnItem::WebSearch, got {other:?}"), @@ -469,6 +475,9 @@ fn parses_web_search_find_in_page_call() { url: Some("https://example.com".to_string()), pattern: Some("needle".to_string()), }, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ), other => panic!("expected TurnItem::WebSearch, got {other:?}"), @@ -491,6 +500,9 @@ fn parses_partial_web_search_call_without_action_as_other() { id: "ws_partial".to_string(), query: String::new(), action: WebSearchAction::Other, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ), other => panic!("expected TurnItem::WebSearch, got {other:?}"), diff --git a/codex-rs/core/src/mcp_tool_call.rs b/codex-rs/core/src/mcp_tool_call.rs index d2e990f447..d45ec167a8 100644 --- a/codex-rs/core/src/mcp_tool_call.rs +++ b/codex-rs/core/src/mcp_tool_call.rs @@ -33,6 +33,7 @@ use crate::session::session::Session; use crate::session::turn_context::TurnContext; use crate::tools::hook_names::HookToolName; use crate::tools::sandboxing::PermissionRequestPayload; +use crate::turn_timing::now_unix_timestamp_ms; use codex_analytics::AppInvocation; use codex_analytics::InvocationType; use codex_analytics::build_track_events_context; @@ -149,6 +150,7 @@ pub(crate) async fn handle_mcp_tool_call( .await }; + let started_at_ms = now_unix_timestamp_ms(); if server == CODEX_APPS_MCP_SERVER_NAME && !app_tool_policy.enabled { let result = notify_mcp_tool_call_skip( sess.as_ref(), @@ -158,6 +160,7 @@ pub(crate) async fn handle_mcp_tool_call( mcp_app_resource_uri.clone(), "MCP tool call blocked by app configuration".to_string(), /*already_started*/ false, + started_at_ms, ) .await; let status = if result.is_ok() { "ok" } else { "error" }; @@ -189,6 +192,7 @@ pub(crate) async fn handle_mcp_tool_call( call_id: call_id.clone(), invocation: invocation.clone(), mcp_app_resource_uri: mcp_app_resource_uri.clone(), + started_at_ms: Some(started_at_ms), }); notify_mcp_tool_call_event(sess.as_ref(), turn_context.as_ref(), tool_call_begin_event).await; @@ -215,6 +219,7 @@ pub(crate) async fn handle_mcp_tool_call( metadata.as_ref(), request_meta, mcp_app_resource_uri, + started_at_ms, ) .await; } @@ -228,6 +233,7 @@ pub(crate) async fn handle_mcp_tool_call( mcp_app_resource_uri.clone(), message, /*already_started*/ true, + started_at_ms, ) .await } @@ -241,6 +247,7 @@ pub(crate) async fn handle_mcp_tool_call( mcp_app_resource_uri.clone(), message, /*already_started*/ true, + started_at_ms, ) .await } @@ -253,6 +260,7 @@ pub(crate) async fn handle_mcp_tool_call( mcp_app_resource_uri.clone(), message, /*already_started*/ true, + started_at_ms, ) .await } @@ -283,6 +291,7 @@ pub(crate) async fn handle_mcp_tool_call( metadata.as_ref(), request_meta, mcp_app_resource_uri, + started_at_ms, ) .await } @@ -292,6 +301,7 @@ pub(crate) struct HandledMcpToolCall { pub(crate) tool_input: JsonValue, } +#[allow(clippy::too_many_arguments)] async fn handle_approved_mcp_tool_call( sess: &Session, turn_context: &TurnContext, @@ -300,6 +310,7 @@ async fn handle_approved_mcp_tool_call( metadata: Option<&McpToolApprovalMetadata>, request_meta: Option, mcp_app_resource_uri: Option, + started_at_ms: i64, ) -> HandledMcpToolCall { maybe_mark_thread_memory_mode_polluted(sess, turn_context).await; @@ -361,10 +372,13 @@ async fn handle_approved_mcp_tool_call( tracing::warn!("MCP tool call error: {error:?}"); } let duration = start.elapsed(); + let completed_at_ms = now_unix_timestamp_ms(); let tool_call_end_event = EventMsg::McpToolCallEnd(McpToolCallEndEvent { call_id: call_id.to_string(), invocation, mcp_app_resource_uri, + started_at_ms: Some(started_at_ms), + completed_at_ms: Some(completed_at_ms), duration, result: truncate_mcp_tool_result_for_event(&result), }); @@ -1964,6 +1978,7 @@ fn requires_mcp_tool_approval(annotations: Option<&ToolAnnotations>) -> bool { .unwrap_or(true) } +#[allow(clippy::too_many_arguments)] async fn notify_mcp_tool_call_skip( sess: &Session, turn_context: &TurnContext, @@ -1972,12 +1987,14 @@ async fn notify_mcp_tool_call_skip( mcp_app_resource_uri: Option, message: String, already_started: bool, + started_at_ms: i64, ) -> Result { if !already_started { let tool_call_begin_event = EventMsg::McpToolCallBegin(McpToolCallBeginEvent { call_id: call_id.to_string(), invocation: invocation.clone(), mcp_app_resource_uri: mcp_app_resource_uri.clone(), + started_at_ms: Some(started_at_ms), }); notify_mcp_tool_call_event(sess, turn_context, tool_call_begin_event).await; } @@ -1988,6 +2005,8 @@ async fn notify_mcp_tool_call_skip( mcp_app_resource_uri, duration: Duration::ZERO, result: truncate_mcp_tool_result_for_event(&Err(message.clone())), + started_at_ms: Some(started_at_ms), + completed_at_ms: Some(now_unix_timestamp_ms()), }); notify_mcp_tool_call_event(sess, turn_context, tool_call_end_event).await; Err(message) diff --git a/codex-rs/core/src/session/mod.rs b/codex-rs/core/src/session/mod.rs index e45db20848..e88a3d5a19 100644 --- a/codex-rs/core/src/session/mod.rs +++ b/codex-rs/core/src/session/mod.rs @@ -298,6 +298,7 @@ use crate::tools::network_approval::build_network_policy_decider; use crate::tools::parallel::ToolCallRuntime; use crate::tools::sandboxing::ApprovalStore; use crate::turn_timing::TurnTimingState; +use crate::turn_timing::now_unix_timestamp_ms; use crate::turn_timing::record_turn_ttfm_metric; use crate::unified_exec::UnifiedExecProcessManager; use crate::windows_sandbox::WindowsSandboxLevelExt; @@ -1636,12 +1637,19 @@ impl Session { } pub(crate) async fn emit_turn_item_started(&self, turn_context: &TurnContext, item: &TurnItem) { + let started_at_ms = now_unix_timestamp_ms(); + self.turn_item_started_at_ms + .lock() + .await + .insert(item.id(), started_at_ms); + let mut item = item.clone(); + item.set_started_at_ms(started_at_ms); self.send_event( turn_context, EventMsg::ItemStarted(ItemStartedEvent { thread_id: self.conversation_id, turn_id: turn_context.sub_id.clone(), - item: item.clone(), + item, }), ) .await; @@ -1650,9 +1658,12 @@ impl Session { pub(crate) async fn emit_turn_item_completed( &self, turn_context: &TurnContext, - item: TurnItem, + mut item: TurnItem, ) { record_turn_ttfm_metric(turn_context, &item).await; + let started_at_ms = self.turn_item_started_at_ms.lock().await.remove(&item.id()); + let completed_at_ms = now_unix_timestamp_ms(); + item.set_completed_timing_ms(started_at_ms, completed_at_ms); self.send_event( turn_context, EventMsg::ItemCompleted(ItemCompletedEvent { diff --git a/codex-rs/core/src/session/session.rs b/codex-rs/core/src/session/session.rs index 6c6cc22a0e..e1f947ffb3 100644 --- a/codex-rs/core/src/session/session.rs +++ b/codex-rs/core/src/session/session.rs @@ -22,6 +22,8 @@ pub(crate) struct Session { pub(super) pending_mcp_server_refresh_config: Mutex>, pub(crate) conversation: Arc, pub(crate) active_turn: Mutex>, + /// Native start timestamps for turn items that have started but not completed yet. + pub(super) turn_item_started_at_ms: Mutex>, pub(super) mailbox: Mailbox, pub(super) mailbox_rx: Mutex, pub(super) idle_pending_input: Mutex>, // TODO (jif) merge with mailbox! @@ -858,6 +860,7 @@ impl Session { pending_mcp_server_refresh_config: Mutex::new(None), conversation: Arc::new(RealtimeConversationManager::new()), active_turn: Mutex::new(None), + turn_item_started_at_ms: Mutex::new(HashMap::new()), mailbox, mailbox_rx: Mutex::new(mailbox_rx), idle_pending_input: Mutex::new(Vec::new()), diff --git a/codex-rs/core/src/session/tests.rs b/codex-rs/core/src/session/tests.rs index 1afb28f35d..febdc84cd4 100644 --- a/codex-rs/core/src/session/tests.rs +++ b/codex-rs/core/src/session/tests.rs @@ -3604,6 +3604,7 @@ pub(crate) async fn make_session_and_context() -> (Session, TurnContext) { pending_mcp_server_refresh_config: Mutex::new(None), conversation: Arc::new(RealtimeConversationManager::new()), active_turn: Mutex::new(None), + turn_item_started_at_ms: Mutex::new(HashMap::new()), mailbox, mailbox_rx: Mutex::new(mailbox_rx), idle_pending_input: Mutex::new(Vec::new()), @@ -5033,6 +5034,7 @@ where pending_mcp_server_refresh_config: Mutex::new(None), conversation: Arc::new(RealtimeConversationManager::new()), active_turn: Mutex::new(None), + turn_item_started_at_ms: Mutex::new(HashMap::new()), mailbox, mailbox_rx: Mutex::new(mailbox_rx), idle_pending_input: Mutex::new(Vec::new()), diff --git a/codex-rs/core/src/tasks/user_shell.rs b/codex-rs/core/src/tasks/user_shell.rs index 23cd076404..78ec2facfe 100644 --- a/codex-rs/core/src/tasks/user_shell.rs +++ b/codex-rs/core/src/tasks/user_shell.rs @@ -21,6 +21,7 @@ use crate::session::turn_context::TurnContext; use crate::state::TaskKind; use crate::tools::format_exec_output_str; use crate::tools::runtimes::maybe_wrap_shell_lc_with_snapshot; +use crate::turn_timing::now_unix_timestamp_ms; use crate::user_shell_command::user_shell_command_record_item; use codex_protocol::exec_output::ExecToolCallOutput; use codex_protocol::exec_output::StreamOutput; @@ -157,6 +158,7 @@ pub(crate) async fn execute_user_shell_command( let cwd = turn_context.cwd.clone(); let parsed_cmd = parse_command(&display_command); + let started_at_ms = now_unix_timestamp_ms(); session .send_event( turn_context.as_ref(), @@ -169,6 +171,7 @@ pub(crate) async fn execute_user_shell_command( parsed_cmd: parsed_cmd.clone(), source: ExecCommandSource::UserShell, interaction_input: None, + started_at_ms: Some(started_at_ms), }), ) .await; @@ -212,6 +215,7 @@ pub(crate) async fn execute_user_shell_command( match exec_result { Err(CancelErr::Cancelled) => { + let completed_at_ms = now_unix_timestamp_ms(); let aborted_message = "command aborted by user".to_string(); let exec_output = ExecToolCallOutput { exit_code: -1, @@ -241,6 +245,8 @@ pub(crate) async fn execute_user_shell_command( parsed_cmd: parsed_cmd.clone(), source: ExecCommandSource::UserShell, interaction_input: None, + started_at_ms: Some(started_at_ms), + completed_at_ms: Some(completed_at_ms), stdout: String::new(), stderr: aborted_message.clone(), aggregated_output: aborted_message.clone(), @@ -253,6 +259,7 @@ pub(crate) async fn execute_user_shell_command( .await; } Ok(Ok(output)) => { + let completed_at_ms = now_unix_timestamp_ms(); session .send_event( turn_context.as_ref(), @@ -265,6 +272,8 @@ pub(crate) async fn execute_user_shell_command( parsed_cmd: parsed_cmd.clone(), source: ExecCommandSource::UserShell, interaction_input: None, + started_at_ms: Some(started_at_ms), + completed_at_ms: Some(completed_at_ms), stdout: output.stdout.text.clone(), stderr: output.stderr.text.clone(), aggregated_output: output.aggregated_output.text.clone(), @@ -297,6 +306,7 @@ pub(crate) async fn execute_user_shell_command( duration: Duration::ZERO, timed_out: false, }; + let completed_at_ms = now_unix_timestamp_ms(); session .send_event( turn_context.as_ref(), @@ -309,6 +319,8 @@ pub(crate) async fn execute_user_shell_command( parsed_cmd, source: ExecCommandSource::UserShell, interaction_input: None, + started_at_ms: Some(started_at_ms), + completed_at_ms: Some(completed_at_ms), stdout: exec_output.stdout.text.clone(), stderr: exec_output.stderr.text.clone(), aggregated_output: exec_output.aggregated_output.text.clone(), diff --git a/codex-rs/core/src/tools/events.rs b/codex-rs/core/src/tools/events.rs index 2b215a043d..11e851a69f 100644 --- a/codex-rs/core/src/tools/events.rs +++ b/codex-rs/core/src/tools/events.rs @@ -3,6 +3,7 @@ use crate::session::session::Session; use crate::session::turn_context::TurnContext; use crate::tools::context::SharedTurnDiffTracker; use crate::tools::sandboxing::ToolError; +use crate::turn_timing::now_unix_timestamp_ms; use codex_protocol::error::CodexErr; use codex_protocol::error::SandboxErr; use codex_protocol::exec_output::ExecToolCallOutput; @@ -82,6 +83,7 @@ pub(crate) async fn emit_exec_command_begin( parsed_cmd: parsed_cmd.to_vec(), source, interaction_input, + started_at_ms: Some(now_unix_timestamp_ms()), }), ) .await; @@ -190,6 +192,7 @@ impl ToolEmitter { turn_id: ctx.turn.sub_id.clone(), auto_approved: *auto_approved, changes: changes.clone(), + started_at_ms: Some(now_unix_timestamp_ms()), }), ) .await; @@ -206,6 +209,7 @@ impl ToolEmitter { } else { PatchApplyStatus::Failed }, + output.duration, ) .await; } @@ -224,6 +228,7 @@ impl ToolEmitter { } else { PatchApplyStatus::Failed }, + output.duration, ) .await; } @@ -238,6 +243,7 @@ impl ToolEmitter { (*message).to_string(), /*success*/ false, PatchApplyStatus::Failed, + Duration::ZERO, ) .await; } @@ -252,6 +258,7 @@ impl ToolEmitter { (*message).to_string(), /*success*/ false, PatchApplyStatus::Declined, + Duration::ZERO, ) .await; } @@ -467,6 +474,9 @@ async fn emit_exec_end( exec_input: ExecCommandInput<'_>, exec_result: ExecCommandResult, ) { + let completed_at_ms = now_unix_timestamp_ms(); + let duration_ms = i64::try_from(exec_result.duration.as_millis()).unwrap_or(i64::MAX); + let started_at_ms = completed_at_ms.checked_sub(duration_ms); ctx.session .send_event( ctx.turn, @@ -479,6 +489,8 @@ async fn emit_exec_end( parsed_cmd: exec_input.parsed_cmd.to_vec(), source: exec_input.source, interaction_input: exec_input.interaction_input.map(str::to_owned), + started_at_ms, + completed_at_ms: Some(completed_at_ms), stdout: exec_result.stdout, stderr: exec_result.stderr, aggregated_output: exec_result.aggregated_output, @@ -498,7 +510,12 @@ async fn emit_patch_end( stderr: String, success: bool, status: PatchApplyStatus, + duration: Duration, ) { + let completed_at_ms = now_unix_timestamp_ms(); + let duration_ms = i64::try_from(duration.as_millis()).ok(); + let started_at_ms = + duration_ms.and_then(|duration_ms| completed_at_ms.checked_sub(duration_ms)); ctx.session .send_event( ctx.turn, @@ -510,6 +527,9 @@ async fn emit_patch_end( success, changes, status, + started_at_ms, + completed_at_ms: Some(completed_at_ms), + duration_ms, }), ) .await; diff --git a/codex-rs/core/src/tools/handlers/dynamic.rs b/codex-rs/core/src/tools/handlers/dynamic.rs index b7e07090dc..f6e665a71f 100644 --- a/codex-rs/core/src/tools/handlers/dynamic.rs +++ b/codex-rs/core/src/tools/handlers/dynamic.rs @@ -7,6 +7,7 @@ use crate::tools::context::ToolPayload; use crate::tools::handlers::parse_arguments; use crate::tools::registry::ToolHandler; use crate::tools::registry::ToolKind; +use crate::turn_timing::now_unix_timestamp_ms; use codex_protocol::dynamic_tools::DynamicToolCallRequest; use codex_protocol::dynamic_tools::DynamicToolResponse; use codex_protocol::models::FunctionCallOutputContentItem; @@ -102,16 +103,19 @@ async fn request_dynamic_tool( } let started_at = Instant::now(); + let started_at_ms = now_unix_timestamp_ms(); let event = EventMsg::DynamicToolCallRequest(DynamicToolCallRequest { call_id: call_id.clone(), turn_id: turn_id.clone(), namespace: namespace.clone(), tool: tool.clone(), arguments: arguments.clone(), + started_at_ms: Some(started_at_ms), }); session.send_event(turn_context, event).await; let response = rx_response.await.ok(); + let completed_at_ms = now_unix_timestamp_ms(); let response_event = match &response { Some(response) => EventMsg::DynamicToolCallResponse(DynamicToolCallResponseEvent { call_id, @@ -122,6 +126,8 @@ async fn request_dynamic_tool( content_items: response.content_items.clone(), success: response.success, error: None, + started_at_ms: Some(started_at_ms), + completed_at_ms: Some(completed_at_ms), duration: started_at.elapsed(), }), None => EventMsg::DynamicToolCallResponse(DynamicToolCallResponseEvent { @@ -133,6 +139,8 @@ async fn request_dynamic_tool( content_items: Vec::new(), success: false, error: Some("dynamic tool call was cancelled before receiving a response".to_string()), + started_at_ms: Some(started_at_ms), + completed_at_ms: Some(completed_at_ms), duration: started_at.elapsed(), }), }; diff --git a/codex-rs/core/src/tools/handlers/mcp_resource.rs b/codex-rs/core/src/tools/handlers/mcp_resource.rs index fa4a066741..06db72af38 100644 --- a/codex-rs/core/src/tools/handlers/mcp_resource.rs +++ b/codex-rs/core/src/tools/handlers/mcp_resource.rs @@ -25,6 +25,7 @@ use crate::tools::context::ToolInvocation; use crate::tools::context::ToolPayload; use crate::tools::registry::ToolHandler; use crate::tools::registry::ToolKind; +use crate::turn_timing::now_unix_timestamp_ms; use codex_protocol::protocol::EventMsg; use codex_protocol::protocol::McpInvocation; use codex_protocol::protocol::McpToolCallBeginEvent; @@ -261,8 +262,16 @@ async fn handle_list_resources( arguments: arguments.clone(), }; - emit_tool_call_begin(&session, turn.as_ref(), &call_id, invocation.clone()).await; let start = Instant::now(); + let started_at_ms = now_unix_timestamp_ms(); + emit_tool_call_begin( + &session, + turn.as_ref(), + &call_id, + invocation.clone(), + started_at_ms, + ) + .await; let payload_result: Result = async { if let Some(server_name) = server.clone() { @@ -310,6 +319,7 @@ async fn handle_list_resources( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Ok(call_tool_result_from_content(&content, output.success)), ) @@ -324,6 +334,7 @@ async fn handle_list_resources( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Err(message.clone()), ) @@ -339,6 +350,7 @@ async fn handle_list_resources( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Err(message.clone()), ) @@ -369,8 +381,16 @@ async fn handle_list_resource_templates( arguments: arguments.clone(), }; - emit_tool_call_begin(&session, turn.as_ref(), &call_id, invocation.clone()).await; let start = Instant::now(); + let started_at_ms = now_unix_timestamp_ms(); + emit_tool_call_begin( + &session, + turn.as_ref(), + &call_id, + invocation.clone(), + started_at_ms, + ) + .await; let payload_result: Result = async { if let Some(server_name) = server.clone() { @@ -420,6 +440,7 @@ async fn handle_list_resource_templates( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Ok(call_tool_result_from_content(&content, output.success)), ) @@ -434,6 +455,7 @@ async fn handle_list_resource_templates( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Err(message.clone()), ) @@ -449,6 +471,7 @@ async fn handle_list_resource_templates( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Err(message.clone()), ) @@ -475,8 +498,16 @@ async fn handle_read_resource( arguments: arguments.clone(), }; - emit_tool_call_begin(&session, turn.as_ref(), &call_id, invocation.clone()).await; let start = Instant::now(); + let started_at_ms = now_unix_timestamp_ms(); + emit_tool_call_begin( + &session, + turn.as_ref(), + &call_id, + invocation.clone(), + started_at_ms, + ) + .await; let payload_result: Result = async { let result = session @@ -511,6 +542,7 @@ async fn handle_read_resource( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Ok(call_tool_result_from_content(&content, output.success)), ) @@ -525,6 +557,7 @@ async fn handle_read_resource( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Err(message.clone()), ) @@ -540,6 +573,7 @@ async fn handle_read_resource( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Err(message.clone()), ) @@ -563,6 +597,7 @@ async fn emit_tool_call_begin( turn: &TurnContext, call_id: &str, invocation: McpInvocation, + started_at_ms: i64, ) { session .send_event( @@ -571,6 +606,7 @@ async fn emit_tool_call_begin( call_id: call_id.to_string(), invocation, mcp_app_resource_uri: None, + started_at_ms: Some(started_at_ms), }), ) .await; @@ -581,9 +617,11 @@ async fn emit_tool_call_end( turn: &TurnContext, call_id: &str, invocation: McpInvocation, + started_at_ms: i64, duration: Duration, result: Result, ) { + let completed_at_ms = now_unix_timestamp_ms(); session .send_event( turn, @@ -591,6 +629,8 @@ async fn emit_tool_call_end( call_id: call_id.to_string(), invocation, mcp_app_resource_uri: None, + started_at_ms: Some(started_at_ms), + completed_at_ms: Some(completed_at_ms), duration, result, }), diff --git a/codex-rs/core/src/tools/handlers/multi_agents/close_agent.rs b/codex-rs/core/src/tools/handlers/multi_agents/close_agent.rs index 8c00b0a13c..78c35f1695 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/close_agent.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/close_agent.rs @@ -29,6 +29,7 @@ impl ToolHandler for Handler { .agent_control .get_agent_metadata(agent_id) .unwrap_or_default(); + let timing = CollabToolTiming::start(); session .send_event( &turn, @@ -36,6 +37,7 @@ impl ToolHandler for Handler { call_id: call_id.clone(), sender_thread_id: session.conversation_id, receiver_thread_id: agent_id, + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -49,6 +51,7 @@ impl ToolHandler for Handler { Ok(mut status_rx) => status_rx.borrow_and_update().clone(), Err(err) => { let status = session.services.agent_control.get_status(agent_id).await; + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -59,6 +62,9 @@ impl ToolHandler for Handler { receiver_agent_nickname: receiver_agent.agent_nickname.clone(), receiver_agent_role: receiver_agent.agent_role.clone(), status, + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) @@ -70,6 +76,7 @@ impl ToolHandler for Handler { .await .map_err(|err| collab_agent_error(agent_id, err)) .map(|_| ()); + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -80,6 +87,9 @@ impl ToolHandler for Handler { receiver_agent_nickname: receiver_agent.agent_nickname, receiver_agent_role: receiver_agent.agent_role, status: status.clone(), + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs b/codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs index 2d4f2c3f47..ca0ea7b129 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs @@ -41,6 +41,7 @@ impl ToolHandler for Handler { )); } + let timing = CollabToolTiming::start(); session .send_event( &turn, @@ -50,6 +51,7 @@ impl ToolHandler for Handler { receiver_thread_id, receiver_agent_nickname: receiver_agent.agent_nickname.clone(), receiver_agent_role: receiver_agent.agent_role.clone(), + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -96,6 +98,7 @@ impl ToolHandler for Handler { } else { (receiver_agent, None) }; + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -106,6 +109,9 @@ impl ToolHandler for Handler { receiver_agent_nickname: receiver_agent.agent_nickname, receiver_agent_role: receiver_agent.agent_role, status: status.clone(), + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs b/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs index 4ae3240cb3..49d5e9c7d4 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs @@ -40,6 +40,7 @@ impl ToolHandler for Handler { .await .map_err(|err| collab_agent_error(receiver_thread_id, err))?; } + let timing = CollabToolTiming::start(); session .send_event( &turn, @@ -48,6 +49,7 @@ impl ToolHandler for Handler { sender_thread_id: session.conversation_id, receiver_thread_id, prompt: prompt.clone(), + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -62,6 +64,7 @@ impl ToolHandler for Handler { .agent_control .get_status(receiver_thread_id) .await; + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -73,6 +76,9 @@ impl ToolHandler for Handler { receiver_agent_role: receiver_agent.agent_role, prompt, status, + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/tools/handlers/multi_agents/spawn.rs b/codex-rs/core/src/tools/handlers/multi_agents/spawn.rs index 777cb9be1c..e51d04e3fd 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/spawn.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/spawn.rs @@ -46,6 +46,7 @@ impl ToolHandler for Handler { "Agent depth limit reached. Solve the task yourself.".to_string(), )); } + let timing = CollabToolTiming::start(); session .send_event( &turn, @@ -55,6 +56,7 @@ impl ToolHandler for Handler { prompt: prompt.clone(), model: args.model.clone().unwrap_or_default(), reasoning_effort: args.reasoning_effort.unwrap_or_default(), + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -149,6 +151,7 @@ impl ToolHandler for Handler { .and_then(|snapshot| snapshot.reasoning_effort) .unwrap_or(args.reasoning_effort.unwrap_or_default()); let nickname = new_agent_nickname.clone(); + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -162,6 +165,9 @@ impl ToolHandler for Handler { model: effective_model, reasoning_effort: effective_reasoning_effort, status, + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/tools/handlers/multi_agents/wait.rs b/codex-rs/core/src/tools/handlers/multi_agents/wait.rs index 77fa5f83a2..83c9521f7e 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/wait.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/wait.rs @@ -69,6 +69,7 @@ impl ToolHandler for Handler { ms => ms.clamp(MIN_WAIT_TIMEOUT_MS, MAX_WAIT_TIMEOUT_MS), }; + let timing = CollabToolTiming::start(); session .send_event( &turn, @@ -77,6 +78,7 @@ impl ToolHandler for Handler { receiver_thread_ids: receiver_thread_ids.clone(), receiver_agents: receiver_agents.clone(), call_id: call_id.clone(), + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -99,6 +101,7 @@ impl ToolHandler for Handler { Err(err) => { let mut statuses = HashMap::with_capacity(1); statuses.insert(*id, session.services.agent_control.get_status(*id).await); + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -110,6 +113,9 @@ impl ToolHandler for Handler { &receiver_agents, ), statuses, + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) @@ -167,6 +173,7 @@ impl ToolHandler for Handler { timed_out, }; + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -175,6 +182,9 @@ impl ToolHandler for Handler { call_id, agent_statuses, statuses: statuses_by_id, + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/tools/handlers/multi_agents_common.rs b/codex-rs/core/src/tools/handlers/multi_agents_common.rs index c01755cb2b..e8bb574236 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_common.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_common.rs @@ -8,6 +8,7 @@ use crate::session::turn_context::TurnContext; use crate::tools::context::FunctionToolOutput; use crate::tools::context::ToolOutput; use crate::tools::context::ToolPayload; +use crate::turn_timing::now_unix_timestamp_ms; use codex_features::Feature; use codex_models_manager::manager::RefreshStrategy; use codex_protocol::AgentPath; @@ -32,6 +33,32 @@ pub(crate) const MIN_WAIT_TIMEOUT_MS: i64 = DEFAULT_MULTI_AGENT_V2_MIN_WAIT_TIME pub(crate) const DEFAULT_WAIT_TIMEOUT_MS: i64 = 30_000; pub(crate) const MAX_WAIT_TIMEOUT_MS: i64 = MAX_MULTI_AGENT_V2_WAIT_TIMEOUT_MS; +#[derive(Clone, Copy)] +pub(crate) struct CollabToolTiming { + started_at_ms: i64, +} + +impl CollabToolTiming { + pub(crate) fn start() -> Self { + Self { + started_at_ms: now_unix_timestamp_ms(), + } + } + + pub(crate) fn started_at_ms(self) -> Option { + Some(self.started_at_ms) + } + + pub(crate) fn finish(self) -> (Option, Option, Option) { + let completed_at_ms = now_unix_timestamp_ms(); + ( + Some(self.started_at_ms), + Some(completed_at_ms), + completed_at_ms.checked_sub(self.started_at_ms), + ) + } +} + pub(crate) fn function_arguments(payload: ToolPayload) -> Result { match payload { ToolPayload::Function { arguments } => Ok(arguments), diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/close_agent.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/close_agent.rs index 8074f7fe04..7609e3d3ba 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_v2/close_agent.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/close_agent.rs @@ -38,6 +38,7 @@ impl ToolHandler for Handler { "root is not a spawned agent".to_string(), )); } + let timing = CollabToolTiming::start(); session .send_event( &turn, @@ -45,6 +46,7 @@ impl ToolHandler for Handler { call_id: call_id.clone(), sender_thread_id: session.conversation_id, receiver_thread_id: agent_id, + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -58,6 +60,7 @@ impl ToolHandler for Handler { Ok(mut status_rx) => status_rx.borrow_and_update().clone(), Err(err) => { let status = session.services.agent_control.get_status(agent_id).await; + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -68,6 +71,9 @@ impl ToolHandler for Handler { receiver_agent_nickname: receiver_agent.agent_nickname.clone(), receiver_agent_role: receiver_agent.agent_role.clone(), status, + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) @@ -82,6 +88,7 @@ impl ToolHandler for Handler { .await .map_err(|err| collab_agent_error(agent_id, err)) .map(|_| ()); + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -92,6 +99,9 @@ impl ToolHandler for Handler { receiver_agent_nickname: receiver_agent.agent_nickname, receiver_agent_role: receiver_agent.agent_role, status: status.clone(), + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/message_tool.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/message_tool.rs index a42cde8f62..34ed8455df 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_v2/message_tool.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/message_tool.rs @@ -92,6 +92,7 @@ async fn handle_message_submission( "Tasks can't be assigned to the root agent".to_string(), )); } + let timing = CollabToolTiming::start(); session .send_event( &turn, @@ -100,6 +101,7 @@ async fn handle_message_submission( sender_thread_id: session.conversation_id, receiver_thread_id, prompt: prompt.clone(), + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -127,6 +129,7 @@ async fn handle_message_submission( .agent_control .get_status(receiver_thread_id) .await; + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -138,6 +141,9 @@ async fn handle_message_submission( receiver_agent_role: receiver_agent.agent_role, prompt, status, + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs index 26b6750c46..12e1261bdb 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs @@ -45,6 +45,7 @@ impl ToolHandler for Handler { let session_source = turn.session_source.clone(); let child_depth = next_thread_spawn_depth(&session_source); + let timing = CollabToolTiming::start(); session .send_event( &turn, @@ -54,6 +55,7 @@ impl ToolHandler for Handler { prompt: prompt.clone(), model: args.model.clone().unwrap_or_default(), reasoning_effort: args.reasoning_effort.unwrap_or_default(), + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -169,6 +171,7 @@ impl ToolHandler for Handler { .and_then(|snapshot| snapshot.reasoning_effort) .unwrap_or(args.reasoning_effort.unwrap_or_default()); let nickname = new_agent_nickname.clone(); + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -182,6 +185,9 @@ impl ToolHandler for Handler { model: effective_model, reasoning_effort: effective_reasoning_effort, status, + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs index 778c57be21..39d4898782 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs @@ -44,6 +44,7 @@ impl ToolHandler for Handler { let mut mailbox_seq_rx = session.subscribe_mailbox_seq(); + let timing = CollabToolTiming::start(); session .send_event( &turn, @@ -52,6 +53,7 @@ impl ToolHandler for Handler { receiver_thread_ids: Vec::new(), receiver_agents: Vec::new(), call_id: call_id.clone(), + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -65,6 +67,7 @@ impl ToolHandler for Handler { }; let result = WaitAgentResult::from_timed_out(timed_out); + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -73,6 +76,9 @@ impl ToolHandler for Handler { call_id, agent_statuses: Vec::new(), statuses: HashMap::new(), + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/turn_timing.rs b/codex-rs/core/src/turn_timing.rs index d6bf37253f..1d0232cde7 100644 --- a/codex-rs/core/src/turn_timing.rs +++ b/codex-rs/core/src/turn_timing.rs @@ -107,7 +107,7 @@ fn now_unix_timestamp_secs() -> i64 { now_unix_timestamp_ms() / 1000 } -fn now_unix_timestamp_ms() -> i64 { +pub(crate) fn now_unix_timestamp_ms() -> i64 { let duration = SystemTime::now() .duration_since(UNIX_EPOCH) .unwrap_or_default(); diff --git a/codex-rs/core/tests/suite/items.rs b/codex-rs/core/tests/suite/items.rs index 053f03ca90..bf984bc264 100644 --- a/codex-rs/core/tests/suite/items.rs +++ b/codex-rs/core/tests/suite/items.rs @@ -303,6 +303,14 @@ async fn web_search_item_is_emitted() -> anyhow::Result<()> { }) .await?; + let started = wait_for_event_match(&codex, |ev| match ev { + EventMsg::ItemStarted(ItemStartedEvent { + item: TurnItem::WebSearch(item), + .. + }) => Some(item.clone()), + _ => None, + }) + .await; let begin = wait_for_event_match(&codex, |ev| match ev { EventMsg::WebSearchBegin(event) => Some(event.clone()), _ => None, @@ -317,8 +325,21 @@ async fn web_search_item_is_emitted() -> anyhow::Result<()> { }) .await; + assert_eq!(started.id, "web-search-1"); + assert!(started.started_at_ms.is_some()); + assert_eq!(started.completed_at_ms, None); + assert_eq!(started.duration_ms, None); assert_eq!(begin.call_id, "web-search-1"); assert_eq!(completed.id, begin.call_id); + assert_eq!(completed.started_at_ms, started.started_at_ms); + assert!(completed.completed_at_ms.is_some()); + assert_eq!( + completed.duration_ms, + completed + .started_at_ms + .zip(completed.completed_at_ms) + .and_then(|(started_at_ms, completed_at_ms)| completed_at_ms.checked_sub(started_at_ms)) + ); assert_eq!( completed.action, WebSearchAction::Search { diff --git a/codex-rs/core/tests/suite/rmcp_client.rs b/codex-rs/core/tests/suite/rmcp_client.rs index 0947f4fba7..98404e515e 100644 --- a/codex-rs/core/tests/suite/rmcp_client.rs +++ b/codex-rs/core/tests/suite/rmcp_client.rs @@ -1101,6 +1101,8 @@ async fn stdio_image_responses_round_trip() -> anyhow::Result<()> { let EventMsg::McpToolCallBegin(begin) = begin_event else { unreachable!("begin"); }; + let started_at_ms = begin.started_at_ms; + assert!(started_at_ms.is_some()); assert_eq!( begin, McpToolCallBeginEvent { @@ -1111,6 +1113,7 @@ async fn stdio_image_responses_round_trip() -> anyhow::Result<()> { arguments: Some(json!({})), }, mcp_app_resource_uri: None, + started_at_ms, }, ); diff --git a/codex-rs/core/tests/suite/user_shell_cmd.rs b/codex-rs/core/tests/suite/user_shell_cmd.rs index 1285b9f925..8fee903779 100644 --- a/codex-rs/core/tests/suite/user_shell_cmd.rs +++ b/codex-rs/core/tests/suite/user_shell_cmd.rs @@ -117,7 +117,7 @@ async fn user_shell_cmd_can_be_interrupted() { .unwrap(); // Wait until it has started (ExecCommandBegin), then interrupt. - let _begin = wait_for_event_match(codex, |ev| match ev { + let begin = wait_for_event_match(codex, |ev| match ev { EventMsg::ExecCommandBegin(event) if event.source == ExecCommandSource::UserShell => { Some(event.clone()) } @@ -126,6 +126,16 @@ async fn user_shell_cmd_can_be_interrupted() { .await; codex.submit(Op::Interrupt).await.unwrap(); + let end = wait_for_event_match(codex, |ev| match ev { + EventMsg::ExecCommandEnd(event) if event.source == ExecCommandSource::UserShell => { + Some(event.clone()) + } + _ => None, + }) + .await; + assert_eq!(end.started_at_ms, begin.started_at_ms); + assert!(end.completed_at_ms.is_some()); + // Expect a TurnAborted(Interrupted) notification. let msg = wait_for_event_with_timeout( codex, diff --git a/codex-rs/exec/src/event_processor_with_jsonl_output.rs b/codex-rs/exec/src/event_processor_with_jsonl_output.rs index 1641398ae6..7198e9a07a 100644 --- a/codex-rs/exec/src/event_processor_with_jsonl_output.rs +++ b/codex-rs/exec/src/event_processor_with_jsonl_output.rs @@ -296,6 +296,7 @@ impl EventProcessorWithJsonOutput { id: raw_id, query, action, + .. } => Some(ExecThreadItem { id: make_id(), details: ThreadItemDetails::WebSearch(WebSearchItem { diff --git a/codex-rs/exec/tests/event_processor_with_json_output.rs b/codex-rs/exec/tests/event_processor_with_json_output.rs index f6f6d35f21..d5569c030c 100644 --- a/codex-rs/exec/tests/event_processor_with_json_output.rs +++ b/codex-rs/exec/tests/event_processor_with_json_output.rs @@ -173,6 +173,8 @@ fn command_execution_started_and_completed_translate_to_thread_events() { command_actions: Vec::::new(), aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }; @@ -212,6 +214,8 @@ fn command_execution_started_and_completed_translate_to_thread_events() { command_actions: Vec::::new(), aggregated_output: Some("a.txt\n".to_string()), exit_code: Some(0), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(3), }, thread_id: "thread-1".to_string(), @@ -359,6 +363,9 @@ fn web_search_completion_preserves_query_and_action() { query: Some("rust async await".to_string()), queries: None, }), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, thread_id: "thread-1".to_string(), turn_id: "turn-1".to_string(), @@ -396,6 +403,9 @@ fn web_search_start_and_completion_reuse_item_id() { id: "search-1".to_string(), query: String::new(), action: None, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, thread_id: "thread-1".to_string(), turn_id: "turn-1".to_string(), @@ -410,6 +420,9 @@ fn web_search_start_and_completion_reuse_item_id() { query: Some("rust async await".to_string()), queries: None, }), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, thread_id: "thread-1".to_string(), turn_id: "turn-1".to_string(), @@ -468,6 +481,8 @@ fn mcp_tool_call_begin_and_end_emit_item_events() { mcp_app_resource_uri: None, result: None, error: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }, thread_id: "thread-1".to_string(), @@ -488,6 +503,8 @@ fn mcp_tool_call_begin_and_end_emit_item_events() { meta: None, })), error: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(1_000), }, thread_id: "thread-1".to_string(), @@ -555,6 +572,8 @@ fn mcp_tool_call_failure_sets_failed_status() { error: Some(McpToolCallError { message: "tool exploded".to_string(), }), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(5), }, thread_id: "thread-1".to_string(), @@ -600,6 +619,8 @@ fn mcp_tool_call_defaults_arguments_and_preserves_structured_content() { mcp_app_resource_uri: None, result: None, error: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }, thread_id: "thread-1".to_string(), @@ -623,6 +644,8 @@ fn mcp_tool_call_defaults_arguments_and_preserves_structured_content() { meta: None, })), error: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(10), }, thread_id: "thread-1".to_string(), @@ -692,6 +715,9 @@ fn collab_spawn_begin_and_end_emit_item_events() { model: Some("gpt-5".to_string()), reasoning_effort: None, agents_states: std::collections::HashMap::new(), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, thread_id: "thread-parent".to_string(), turn_id: "turn-1".to_string(), @@ -714,6 +740,9 @@ fn collab_spawn_begin_and_end_emit_item_events() { message: None, }, )]), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, thread_id: "thread-parent".to_string(), turn_id: "turn-1".to_string(), @@ -792,6 +821,9 @@ fn file_change_completion_maps_change_kinds() { }, ], status: ApiPatchApplyStatus::Completed, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, thread_id: "thread-1".to_string(), turn_id: "turn-1".to_string(), @@ -842,6 +874,9 @@ fn file_change_declined_maps_to_failed_status() { diff: "@@ -1 +1 @@".to_string(), }], status: ApiPatchApplyStatus::Declined, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, thread_id: "thread-1".to_string(), turn_id: "turn-1".to_string(), @@ -1292,6 +1327,8 @@ fn turn_completion_reconciles_started_items_from_turn_items() { command_actions: Vec::::new(), aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }, thread_id: "thread-1".to_string(), @@ -1330,6 +1367,8 @@ fn turn_completion_reconciles_started_items_from_turn_items() { command_actions: Vec::::new(), aggregated_output: Some("a.txt\n".to_string()), exit_code: Some(0), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(3), }], status: TurnStatus::Completed, diff --git a/codex-rs/protocol/src/dynamic_tools.rs b/codex-rs/protocol/src/dynamic_tools.rs index 2bee24972b..e756c14ce0 100644 --- a/codex-rs/protocol/src/dynamic_tools.rs +++ b/codex-rs/protocol/src/dynamic_tools.rs @@ -26,6 +26,9 @@ pub struct DynamicToolCallRequest { pub namespace: Option, pub tool: String, pub arguments: JsonValue, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, JsonSchema, TS)] diff --git a/codex-rs/protocol/src/items.rs b/codex-rs/protocol/src/items.rs index 6879588579..df3ad3ebed 100644 --- a/codex-rs/protocol/src/items.rs +++ b/codex-rs/protocol/src/items.rs @@ -112,6 +112,15 @@ pub struct WebSearchItem { pub id: String, pub query: String, pub action: WebSearchAction, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema, PartialEq)] @@ -125,6 +134,15 @@ pub struct ImageGenerationItem { #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub saved_path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema)] @@ -365,6 +383,9 @@ impl WebSearchItem { call_id: self.id.clone(), query: self.query.clone(), action: self.action.clone(), + started_at_ms: self.started_at_ms, + completed_at_ms: self.completed_at_ms, + duration_ms: self.duration_ms, }) } } @@ -377,11 +398,40 @@ impl ImageGenerationItem { revised_prompt: self.revised_prompt.clone(), result: self.result.clone(), saved_path: self.saved_path.clone(), + started_at_ms: self.started_at_ms, + completed_at_ms: self.completed_at_ms, + duration_ms: self.duration_ms, }) } } impl TurnItem { + pub fn set_started_at_ms(&mut self, started_at_ms: i64) { + match self { + TurnItem::WebSearch(item) => item.started_at_ms = Some(started_at_ms), + TurnItem::ImageGeneration(item) => item.started_at_ms = Some(started_at_ms), + _ => {} + } + } + + pub fn set_completed_timing_ms(&mut self, started_at_ms: Option, completed_at_ms: i64) { + match self { + TurnItem::WebSearch(item) => { + item.started_at_ms = started_at_ms; + item.completed_at_ms = Some(completed_at_ms); + item.duration_ms = started_at_ms + .and_then(|started_at_ms| completed_at_ms.checked_sub(started_at_ms)); + } + TurnItem::ImageGeneration(item) => { + item.started_at_ms = started_at_ms; + item.completed_at_ms = Some(completed_at_ms); + item.duration_ms = started_at_ms + .and_then(|started_at_ms| completed_at_ms.checked_sub(started_at_ms)); + } + _ => {} + } + } + pub fn id(&self) -> String { match self { TurnItem::UserMessage(item) => item.id.clone(), diff --git a/codex-rs/protocol/src/protocol.rs b/codex-rs/protocol/src/protocol.rs index 1eae3213fe..a08ce60abf 100644 --- a/codex-rs/protocol/src/protocol.rs +++ b/codex-rs/protocol/src/protocol.rs @@ -1854,10 +1854,12 @@ impl HasLegacyEvent for ItemStartedEvent { match &self.item { TurnItem::WebSearch(item) => vec![EventMsg::WebSearchBegin(WebSearchBeginEvent { call_id: item.id.clone(), + started_at_ms: item.started_at_ms, })], TurnItem::ImageGeneration(item) => { vec![EventMsg::ImageGenerationBegin(ImageGenerationBeginEvent { call_id: item.id.clone(), + started_at_ms: item.started_at_ms, })] } _ => Vec::new(), @@ -2359,6 +2361,9 @@ pub struct McpToolCallBeginEvent { #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub mcp_app_resource_uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS, PartialEq)] @@ -2369,6 +2374,12 @@ pub struct McpToolCallEndEvent { #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub mcp_app_resource_uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, #[ts(type = "string")] pub duration: Duration, /// Result of the tool call. Note this could be an error. @@ -2394,6 +2405,14 @@ pub struct DynamicToolCallResponseEvent { pub success: bool, /// Optional error text when the tool call failed before producing a response. pub error: Option, + /// Unix timestamp (in milliseconds) when dynamic tool call started, if known. + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + /// Unix timestamp (in milliseconds) when dynamic tool call completed, if known. + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, /// The duration of the dynamic tool call. #[ts(type = "string")] pub duration: Duration, @@ -2411,6 +2430,9 @@ impl McpToolCallEndEvent { #[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)] pub struct WebSearchBeginEvent { pub call_id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)] @@ -2418,11 +2440,23 @@ pub struct WebSearchEndEvent { pub call_id: String, pub query: String, pub action: WebSearchAction, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)] pub struct ImageGenerationBeginEvent { pub call_id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)] @@ -2436,6 +2470,15 @@ pub struct ImageGenerationEndEvent { #[serde(skip_serializing_if = "Option::is_none")] #[ts(optional)] pub saved_path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } // Conversation kept for backward compatibility. @@ -3103,6 +3146,9 @@ pub struct ExecCommandBeginEvent { #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub interaction_input: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)] @@ -3127,6 +3173,12 @@ pub struct ExecCommandEndEvent { #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub interaction_input: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, /// Captured stdout pub stdout: String, @@ -3248,6 +3300,9 @@ pub struct PatchApplyBeginEvent { pub auto_approved: bool, /// The changes to be applied. pub changes: HashMap, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)] @@ -3277,6 +3332,15 @@ pub struct PatchApplyEndEvent { pub changes: HashMap, /// Completion status for this patch application. pub status: PatchApplyStatus, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)] @@ -3808,6 +3872,9 @@ pub struct CollabAgentSpawnBeginEvent { pub prompt: String, pub model: String, pub reasoning_effort: ReasoningEffortConfig, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)] @@ -3859,6 +3926,15 @@ pub struct CollabAgentSpawnEndEvent { pub reasoning_effort: ReasoningEffortConfig, /// Last known status of the new agent reported to the sender agent. pub status: AgentStatus, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] @@ -3872,6 +3948,9 @@ pub struct CollabAgentInteractionBeginEvent { /// Prompt sent from the sender to the receiver. Can be empty to prevent CoT /// leaking at the beginning. pub prompt: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] @@ -3893,6 +3972,15 @@ pub struct CollabAgentInteractionEndEvent { pub prompt: String, /// Last known status of the receiver agent reported to the sender agent. pub status: AgentStatus, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] @@ -3906,6 +3994,9 @@ pub struct CollabWaitingBeginEvent { pub receiver_agents: Vec, /// ID of the waiting call. pub call_id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] @@ -3919,6 +4010,15 @@ pub struct CollabWaitingEndEvent { pub agent_statuses: Vec, /// Last known status of the receiver agents reported to the sender agent. pub statuses: HashMap, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] @@ -3929,6 +4029,9 @@ pub struct CollabCloseBeginEvent { pub sender_thread_id: ThreadId, /// Thread ID of the receiver. pub receiver_thread_id: ThreadId, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] @@ -3948,6 +4051,15 @@ pub struct CollabCloseEndEvent { /// Last known status of the receiver agent reported to the sender agent before /// the close. pub status: AgentStatus, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] @@ -3964,6 +4076,9 @@ pub struct CollabResumeBeginEvent { /// Optional role assigned to the receiver agent. #[serde(default, skip_serializing_if = "Option::is_none")] pub receiver_agent_role: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] @@ -3983,6 +4098,15 @@ pub struct CollabResumeEndEvent { /// Last known status of the receiver agent reported to the sender agent after /// resume. pub status: AgentStatus, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[cfg(test)] @@ -4642,6 +4766,9 @@ mod tests { query: Some("find docs".into()), queries: None, }, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), }; @@ -4679,6 +4806,9 @@ mod tests { revised_prompt: None, result: String::new(), saved_path: None, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), }; @@ -4701,6 +4831,9 @@ mod tests { revised_prompt: Some("A tiny blue square".into()), result: "Zm9v".into(), saved_path: Some(test_path_buf("/tmp/ig-1.png").abs()), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), }; diff --git a/codex-rs/rollout/src/policy.rs b/codex-rs/rollout/src/policy.rs index 22615623f3..1b4591870b 100644 --- a/codex-rs/rollout/src/policy.rs +++ b/codex-rs/rollout/src/policy.rs @@ -203,6 +203,9 @@ mod tests { revised_prompt: Some("final prompt".into()), result: "Zm9v".into(), saved_path: None, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }); assert!(should_persist_event_msg( diff --git a/codex-rs/tui/src/app/app_server_adapter.rs b/codex-rs/tui/src/app/app_server_adapter.rs index 4259758235..e2a1e6f16c 100644 --- a/codex-rs/tui/src/app/app_server_adapter.rs +++ b/codex-rs/tui/src/app/app_server_adapter.rs @@ -889,10 +889,20 @@ fn thread_item_to_core(item: &ThreadItem) -> Option { summary_text: summary.clone(), raw_content: content.clone(), })), - ThreadItem::WebSearch { id, query, action } => Some(TurnItem::WebSearch(WebSearchItem { + ThreadItem::WebSearch { + id, + query, + action, + started_at_ms, + completed_at_ms, + duration_ms, + } => Some(TurnItem::WebSearch(WebSearchItem { id: id.clone(), query: query.clone(), action: app_server_web_search_action_to_core(action.clone()?)?, + started_at_ms: *started_at_ms, + completed_at_ms: *completed_at_ms, + duration_ms: *duration_ms, })), ThreadItem::ImageGeneration { id, @@ -900,12 +910,18 @@ fn thread_item_to_core(item: &ThreadItem) -> Option { revised_prompt, result, saved_path, + started_at_ms, + completed_at_ms, + duration_ms, } => Some(TurnItem::ImageGeneration(ImageGenerationItem { id: id.clone(), status: status.clone(), revised_prompt: revised_prompt.clone(), result: result.clone(), saved_path: saved_path.clone(), + started_at_ms: *started_at_ms, + completed_at_ms: *completed_at_ms, + duration_ms: *duration_ms, })), ThreadItem::ContextCompaction { id } => { Some(TurnItem::ContextCompaction(ContextCompactionItem { @@ -936,6 +952,7 @@ fn command_execution_started_event(turn_id: &str, item: &ThreadItem) -> Option Option Option command_actions, aggregated_output, exit_code, + started_at_ms, + completed_at_ms, duration_ms, } = item else { @@ -1017,6 +1037,8 @@ fn command_execution_completed_event(turn_id: &str, item: &ThreadItem) -> Option .collect(), source: source.to_core(), interaction_input: None, + started_at_ms: *started_at_ms, + completed_at_ms: *completed_at_ms, stdout: String::new(), stderr: String::new(), aggregated_output: aggregated_output.clone(), @@ -1210,6 +1232,8 @@ mod tests { }], aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }; @@ -1266,6 +1290,8 @@ mod tests { }], aggregated_output: Some("hello world\n".to_string()), exit_code: Some(0), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(5), }; let (_, completed_events) = server_notification_thread_events( @@ -1301,6 +1327,8 @@ mod tests { command_actions: vec![], aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }; @@ -1351,6 +1379,8 @@ mod tests { }], aggregated_output: Some("hello world\n".to_string()), exit_code: Some(0), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(5), }], status: TurnStatus::Completed, @@ -1606,6 +1636,9 @@ mod tests { id: "search-1".to_string(), query: "ratatui stylize".to_string(), action: Some(codex_app_server_protocol::WebSearchAction::Other), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, ThreadItem::ImageGeneration { id: "image-1".to_string(), @@ -1613,6 +1646,9 @@ mod tests { revised_prompt: Some("diagram".to_string()), result: "image.png".to_string(), saved_path: None, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, ThreadItem::ContextCompaction { id: "compact-1".to_string(), diff --git a/codex-rs/tui/src/app/tests.rs b/codex-rs/tui/src/app/tests.rs index 756c50869d..cd36b4674f 100644 --- a/codex-rs/tui/src/app/tests.rs +++ b/codex-rs/tui/src/app/tests.rs @@ -2549,6 +2549,9 @@ async fn inactive_thread_file_change_approval_recovers_buffered_changes() { diff: "hello\n".to_string(), }], status: codex_app_server_protocol::PatchApplyStatus::InProgress, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, }), ) @@ -4662,6 +4665,9 @@ async fn replace_chat_widget_reseeds_collab_agent_metadata_for_replay() { model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, }, ), diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs index bebdbf1248..9258c439ca 100644 --- a/codex-rs/tui/src/chatwidget.rs +++ b/codex-rs/tui/src/chatwidget.rs @@ -4252,6 +4252,7 @@ impl ChatWidget { call_id, query, action, + .. } = ev; let mut handled = false; if let Some(cell) = self @@ -4290,6 +4291,9 @@ impl ChatWidget { model, reasoning_effort, agents_states, + started_at_ms, + completed_at_ms, + duration_ms, } = item else { return; @@ -4348,6 +4352,9 @@ impl ChatWidget { .unwrap_or_else(|| { AgentStatus::Errored("Agent spawn failed".into()) }), + started_at_ms, + completed_at_ms, + duration_ms, }, spawn_request.as_ref(), )); @@ -4376,6 +4383,9 @@ impl ChatWidget { .unwrap_or_else(|| { AgentStatus::Errored("Agent interaction failed".into()) }), + started_at_ms, + completed_at_ms, + duration_ms, }, )); } @@ -4394,6 +4404,7 @@ impl ChatWidget { receiver_agent_role: first_receiver_metadata .as_ref() .and_then(|metadata| metadata.agent_role.clone()), + started_at_ms, }, )); } else { @@ -4415,6 +4426,9 @@ impl ChatWidget { .unwrap_or_else(|| { AgentStatus::Errored("Agent resume failed".into()) }), + started_at_ms, + completed_at_ms, + duration_ms, }, )); } @@ -4436,6 +4450,7 @@ impl ChatWidget { &self.collab_agent_metadata, ), call_id: id, + started_at_ms, }, )); } else { @@ -4450,6 +4465,9 @@ impl ChatWidget { call_id: id, agent_statuses, statuses, + started_at_ms, + completed_at_ms, + duration_ms, }, )); } @@ -4469,6 +4487,9 @@ impl ChatWidget { receiver_agent_role: first_receiver_metadata .as_ref() .and_then(|metadata| metadata.agent_role.clone()), + started_at_ms, + completed_at_ms, + duration_ms, status: receiver_thread_ids .iter() .find_map(|thread_id| agents_states.get(thread_id)) @@ -6519,6 +6540,8 @@ impl ChatWidget { command_actions, aggregated_output, exit_code, + started_at_ms, + completed_at_ms, duration_ms, } => { if matches!( @@ -6537,6 +6560,7 @@ impl ChatWidget { .collect(), source: source.to_core(), interaction_input: None, + started_at_ms, }); } else { let aggregated_output = aggregated_output.unwrap_or_default(); @@ -6552,6 +6576,8 @@ impl ChatWidget { .collect(), source: source.to_core(), interaction_input: None, + started_at_ms, + completed_at_ms, stdout: String::new(), stderr: String::new(), aggregated_output: aggregated_output.clone(), @@ -6581,6 +6607,9 @@ impl ChatWidget { id, changes, status, + started_at_ms, + completed_at_ms, + duration_ms, } => { if !matches!( status, @@ -6610,6 +6639,9 @@ impl ChatWidget { codex_protocol::protocol::PatchApplyStatus::Failed } }, + started_at_ms, + completed_at_ms, + duration_ms, }); } } @@ -6621,6 +6653,8 @@ impl ChatWidget { mcp_app_resource_uri, result, error, + started_at_ms, + completed_at_ms, duration_ms, .. } => { @@ -6632,6 +6666,8 @@ impl ChatWidget { arguments: Some(arguments), }, mcp_app_resource_uri, + started_at_ms, + completed_at_ms, duration: Duration::from_millis(duration_ms.unwrap_or_default().max(0) as u64), result: match (result, error) { (_, Some(error)) => Err(error.message), @@ -6648,9 +6684,17 @@ impl ChatWidget { }, }); } - ThreadItem::WebSearch { id, query, action } => { + ThreadItem::WebSearch { + id, + query, + action, + started_at_ms, + completed_at_ms, + duration_ms, + } => { self.on_web_search_begin(WebSearchBeginEvent { call_id: id.clone(), + started_at_ms, }); self.on_web_search_end(WebSearchEndEvent { call_id: id, @@ -6658,6 +6702,9 @@ impl ChatWidget { action: action .map(web_search_action_to_core) .unwrap_or(codex_protocol::models::WebSearchAction::Other), + started_at_ms, + completed_at_ms, + duration_ms, }); } ThreadItem::ImageView { id, path } => { @@ -6669,6 +6716,9 @@ impl ChatWidget { revised_prompt, result, saved_path, + started_at_ms, + completed_at_ms, + duration_ms, } => { self.on_image_generation_end(ImageGenerationEndEvent { call_id: id, @@ -6676,6 +6726,9 @@ impl ChatWidget { revised_prompt, status, saved_path, + started_at_ms, + completed_at_ms, + duration_ms, }); } ThreadItem::EnteredReviewMode { review, .. } => { @@ -6700,6 +6753,9 @@ impl ChatWidget { model, reasoning_effort, agents_states, + started_at_ms, + completed_at_ms, + duration_ms, } => self.on_collab_agent_tool_call(ThreadItem::CollabAgentToolCall { id, tool, @@ -6710,6 +6766,9 @@ impl ChatWidget { model, reasoning_effort, agents_states, + started_at_ms, + completed_at_ms, + duration_ms, }), ThreadItem::DynamicToolCall { .. } => {} } @@ -7138,6 +7197,7 @@ impl ChatWidget { process_id, source, command_actions, + started_at_ms, .. } => { self.on_exec_command_begin(ExecCommandBeginEvent { @@ -7152,14 +7212,21 @@ impl ChatWidget { .collect(), source: source.to_core(), interaction_input: None, + started_at_ms, }); } - ThreadItem::FileChange { id, changes, .. } => { + ThreadItem::FileChange { + id, + changes, + started_at_ms, + .. + } => { self.on_patch_apply_begin(PatchApplyBeginEvent { call_id: id, turn_id: notification.turn_id, auto_approved: false, changes: file_update_changes_to_core(changes), + started_at_ms, }); } ThreadItem::McpToolCall { @@ -7168,6 +7235,7 @@ impl ChatWidget { tool, arguments, mcp_app_resource_uri, + started_at_ms, .. } => { self.on_mcp_tool_call_begin(McpToolCallBeginEvent { @@ -7178,13 +7246,24 @@ impl ChatWidget { arguments: Some(arguments), }, mcp_app_resource_uri, + started_at_ms, }); } - ThreadItem::WebSearch { id, .. } => { - self.on_web_search_begin(WebSearchBeginEvent { call_id: id }); + ThreadItem::WebSearch { + id, started_at_ms, .. + } => { + self.on_web_search_begin(WebSearchBeginEvent { + call_id: id, + started_at_ms, + }); } - ThreadItem::ImageGeneration { id, .. } => { - self.on_image_generation_begin(ImageGenerationBeginEvent { call_id: id }); + ThreadItem::ImageGeneration { + id, started_at_ms, .. + } => { + self.on_image_generation_begin(ImageGenerationBeginEvent { + call_id: id, + started_at_ms, + }); } ThreadItem::CollabAgentToolCall { id, @@ -7196,6 +7275,9 @@ impl ChatWidget { model, reasoning_effort, agents_states, + started_at_ms, + completed_at_ms, + duration_ms, } => self.on_collab_agent_tool_call(ThreadItem::CollabAgentToolCall { id, tool, @@ -7206,6 +7288,9 @@ impl ChatWidget { model, reasoning_effort, agents_states, + started_at_ms, + completed_at_ms, + duration_ms, }), ThreadItem::EnteredReviewMode { review, .. } => { if !from_replay { diff --git a/codex-rs/tui/src/chatwidget/interrupts.rs b/codex-rs/tui/src/chatwidget/interrupts.rs index f41e3b3a47..e5e82fb0e0 100644 --- a/codex-rs/tui/src/chatwidget/interrupts.rs +++ b/codex-rs/tui/src/chatwidget/interrupts.rs @@ -192,6 +192,7 @@ mod tests { parsed_cmd: Vec::new(), source: ExecCommandSource::Agent, interaction_input: None, + started_at_ms: None, } } diff --git a/codex-rs/tui/src/chatwidget/tests/app_server.rs b/codex-rs/tui/src/chatwidget/tests/app_server.rs index 9c2e1c83d4..0997b3ff11 100644 --- a/codex-rs/tui/src/chatwidget/tests/app_server.rs +++ b/codex-rs/tui/src/chatwidget/tests/app_server.rs @@ -15,6 +15,7 @@ async fn collab_spawn_end_shows_requested_model_and_effort() { prompt: "Explore the repo".to_string(), model: "gpt-5".to_string(), reasoning_effort: ReasoningEffortConfig::High, + started_at_ms: None, }), }); chat.handle_codex_event(Event { @@ -29,6 +30,9 @@ async fn collab_spawn_end_shows_requested_model_and_effort() { model: "gpt-5".to_string(), reasoning_effort: ReasoningEffortConfig::High, status: AgentStatus::PendingInit, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), }); @@ -272,6 +276,9 @@ async fn live_app_server_file_change_item_started_preserves_changes() { diff: "hello\n".to_string(), }], status: AppServerPatchApplyStatus::InProgress, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, }), /*replay_kind*/ None, @@ -309,6 +316,8 @@ async fn live_app_server_command_execution_strips_shell_wrapper() { }], aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }, }), @@ -330,6 +339,8 @@ async fn live_app_server_command_execution_strips_shell_wrapper() { }], aggregated_output: Some("Hello, world!\n".to_string()), exit_code: Some(0), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(5), }, }), @@ -386,6 +397,9 @@ async fn live_app_server_collab_wait_items_render_history() { model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, }), /*replay_kind*/ None, @@ -423,6 +437,9 @@ async fn live_app_server_collab_wait_items_render_history() { }, ), ]), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, }), /*replay_kind*/ None, @@ -458,6 +475,9 @@ async fn live_app_server_collab_spawn_completed_renders_requested_model_and_effo model: Some("gpt-5".to_string()), reasoning_effort: Some(ReasoningEffortConfig::High), agents_states: HashMap::new(), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, }), /*replay_kind*/ None, @@ -483,6 +503,9 @@ async fn live_app_server_collab_spawn_completed_renders_requested_model_and_effo message: None, }, )]), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, }), /*replay_kind*/ None, diff --git a/codex-rs/tui/src/chatwidget/tests/exec_flow.rs b/codex-rs/tui/src/chatwidget/tests/exec_flow.rs index ec47872486..86a7ca1b3d 100644 --- a/codex-rs/tui/src/chatwidget/tests/exec_flow.rs +++ b/codex-rs/tui/src/chatwidget/tests/exec_flow.rs @@ -368,6 +368,8 @@ async fn exec_end_without_begin_uses_event_command() { cwd, parsed_cmd, source: ExecCommandSource::Agent, + started_at_ms: None, + completed_at_ms: None, interaction_input: None, stdout: "done".to_string(), stderr: String::new(), @@ -954,6 +956,9 @@ async fn image_generation_call_adds_history_cell() { revised_prompt: Some("A tiny blue square".into()), result: "Zm9v".into(), saved_path: Some(test_path_buf("/tmp/ig-1.png").abs()), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), }); @@ -1540,6 +1545,7 @@ async fn apply_patch_events_emit_history_cells() { turn_id: "turn-c1".into(), auto_approved: true, changes: changes2, + started_at_ms: None, }; chat.handle_codex_event(Event { id: "s1".into(), @@ -1569,6 +1575,9 @@ async fn apply_patch_events_emit_history_cells() { success: true, changes: end_changes, status: CorePatchApplyStatus::Completed, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }; chat.handle_codex_event(Event { id: "s1".into(), @@ -1618,6 +1627,7 @@ async fn apply_patch_manual_approval_adjusts_header() { turn_id: "turn-c1".into(), auto_approved: false, changes: apply_changes, + started_at_ms: None, }), }); @@ -1671,6 +1681,7 @@ async fn apply_patch_manual_flow_snapshot() { turn_id: "turn-c1".into(), auto_approved: false, changes: apply_changes, + started_at_ms: None, }), }); let approved_lines = drain_insert_history(&mut rx) @@ -1784,6 +1795,7 @@ async fn apply_patch_full_flow_integration_like() { turn_id: "turn-call-1".into(), auto_approved: false, changes: changes2, + started_at_ms: None, }), }); let mut end_changes = HashMap::new(); @@ -1801,6 +1813,9 @@ async fn apply_patch_full_flow_integration_like() { success: true, changes: end_changes, status: CorePatchApplyStatus::Completed, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), }); } diff --git a/codex-rs/tui/src/chatwidget/tests/helpers.rs b/codex-rs/tui/src/chatwidget/tests/helpers.rs index 015340bbb2..138480967d 100644 --- a/codex-rs/tui/src/chatwidget/tests/helpers.rs +++ b/codex-rs/tui/src/chatwidget/tests/helpers.rs @@ -506,6 +506,7 @@ pub(super) fn begin_exec_with_source( parsed_cmd, source, interaction_input, + started_at_ms: None, }; chat.handle_codex_event(Event { id: call_id.to_string(), @@ -531,6 +532,7 @@ pub(super) fn begin_unified_exec_startup( parsed_cmd: Vec::new(), source: ExecCommandSource::UnifiedExecStartup, interaction_input: None, + started_at_ms: None, }; chat.handle_codex_event(Event { id: call_id.to_string(), @@ -647,6 +649,7 @@ pub(super) fn end_exec( source, interaction_input, process_id, + started_at_ms, } = begin_event; chat.handle_codex_event(Event { id: call_id.clone(), @@ -659,6 +662,8 @@ pub(super) fn end_exec( parsed_cmd, source, interaction_input, + started_at_ms, + completed_at_ms: None, stdout: stdout.to_string(), stderr: stderr.to_string(), aggregated_output: aggregated.clone(), diff --git a/codex-rs/tui/src/chatwidget/tests/status_and_layout.rs b/codex-rs/tui/src/chatwidget/tests/status_and_layout.rs index 530629b2ae..338915804e 100644 --- a/codex-rs/tui/src/chatwidget/tests/status_and_layout.rs +++ b/codex-rs/tui/src/chatwidget/tests/status_and_layout.rs @@ -2818,6 +2818,7 @@ async fn chatwidget_exec_and_status_layout_vt100_snapshot() { parsed_cmd: parsed_cmd.clone(), source: ExecCommandSource::Agent, interaction_input: None, + started_at_ms: None, }), }); chat.handle_codex_event(Event { @@ -2831,6 +2832,8 @@ async fn chatwidget_exec_and_status_layout_vt100_snapshot() { parsed_cmd, source: ExecCommandSource::Agent, interaction_input: None, + started_at_ms: None, + completed_at_ms: None, stdout: String::new(), stderr: String::new(), aggregated_output: String::new(), diff --git a/codex-rs/tui/src/multi_agents.rs b/codex-rs/tui/src/multi_agents.rs index 293c80fcf0..7b26c8aef1 100644 --- a/codex-rs/tui/src/multi_agents.rs +++ b/codex-rs/tui/src/multi_agents.rs @@ -215,6 +215,7 @@ pub(crate) fn interaction_end(ev: CollabAgentInteractionEndEvent) -> PlainHistor receiver_agent_role, prompt, status: _, + .. } = ev; let title = title_with_agent( @@ -240,6 +241,7 @@ pub(crate) fn waiting_begin(ev: CollabWaitingBeginEvent) -> PlainHistoryCell { receiver_thread_ids, receiver_agents, call_id: _, + .. } = ev; let receiver_agents = merge_wait_receivers(&receiver_thread_ids, receiver_agents); @@ -271,6 +273,7 @@ pub(crate) fn waiting_end(ev: CollabWaitingEndEvent) -> PlainHistoryCell { sender_thread_id: _, agent_statuses, statuses, + .. } = ev; let details = wait_complete_lines(&statuses, &agent_statuses); collab_event(title_text("Finished waiting"), details) @@ -284,6 +287,7 @@ pub(crate) fn close_end(ev: CollabCloseEndEvent) -> PlainHistoryCell { receiver_agent_nickname, receiver_agent_role, status: _, + .. } = ev; collab_event( @@ -307,6 +311,7 @@ pub(crate) fn resume_begin(ev: CollabResumeBeginEvent) -> PlainHistoryCell { receiver_thread_id, receiver_agent_nickname, receiver_agent_role, + .. } = ev; collab_event( @@ -331,6 +336,7 @@ pub(crate) fn resume_end(ev: CollabResumeEndEvent) -> PlainHistoryCell { receiver_agent_nickname, receiver_agent_role, status, + .. } = ev; collab_event( @@ -612,6 +618,9 @@ mod tests { model: "gpt-5".to_string(), reasoning_effort: ReasoningEffortConfig::High, status: AgentStatus::PendingInit, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, Some(&SpawnRequestSummary { model: "gpt-5".to_string(), @@ -627,6 +636,9 @@ mod tests { receiver_agent_role: Some("explorer".to_string()), prompt: "Please continue and return the answer only.".to_string(), status: AgentStatus::Running, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }); let waiting = waiting_begin(CollabWaitingBeginEvent { @@ -638,6 +650,7 @@ mod tests { agent_role: Some("explorer".to_string()), }], call_id: "call-wait".to_string(), + started_at_ms: None, }); let mut statuses = HashMap::new(); @@ -664,6 +677,9 @@ mod tests { }, ], statuses, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }); let close = close_end(CollabCloseEndEvent { @@ -673,6 +689,9 @@ mod tests { receiver_agent_nickname: Some("Robie".to_string()), receiver_agent_role: Some("explorer".to_string()), status: AgentStatus::Completed(Some("39916800".to_string())), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }); let snapshot = [spawn, send, waiting, finished, close] @@ -750,6 +769,9 @@ mod tests { model: "gpt-5".to_string(), reasoning_effort: ReasoningEffortConfig::High, status: AgentStatus::PendingInit, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, Some(&SpawnRequestSummary { model: "gpt-5".to_string(), @@ -783,6 +805,9 @@ mod tests { receiver_agent_nickname: Some("Robie".to_string()), receiver_agent_role: Some("explorer".to_string()), status: AgentStatus::Interrupted, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }); assert_snapshot!("collab_resume_interrupted", cell_to_text(&cell));