mirror of
https://github.com/openai/codex.git
synced 2026-04-28 00:25:56 +00:00
Leverage state DB metadata for thread summaries (#10621)
Summary: - read conversation summaries and cwd info from the state DB when possible so we no longer rely on rollout files for metadata and avoid extra I/O - persist CLI version in thread metadata, surface it through summary builders, and add the necessary DB migration hooks - simplify thread listing by using enriched state DB data directly rather than reading rollout heads Testing: - Not run (not requested)
This commit is contained in:
@@ -85,13 +85,8 @@ async fn responses_mode_stream_cli() {
|
||||
!page.items.is_empty(),
|
||||
"expected at least one session to be listed"
|
||||
);
|
||||
// First line of head must be the SessionMeta payload (id/timestamp)
|
||||
let head0 = page.items[0].head.first().expect("missing head record");
|
||||
assert!(head0.get("id").is_some(), "head[0] missing id");
|
||||
assert!(
|
||||
head0.get("timestamp").is_some(),
|
||||
"head[0] missing timestamp"
|
||||
);
|
||||
assert!(page.items[0].thread_id.is_some(), "missing thread_id");
|
||||
assert!(page.items[0].created_at.is_some(), "missing created_at");
|
||||
}
|
||||
|
||||
/// Verify that passing `-c model_instructions_file=...` to the CLI
|
||||
|
||||
@@ -169,7 +169,7 @@ async fn backfill_scans_existing_rollouts() -> Result<()> {
|
||||
assert_eq!(metadata.id, thread_id);
|
||||
assert_eq!(metadata.rollout_path, rollout_path);
|
||||
assert_eq!(metadata.model_provider, default_provider);
|
||||
assert!(metadata.has_user_event);
|
||||
assert!(metadata.first_user_message.is_some());
|
||||
|
||||
let mut stored_tools = None;
|
||||
for _ in 0..40 {
|
||||
@@ -221,7 +221,7 @@ async fn user_messages_persist_in_state_db() -> Result<()> {
|
||||
metadata = db.get_thread(thread_id).await?;
|
||||
if metadata
|
||||
.as_ref()
|
||||
.map(|entry| entry.has_user_event)
|
||||
.map(|entry| entry.first_user_message.is_some())
|
||||
.unwrap_or(false)
|
||||
{
|
||||
break;
|
||||
@@ -230,7 +230,7 @@ async fn user_messages_persist_in_state_db() -> Result<()> {
|
||||
}
|
||||
|
||||
let metadata = metadata.expect("thread should exist in state db");
|
||||
assert!(metadata.has_user_event);
|
||||
assert!(metadata.first_user_message.is_some());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user