mirror of
https://github.com/openai/codex.git
synced 2026-12-02 00:31:03 +00:00
address app-server review feedback
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
use std::collections::HashSet;
|
||||
use std::fs;
|
||||
use std::fs::File;
|
||||
use std::io::BufRead;
|
||||
use std::io::Error as IoError;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
@@ -959,14 +960,15 @@ impl RolloutRecorder {
|
||||
fn load_plain_rollout_items_blocking(
|
||||
path: &Path,
|
||||
) -> std::io::Result<(Vec<RolloutItem>, Option<ThreadId>, usize)> {
|
||||
let contents = std::fs::read_to_string(path)?;
|
||||
let reader = std::io::BufReader::new(File::open(path)?);
|
||||
let mut items: Vec<RolloutItem> = Vec::new();
|
||||
let mut thread_id: Option<ThreadId> = None;
|
||||
let mut parse_errors = 0usize;
|
||||
let mut saw_non_empty_line = false;
|
||||
for line in contents.lines() {
|
||||
for line in reader.lines() {
|
||||
let line = line?;
|
||||
parse_rollout_item_line(
|
||||
line,
|
||||
line.as_str(),
|
||||
&mut items,
|
||||
&mut thread_id,
|
||||
&mut parse_errors,
|
||||
@@ -1875,6 +1877,10 @@ impl From<codex_state::ThreadsPage> for ThreadsPage {
|
||||
}
|
||||
|
||||
fn thread_item_from_state_list_item(item: codex_state::ThreadListItem) -> ThreadItem {
|
||||
let source = serde_json::from_str(item.source.as_str())
|
||||
.or_else(|_| serde_json::from_value(Value::String(item.source)))
|
||||
.unwrap_or(SessionSource::Unknown);
|
||||
let parent_thread_id = source.parent_thread_id();
|
||||
ThreadItem {
|
||||
path: item.rollout_path,
|
||||
thread_id: Some(item.id),
|
||||
@@ -1885,12 +1891,8 @@ fn thread_item_from_state_list_item(item: codex_state::ThreadListItem) -> Thread
|
||||
git_branch: item.git_branch,
|
||||
git_sha: item.git_sha,
|
||||
git_origin_url: item.git_origin_url,
|
||||
source: Some(
|
||||
serde_json::from_str(item.source.as_str())
|
||||
.or_else(|_| serde_json::from_value(Value::String(item.source)))
|
||||
.unwrap_or(SessionSource::Unknown),
|
||||
),
|
||||
parent_thread_id: None,
|
||||
source: Some(source),
|
||||
parent_thread_id,
|
||||
agent_nickname: item.agent_nickname,
|
||||
agent_role: item.agent_role,
|
||||
model_provider: Some(item.model_provider),
|
||||
|
||||
@@ -210,6 +210,7 @@ pub(super) fn stored_thread_from_state_list_item(
|
||||
} else {
|
||||
model_provider
|
||||
};
|
||||
let source = parse_session_source(&source);
|
||||
let created_at = truncate_datetime_to_seconds(created_at);
|
||||
let updated_at = truncate_datetime_to_millis(updated_at);
|
||||
let recency_at = truncate_datetime_to_millis(recency_at);
|
||||
@@ -219,7 +220,7 @@ pub(super) fn stored_thread_from_state_list_item(
|
||||
extra_config: None,
|
||||
rollout_path: Some(rollout_path),
|
||||
forked_from_id: None,
|
||||
parent_thread_id,
|
||||
parent_thread_id: parent_thread_id.or_else(|| source.parent_thread_id()),
|
||||
preview,
|
||||
name,
|
||||
model_provider,
|
||||
@@ -231,7 +232,7 @@ pub(super) fn stored_thread_from_state_list_item(
|
||||
archived_at: archived.then_some(updated_at),
|
||||
cwd,
|
||||
cli_version,
|
||||
source: parse_session_source(&source),
|
||||
source,
|
||||
thread_source: None,
|
||||
agent_nickname,
|
||||
agent_role,
|
||||
|
||||
Reference in New Issue
Block a user