Lightweight coding agent that runs in your terminal
Rust
Stabilize Guardian client cache key handling (#24891)
jif-oaic95eb3d07bd7
diff --git a/codex-rs/core/src/client.rs b/codex-rs/core/src/client.rsindex 6c87400edd..f47be864fb 100644--- a/codex-rs/core/src/client.rs+++ b/codex-rs/core/src/client.rs@@ -218,6 +218,7 @@ impl RequestRouteTelemetry {#[derive(Debug, Clone)]pub struct ModelClient {state: Arc<ModelClientState>,+ prompt_cache_key_override: Option<String>,}/// A turn-scoped streaming session created from a [`ModelClient`].@@ -352,9 +353,24 @@ impl ModelClient {disable_websockets: AtomicBool::new(false),cached_websocket_session: StdMutex::new(WebsocketSession::default()),}),+ prompt_cache_key_override: None,}}+ pub(crate) fn with_prompt_cache_key_override(+ mut self,+ prompt_cache_key_override: Option<String>,+ ) -> Self {+ self.prompt_cache_key_override = prompt_cache_key_override;+ self+ }++ fn prompt_cache_key(&self) -> String {+ self.prompt_cache_key_override+ .clone()+ .unwrap_or_else(|| self.state.thread_id.to_string())+ }+/// Creates a fresh turn-scoped streaming session.////// This constructor does not perform network I/O itself; the session opens a websocket lazily@@ -749,7 +765,7 @@ impl ModelClient {&prompt.output_schema,prompt.output_schema_strict,);- let prompt_cache_key = Some(self.state.thread_id.to_string());+ let prompt_cache_key = Some(self.prompt_cache_key());let service_tier = model_info.service_tier_for_request(service_tier);let request = ResponsesApiRequest {model: model_info.slug.clone(),