moving to headers

This commit is contained in:
pash
2026-01-30 08:46:05 -08:00
parent 024f49e63e
commit 7b26f3539e
2 changed files with 4 additions and 33 deletions

View File

@@ -759,20 +759,6 @@ impl Session {
.flatten()
}
async fn get_or_build_turn_metadata_header(&self, cwd: &Path) -> Option<String> {
if let Some(cached) = {
let state = self.state.lock().await;
state.cached_turn_metadata_header(cwd)
} {
return cached;
}
let header = Self::build_turn_metadata_header(cwd).await;
let mut state = self.state.lock().await;
state.set_turn_metadata_header_cache(cwd, header.clone());
header
}
#[allow(clippy::too_many_arguments)]
async fn new(
mut session_configuration: SessionConfiguration,
@@ -1309,9 +1295,8 @@ impl Session {
if let Some(final_schema) = final_output_json_schema {
turn_context.final_output_json_schema = final_schema;
}
turn_context.turn_metadata_header = self
.get_or_build_turn_metadata_header(turn_context.cwd.as_path())
.await;
turn_context.turn_metadata_header =
Self::build_turn_metadata_header(turn_context.cwd.as_path()).await;
Arc::new(turn_context)
}
@@ -3267,9 +3252,8 @@ async fn spawn_review_thread(
parent_turn_context.client.transport_manager(),
);
let turn_metadata_header = sess
.get_or_build_turn_metadata_header(parent_turn_context.cwd.as_path())
.await;
let turn_metadata_header =
Session::build_turn_metadata_header(parent_turn_context.cwd.as_path()).await;
let review_turn_context = TurnContext {
sub_id: sub_id.to_string(),
client,

View File

@@ -3,7 +3,6 @@
use codex_protocol::models::ResponseItem;
use std::collections::HashMap;
use std::collections::HashSet;
use std::path::Path;
use crate::codex::SessionConfiguration;
use crate::context_manager::ContextManager;
@@ -20,7 +19,6 @@ pub(crate) struct SessionState {
pub(crate) server_reasoning_included: bool,
pub(crate) dependency_env: HashMap<String, String>,
pub(crate) mcp_dependency_prompted: HashSet<String>,
pub(crate) turn_metadata_header_cache: HashMap<String, Option<String>>,
/// Whether the session's initial context has been seeded into history.
///
/// TODO(owen): This is a temporary solution to avoid updating a thread's updated_at
@@ -39,7 +37,6 @@ impl SessionState {
server_reasoning_included: false,
dependency_env: HashMap::new(),
mcp_dependency_prompted: HashSet::new(),
turn_metadata_header_cache: HashMap::new(),
initial_context_seeded: false,
}
}
@@ -128,16 +125,6 @@ impl SessionState {
pub(crate) fn dependency_env(&self) -> HashMap<String, String> {
self.dependency_env.clone()
}
pub(crate) fn cached_turn_metadata_header(&self, cwd: &Path) -> Option<Option<String>> {
let key = cwd.to_string_lossy().into_owned();
self.turn_metadata_header_cache.get(&key).cloned()
}
pub(crate) fn set_turn_metadata_header_cache(&mut self, cwd: &Path, header: Option<String>) {
let key = cwd.to_string_lossy().into_owned();
self.turn_metadata_header_cache.insert(key, header);
}
}
// Sometimes new snapshots don't include credits or plan information.