mirror of
https://github.com/openai/codex.git
synced 2026-10-21 17:48:44 +00:00
## What changed - Add `CodeModeCellTiming` notifications for yielded executions, terminal waits, and unavailable cells, with thread, call, and cell identifiers. - Measure how long completed results remain buffered before retrieval and carry `result_buffered_for` through the runtime, stdio protocol, and gRPC response metadata. Immediate delivery reports zero; waits without a completed result report no buffering measurement. - Default missing buffering data to zero for compatibility with older hosts. ## Testing Extend runtime tests to verify buffering duration with a paused clock and retrieval through termination. Add gRPC conversion tests for nanosecond precision, optional metadata, and the distinction between immediate delivery and no completed result. GitOrigin-RevId: 60c0c5a3affa69ac3779bf1812fca50f5748af76
50 lines
1.5 KiB
Rust
50 lines
1.5 KiB
Rust
use codex_code_mode_protocol::NoopCodeModeSessionDelegate;
|
|
use codex_code_mode_runtime::ExecuteRequest;
|
|
use codex_code_mode_runtime::InProcessCodeModeSession;
|
|
use codex_code_mode_runtime::RuntimeResponse;
|
|
use codex_code_mode_runtime::V8JitMode;
|
|
use codex_code_mode_runtime::initialize_v8;
|
|
use pretty_assertions::assert_eq;
|
|
use std::sync::Arc;
|
|
|
|
#[tokio::test]
|
|
async fn code_mode_runs_with_jit_disabled() {
|
|
initialize_v8(V8JitMode::Disabled).expect("initialize V8 without JIT");
|
|
|
|
let service = InProcessCodeModeSession::new();
|
|
let started = service
|
|
.execute(
|
|
ExecuteRequest {
|
|
tool_call_id: "call_1".to_string(),
|
|
enabled_tools: Vec::new(),
|
|
source: "21 * 2;".to_string(),
|
|
yield_time_ms: None,
|
|
max_output_tokens: None,
|
|
},
|
|
Arc::new(NoopCodeModeSessionDelegate),
|
|
/*preempt*/ None,
|
|
)
|
|
.await
|
|
.expect("start code-mode cell");
|
|
let cell_id = started.cell_id.clone();
|
|
let response = started
|
|
.initial_response()
|
|
.await
|
|
.expect("execute code-mode cell");
|
|
|
|
assert_eq!(
|
|
response,
|
|
RuntimeResponse::Result {
|
|
code_mode_host_duration: None,
|
|
cell_id,
|
|
content_items: Vec::new(),
|
|
result_buffered_for: std::time::Duration::ZERO,
|
|
error_text: None,
|
|
}
|
|
);
|
|
assert_eq!(
|
|
initialize_v8(V8JitMode::Enabled),
|
|
Err("V8 was already initialized with JIT disabled".to_string())
|
|
);
|
|
}
|