Skip to content

[codex] Add local thread store listing#17824

Merged
pakrym-oai merged 1 commit into
mainfrom
wiltzius/codex/thread-store-listing
Apr 15, 2026
Merged

[codex] Add local thread store listing#17824
pakrym-oai merged 1 commit into
mainfrom
wiltzius/codex/thread-store-listing

Conversation

@wiltzius-openai
Copy link
Copy Markdown
Contributor

@wiltzius-openai wiltzius-openai commented Apr 14, 2026

Builds on top of #17659

Move the filesystem + sqlite thread listing-related operations inside of a local ThreadStore implementation and call ThreadStore from the places that used to perform these filesystem/sqlite operations.

This is the first of a series of PRs that will implement the rest of the local ThreadStore.

Testing:

  • added unit tests for the thread store implementation
  • adjusted some unit tests in the realtime + personality packages whose callsites changed. Specifically I'm trying to hide ThreadMetadata inside of the local implementation and make ThreadMetadata a sqlite implementation detail concern rather than a public interface, preferring the more generate StoredThread interface instead
  • added a corner case test for the personality migration package that wasn't covered by the existing test suite
  • adjust the behavior of searched thread listing to run the existing local rollout repair/backfill pass before querying SQLite results, so callers using ThreadStore::list_threads do not miss matches after a partial metadata warm-up
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-abstraction branch from 645e9e5 to 4edef55 Compare April 14, 2026 20:29
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-listing branch from 0abeaaf to 9309c3f Compare April 14, 2026 20:32
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-abstraction branch from 4edef55 to 0c6fd51 Compare April 14, 2026 20:32
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-listing branch from 9309c3f to 01fa182 Compare April 14, 2026 20:35
Base automatically changed from wiltzius/codex/thread-store-abstraction to main April 14, 2026 20:51
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-listing branch 5 times, most recently from 0f2240a to 90c87a4 Compare April 14, 2026 22:10
@wiltzius-openai wiltzius-openai marked this pull request as draft April 14, 2026 22:11
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-listing branch from 90c87a4 to 86ff861 Compare April 14, 2026 22:35
Comment thread codex-rs/rollout/src/recorder.rs Outdated
let state_db_ctx = state_db::get_state_db(config).await;

if search_term.is_some()
if search_term.is_none()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this early return was only safe for unsearched listing; for searched listing it could return a partially populated SQLite result before the existing rollout repair pass had a chance to backfill older matching threads

@wiltzius-openai wiltzius-openai marked this pull request as ready for review April 14, 2026 22:53
Comment on lines +138 to +139
/// Local rollout path when the backing store is filesystem-based.
pub rollout_path: Option<PathBuf>,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this temporary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's temporary in the sense that an optional path is necessary in the ThreadStore until we make the path non-required in the AppServer protocol. The app server currently has a non-nullable path field when returning summaries of listed threads, so the ThreadStore sort of has to provide it.

I'm trying to do as much of this migration as possible underneath the current app server shape, but we will eventually need to change that layer too.

Do you have a preferred approach for how to handle that?

Copy link
Copy Markdown
Collaborator

@pakrym-oai pakrym-oai Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think keeping it here for a bit is fine especially considering rollout paths are all over app-server.

Comment thread codex-rs/core/src/realtime_context.rs Outdated
/*search_term*/ None,
)
async fn load_recent_threads(sess: &Session) -> Vec<StoredThread> {
let config = sess.get_config().await;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason not to toss LocalThreadStore onto sess.services?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think so, can do

sort_key: codex_rollout::ThreadSortKey,
) -> ThreadStoreResult<codex_rollout::ThreadsPage> {
let page = if params.archived {
RolloutRecorder::list_archived_threads(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe worth inlining later separately

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by inline do you mean moving the archived/unarchived distinction into a param on the rollout recorder methods?

Copy link
Copy Markdown
Collaborator

@pakrym-oai pakrym-oai Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean getting rid of RolloutRecorder and having methods be native on LocalThreadStorage.

RolloutRecorder was the previous place where we were abstracting away rollout management.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I see. Yes we can do that over time!

@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-listing branch 3 times, most recently from e8c948c to 874e83c Compare April 15, 2026 03:52
@wiltzius-openai wiltzius-openai enabled auto-merge (squash) April 15, 2026 16:59
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-listing branch from 874e83c to 6676bbd Compare April 15, 2026 17:02
@wiltzius-openai wiltzius-openai enabled auto-merge (squash) April 15, 2026 17:03
@pakrym-oai pakrym-oai disabled auto-merge April 15, 2026 18:34
@pakrym-oai pakrym-oai merged commit cdfcd2c into main Apr 15, 2026
53 of 61 checks passed
@pakrym-oai pakrym-oai deleted the wiltzius/codex/thread-store-listing branch April 15, 2026 18:34
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants