code-mode: use compact session-local cell ids

This commit is contained in:
Channing Conger
2026-06-19 19:25:54 +00:00
parent 9bb2f36b57
commit 0dbe655fec
5 changed files with 45 additions and 20 deletions
@@ -39,7 +39,7 @@ impl CodeModeExecuteHandler {
let enabled_tools =
codex_tools::collect_code_mode_tool_definitions(&self.nested_tool_specs);
let started_at = std::time::Instant::now();
let cell_id = codex_code_mode::CellId::new(uuid::Uuid::new_v4().to_string());
let cell_id = exec.session.services.code_mode_service.allocate_cell_id();
let runtime_cell_id = cell_id.to_string();
let code_cell_trace = exec
.session
+12
View File
@@ -6,6 +6,8 @@ mod wait_handler;
pub(crate) mod wait_spec;
use std::sync::Arc;
use std::sync::atomic::AtomicU64;
use std::sync::atomic::Ordering;
use std::time::Duration;
use codex_code_mode::CellId;
@@ -61,6 +63,7 @@ pub(crate) struct ExecContext {
pub(crate) struct CodeModeService {
session: Option<Arc<dyn CodeModeSession>>,
dispatch_broker: Arc<CodeModeDispatchBroker>,
next_cell_id: AtomicU64,
}
impl CodeModeService {
@@ -71,9 +74,18 @@ impl CodeModeService {
dispatch_broker.clone(),
))),
dispatch_broker,
next_cell_id: AtomicU64::new(1),
}
}
pub(crate) fn allocate_cell_id(&self) -> CellId {
CellId::new(
self.next_cell_id
.fetch_add(1, Ordering::Relaxed)
.to_string(),
)
}
pub(crate) async fn execute(
&self,
request: codex_code_mode::ExecuteRequest,