mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
code-mode: use compact session-local cell ids
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user