mirror of
https://github.com/openai/codex.git
synced 2026-12-05 01:00:54 +00:00
Share stored JSON payloads across code mode cells with Arc (#47036)
## Why Creating a cell deep-copies every stored JSON value, including values the cell never loads. Storing a value also duplicates its payload between the cell's local state and pending writes. ## What changed Use `Arc<JsonValue>` throughout the session store, cell runtime, and completion writes to share immutable payloads. Keep a separate map snapshot for each cell so later commits cannot change its view of stored values. GitOrigin-RevId: 4535f0f2ed0c8f8cbfb8d24cf1cb44cbc74472b5
This commit is contained in:
@@ -39,7 +39,7 @@ impl CellHost for PanickingCallbackHost {
|
||||
|
||||
async fn commit_completion(
|
||||
&self,
|
||||
_stored_value_writes: HashMap<String, JsonValue>,
|
||||
_stored_value_writes: HashMap<String, Arc<JsonValue>>,
|
||||
_event: CellEvent,
|
||||
_pending_initial_yield_items: Option<Vec<crate::session_runtime::OutputItem>>,
|
||||
_cell_state: Arc<CellState>,
|
||||
|
||||
@@ -47,7 +47,7 @@ pub(crate) struct CellActor;
|
||||
impl CellActor {
|
||||
pub(crate) fn prepare<H: CellHost>(
|
||||
request: CellRequest,
|
||||
stored_values: HashMap<String, JsonValue>,
|
||||
stored_values: HashMap<String, Arc<JsonValue>>,
|
||||
host: Arc<H>,
|
||||
initial_observe_mode: ObserveMode,
|
||||
cell_state: Arc<CellState>,
|
||||
|
||||
@@ -43,7 +43,7 @@ impl CellHost for TestHost {
|
||||
|
||||
async fn commit_completion(
|
||||
&self,
|
||||
_stored_value_writes: HashMap<String, JsonValue>,
|
||||
_stored_value_writes: HashMap<String, Arc<JsonValue>>,
|
||||
event: CellEvent,
|
||||
pending_initial_yield_items: Option<Vec<OutputItem>>,
|
||||
cell_state: Arc<CellState>,
|
||||
@@ -75,7 +75,7 @@ impl CellHost for RecordingHost {
|
||||
|
||||
async fn commit_completion(
|
||||
&self,
|
||||
_stored_value_writes: HashMap<String, JsonValue>,
|
||||
_stored_value_writes: HashMap<String, Arc<JsonValue>>,
|
||||
event: CellEvent,
|
||||
pending_initial_yield_items: Option<Vec<OutputItem>>,
|
||||
cell_state: Arc<CellState>,
|
||||
|
||||
@@ -53,7 +53,7 @@ pub(crate) trait CellHost: Send + Sync + 'static {
|
||||
|
||||
fn commit_completion(
|
||||
&self,
|
||||
stored_value_writes: HashMap<String, JsonValue>,
|
||||
stored_value_writes: HashMap<String, Arc<JsonValue>>,
|
||||
event: CellEvent,
|
||||
pending_initial_yield_items: Option<Vec<OutputItem>>,
|
||||
cell_state: Arc<CellState>,
|
||||
|
||||
Reference in New Issue
Block a user