Add opt-in overhead timing to code-mode responses (#46288)

## Why

Code-mode responses show host duration without exposing time spent outside the host, including app-server waiting.

## What changed

- Add `features.code_mode.experimental_show_cell_overhead`, disabled by default, to show handler duration, host duration, and their difference in `exec` and `wait` response headers.
- Reuse the completed handler measurement from tool-call logging, excluding dispatch waiting, and capture it even when logging is disabled.
- Preserve the existing timing format when the option is disabled or host timing is unavailable, and preserve boolean feature toggles when merging nested code-mode configuration.

## Testing

Add coverage for timing headers, zero and missing host measurements, negative rounding differences, content preservation, and configuration merging. Extend app-server tests across gRPC and stdio to verify timing includes post-host elicitation waiting, and add a response snapshot for successful execution and a failed wait.

GitOrigin-RevId: 929b84784d9c6077cf2b5927a90bd2d5f3870078
This commit is contained in:
cassirer-openai authored and copyberry committed 2026-09-17 19:34:45 +00:00
1 parent 0a5b999169
commit 0fd1cd8d99
19 files changed
+619 -116

No files matched your search

+5
View File
@@ -26,6 +26,11 @@ pub struct CodeModeConfigToml {
/// Default yield timeout for code-mode exec calls, in milliseconds.
#[serde(skip_serializing_if = "Option::is_none")]
pub default_exec_yield_time_ms: Option<u64>,
/// Show handler duration, code-mode host duration, and harness overhead
/// in each code-mode cell response.
/// Experimental: this option and the response format may change or be removed.
#[serde(skip_serializing_if = "Option::is_none")]
pub experimental_show_cell_overhead: Option<bool>,
/// Exact tool namespaces to omit from the code-mode nested tool surface.
#[serde(skip_serializing_if = "Option::is_none")]
pub excluded_tool_namespaces: Option<Vec<String>>,