mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +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:
@@ -1,4 +1,5 @@
|
||||
use codex_code_mode_protocol::FunctionCallOutputContentItem;
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::EXIT_SENTINEL;
|
||||
use super::RuntimeEvent;
|
||||
@@ -230,7 +231,10 @@ pub(super) fn store_callback(
|
||||
}
|
||||
};
|
||||
if let Some(state) = scope.get_slot_mut::<RuntimeState>() {
|
||||
state.stored_values.insert(key.clone(), serialized.clone());
|
||||
let serialized = Arc::new(serialized);
|
||||
state
|
||||
.stored_values
|
||||
.insert(key.clone(), Arc::clone(&serialized));
|
||||
state.stored_value_writes.insert(key, serialized);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user