feat: add search term to thread list (#12578)

Add `searchTerm` to `thread/list` that will search for a match in the
titles (the condition being `searchTerm` $$\in$$ `title`)
This commit is contained in:
jif-oai
2026-02-25 09:59:41 +00:00
committed by GitHub
parent a046849438
commit f46b767b7e
20 changed files with 156 additions and 3 deletions

View File

@@ -160,6 +160,7 @@ fn sanitize_rollout_item_for_persistence(
impl RolloutRecorder {
/// List threads (rollout files) under the provided Codex home directory.
#[allow(clippy::too_many_arguments)]
pub async fn list_threads(
config: &Config,
page_size: usize,
@@ -168,6 +169,7 @@ impl RolloutRecorder {
allowed_sources: &[SessionSource],
model_providers: Option<&[String]>,
default_provider: &str,
search_term: Option<&str>,
) -> std::io::Result<ThreadsPage> {
Self::list_threads_with_db_fallback(
config,
@@ -178,11 +180,13 @@ impl RolloutRecorder {
model_providers,
default_provider,
false,
search_term,
)
.await
}
/// List archived threads (rollout files) under the archived sessions directory.
#[allow(clippy::too_many_arguments)]
pub async fn list_archived_threads(
config: &Config,
page_size: usize,
@@ -191,6 +195,7 @@ impl RolloutRecorder {
allowed_sources: &[SessionSource],
model_providers: Option<&[String]>,
default_provider: &str,
search_term: Option<&str>,
) -> std::io::Result<ThreadsPage> {
Self::list_threads_with_db_fallback(
config,
@@ -201,6 +206,7 @@ impl RolloutRecorder {
model_providers,
default_provider,
true,
search_term,
)
.await
}
@@ -215,6 +221,7 @@ impl RolloutRecorder {
model_providers: Option<&[String]>,
default_provider: &str,
archived: bool,
search_term: Option<&str>,
) -> std::io::Result<ThreadsPage> {
let codex_home = config.codex_home.as_path();
// Filesystem-first listing intentionally overfetches so we can repair stale/missing
@@ -275,6 +282,7 @@ impl RolloutRecorder {
allowed_sources,
model_providers,
archived,
search_term,
)
.await
{
@@ -312,6 +320,7 @@ impl RolloutRecorder {
allowed_sources,
model_providers,
false,
None,
)
.await
else {
@@ -1154,6 +1163,7 @@ mod tests {
&[],
None,
default_provider.as_str(),
None,
)
.await?;
assert_eq!(page1.items.len(), 1);
@@ -1168,6 +1178,7 @@ mod tests {
&[],
None,
default_provider.as_str(),
None,
)
.await?;
assert_eq!(page2.items.len(), 1);
@@ -1229,6 +1240,7 @@ mod tests {
&[],
None,
default_provider.as_str(),
None,
)
.await?;
assert_eq!(page.items.len(), 0);
@@ -1295,6 +1307,7 @@ mod tests {
&[],
None,
default_provider.as_str(),
None,
)
.await?;
assert_eq!(page.items.len(), 1);