mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
fixes
This commit is contained in:
@@ -2699,7 +2699,7 @@ impl CodexMessageProcessor {
|
||||
return;
|
||||
}
|
||||
|
||||
let state_db_ctx = get_state_db(&self.config).await;
|
||||
let state_db_ctx = open_state_db_for_direct_thread_lookup(&self.config).await;
|
||||
reconcile_rollout(
|
||||
state_db_ctx.as_deref(),
|
||||
rollout_path.as_path(),
|
||||
@@ -8631,7 +8631,7 @@ async fn read_summary_from_state_db_by_thread_id(
|
||||
config: &Config,
|
||||
thread_id: ThreadId,
|
||||
) -> Option<ConversationSummary> {
|
||||
let state_db_ctx = get_state_db(config).await;
|
||||
let state_db_ctx = open_state_db_for_direct_thread_lookup(config).await;
|
||||
read_summary_from_state_db_context_by_thread_id(state_db_ctx.as_ref(), thread_id).await
|
||||
}
|
||||
|
||||
@@ -8649,7 +8649,7 @@ async fn read_summary_from_state_db_context_by_thread_id(
|
||||
}
|
||||
|
||||
async fn title_from_state_db(config: &Config, thread_id: ThreadId) -> Option<String> {
|
||||
let state_db_ctx = get_state_db(config).await?;
|
||||
let state_db_ctx = open_state_db_for_direct_thread_lookup(config).await?;
|
||||
let metadata = state_db_ctx.get_thread(thread_id).await.ok().flatten()?;
|
||||
non_empty_title(&metadata)
|
||||
}
|
||||
@@ -8658,7 +8658,7 @@ async fn thread_titles_by_ids(
|
||||
config: &Config,
|
||||
thread_ids: &HashSet<ThreadId>,
|
||||
) -> HashMap<ThreadId, String> {
|
||||
let Some(state_db_ctx) = get_state_db(config).await else {
|
||||
let Some(state_db_ctx) = open_state_db_for_direct_thread_lookup(config).await else {
|
||||
return HashMap::new();
|
||||
};
|
||||
let mut names = HashMap::with_capacity(thread_ids.len());
|
||||
@@ -8673,6 +8673,12 @@ async fn thread_titles_by_ids(
|
||||
names
|
||||
}
|
||||
|
||||
async fn open_state_db_for_direct_thread_lookup(config: &Config) -> Option<StateDbHandle> {
|
||||
StateRuntime::init(config.sqlite_home.clone(), config.model_provider_id.clone())
|
||||
.await
|
||||
.ok()
|
||||
}
|
||||
|
||||
fn non_empty_title(metadata: &ThreadMetadata) -> Option<String> {
|
||||
let title = metadata.title.trim();
|
||||
(!title.is_empty()).then(|| title.to_string())
|
||||
|
||||
@@ -241,7 +241,9 @@ impl RolloutRecorder {
|
||||
)
|
||||
.await
|
||||
{
|
||||
return Ok(db_page.into());
|
||||
if !db_page.items.is_empty() || cursor.is_some() {
|
||||
return Ok(db_page.into());
|
||||
}
|
||||
}
|
||||
|
||||
// Filesystem-first listing intentionally overfetches so we can repair stale/missing
|
||||
|
||||
@@ -1966,8 +1966,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn lookup_session_target_by_name_ignores_backend_search_term_mismatch()
|
||||
-> color_eyre::Result<()> {
|
||||
async fn lookup_session_target_by_name_uses_backend_title_search() -> color_eyre::Result<()> {
|
||||
let temp_dir = TempDir::new()?;
|
||||
let config = build_config(&temp_dir).await?;
|
||||
let thread_id = ThreadId::new();
|
||||
@@ -2003,15 +2002,13 @@ mod tests {
|
||||
);
|
||||
builder.cwd = session_cwd;
|
||||
let mut metadata = builder.build(config.model_provider_id.as_str());
|
||||
metadata.title = "Different rollout title".to_string();
|
||||
metadata.title = "saved-session".to_string();
|
||||
metadata.first_user_message = Some("preview text".to_string());
|
||||
state_runtime
|
||||
.upsert_thread(&metadata)
|
||||
.await
|
||||
.map_err(std::io::Error::other)?;
|
||||
|
||||
codex_core::append_thread_name(&config.codex_home, thread_id, "saved-session").await?;
|
||||
|
||||
let mut app_server =
|
||||
AppServerSession::new(codex_app_server_client::AppServerClient::InProcess(
|
||||
start_test_embedded_app_server(config).await?,
|
||||
|
||||
Reference in New Issue
Block a user