pub struct RolloutRecorder { /* private fields */ }Expand description
Writes canonical session rollout items to JSONL.
Rollouts are recorded as JSONL and can be inspected with tools such as:
$ jq -C . ~/.codex/sessions/rollout-2025-05-07T17-24-21-5973b6c0-94b8-487b-a530-2aeb6098ae0e.jsonl
$ fx ~/.codex/sessions/rollout-2025-05-07T17-24-21-5973b6c0-94b8-487b-a530-2aeb6098ae0e.jsonlImplementations§
Source§impl RolloutRecorder
impl RolloutRecorder
Sourcepub async fn list_threads(
state_db_ctx: Option<StateDbHandle>,
config: &impl RolloutConfigView,
page_size: usize,
cursor: Option<&Cursor>,
sort_key: ThreadSortKey,
sort_direction: SortDirection,
allowed_sources: &[SessionSource],
model_providers: Option<&[String]>,
cwd_filters: Option<&[PathBuf]>,
default_provider: &str,
search_term: Option<&str>,
) -> Result<ThreadsPage>
pub async fn list_threads( state_db_ctx: Option<StateDbHandle>, config: &impl RolloutConfigView, page_size: usize, cursor: Option<&Cursor>, sort_key: ThreadSortKey, sort_direction: SortDirection, allowed_sources: &[SessionSource], model_providers: Option<&[String]>, cwd_filters: Option<&[PathBuf]>, default_provider: &str, search_term: Option<&str>, ) -> Result<ThreadsPage>
List threads (rollout files) under the provided Codex home directory.
pub async fn list_threads_from_state_db( state_db_ctx: Option<StateDbHandle>, config: &impl RolloutConfigView, page_size: usize, cursor: Option<&Cursor>, sort_key: ThreadSortKey, sort_direction: SortDirection, allowed_sources: &[SessionSource], model_providers: Option<&[String]>, cwd_filters: Option<&[PathBuf]>, default_provider: &str, search_term: Option<&str>, ) -> Result<ThreadsPage>
Sourcepub async fn list_archived_threads(
state_db_ctx: Option<StateDbHandle>,
config: &impl RolloutConfigView,
page_size: usize,
cursor: Option<&Cursor>,
sort_key: ThreadSortKey,
sort_direction: SortDirection,
allowed_sources: &[SessionSource],
model_providers: Option<&[String]>,
cwd_filters: Option<&[PathBuf]>,
default_provider: &str,
search_term: Option<&str>,
) -> Result<ThreadsPage>
pub async fn list_archived_threads( state_db_ctx: Option<StateDbHandle>, config: &impl RolloutConfigView, page_size: usize, cursor: Option<&Cursor>, sort_key: ThreadSortKey, sort_direction: SortDirection, allowed_sources: &[SessionSource], model_providers: Option<&[String]>, cwd_filters: Option<&[PathBuf]>, default_provider: &str, search_term: Option<&str>, ) -> Result<ThreadsPage>
List archived threads (rollout files) under the archived sessions directory.
pub async fn list_archived_threads_from_state_db( state_db_ctx: Option<StateDbHandle>, config: &impl RolloutConfigView, page_size: usize, cursor: Option<&Cursor>, sort_key: ThreadSortKey, sort_direction: SortDirection, allowed_sources: &[SessionSource], model_providers: Option<&[String]>, cwd_filters: Option<&[PathBuf]>, default_provider: &str, search_term: Option<&str>, ) -> Result<ThreadsPage>
Sourcepub async fn find_latest_thread_path(
state_db_ctx: Option<StateDbHandle>,
config: &impl RolloutConfigView,
page_size: usize,
cursor: Option<&Cursor>,
sort_key: ThreadSortKey,
allowed_sources: &[SessionSource],
model_providers: Option<&[String]>,
default_provider: &str,
filter_cwd: Option<&Path>,
) -> Result<Option<PathBuf>>
pub async fn find_latest_thread_path( state_db_ctx: Option<StateDbHandle>, config: &impl RolloutConfigView, page_size: usize, cursor: Option<&Cursor>, sort_key: ThreadSortKey, allowed_sources: &[SessionSource], model_providers: Option<&[String]>, default_provider: &str, filter_cwd: Option<&Path>, ) -> Result<Option<PathBuf>>
Find the newest recorded thread path, optionally filtering to a matching cwd.
Sourcepub async fn new(
config: &impl RolloutConfigView,
params: RolloutRecorderParams,
) -> Result<Self>
pub async fn new( config: &impl RolloutConfigView, params: RolloutRecorderParams, ) -> Result<Self>
Attempt to create a new RolloutRecorder.
For newly created sessions, this precomputes path/metadata and defers
file creation/open until an explicit persist() call.
For resumed sessions, this immediately opens the existing rollout file.
pub fn rollout_path(&self) -> &Path
pub async fn record_canonical_items(&self, items: &[RolloutItem]) -> Result<()>
Sourcepub async fn persist(&self) -> Result<()>
pub async fn persist(&self) -> Result<()>
Materialize the rollout file and persist all buffered items.
This is idempotent. If materialization fails, the recorder keeps all pending items in memory
and a later persist() or flush() can retry opening and writing the rollout file.
Sourcepub async fn flush(&self) -> Result<()>
pub async fn flush(&self) -> Result<()>
Flush all queued writes and wait until they are committed by the writer task.
If the first writer attempt fails, the writer drops and reopens the file handle before retrying. This returns an error only when that retry also fails or the writer task is gone.
pub async fn load_rollout_items( path: &Path, ) -> Result<(Vec<RolloutItem>, Option<ThreadId>, usize)>
pub async fn get_rollout_history(path: &Path) -> Result<InitialHistory>
Trait Implementations§
Source§impl Clone for RolloutRecorder
impl Clone for RolloutRecorder
Source§fn clone(&self) -> RolloutRecorder
fn clone(&self) -> RolloutRecorder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for RolloutRecorder
impl RefUnwindSafe for RolloutRecorder
impl Send for RolloutRecorder
impl Sync for RolloutRecorder
impl Unpin for RolloutRecorder
impl UnsafeUnpin for RolloutRecorder
impl UnwindSafe for RolloutRecorder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request