Skip to content

Fix filtered thread-list resume regression in TUI#19591

Merged
etraut-openai merged 3 commits intomainfrom
etraut/resume-perf-regression
Apr 27, 2026
Merged

Fix filtered thread-list resume regression in TUI#19591
etraut-openai merged 3 commits intomainfrom
etraut/resume-perf-regression

Conversation

@etraut-openai
Copy link
Copy Markdown
Collaborator

@etraut-openai etraut-openai commented Apr 25, 2026

Why

codex resume regressed after #18502 changed the default thread/list scan-and-repair path for metadata-filtered listings. The TUI resume picker uses thread/list with source/provider/cwd filters and useStateDbOnly: false, which is the intended correctness-preserving mode: it should still consult the filesystem so healthy, missing, or stale SQLite state can be repaired.

The regression was that #18502 made that filtered, filesystem-backed path call reconcile_rollout for every filesystem hit, and then call it again for each SQLite hit. When reconcile_rollout does not already have extracted rollout items, it falls back to loading the full JSONL rollout. That changed the resume picker’s first page from a cheap rollout-head scan plus SQLite read-repair into full-file reads for large sessions, so a few long threads could dominate TUI startup/resume latency.

This change addresses the regression by keeping useStateDbOnly: false on the correctness-preserving path while avoiding unnecessary full JSONL reads for rows the filesystem scan has already validated. Source/provider/cwd filters can be decided from rollout-head metadata, so non-search resume listings only need the lightweight read-repair path for filesystem hits. Full reconciliation is still used for DB-only filtered rows because those can be stale false positives, and for search listings because search can depend on title metadata that may require scanning the full rollout.

This fixes #19483.

What changed

  • For non-search filtered listings, repair filesystem hits with the lightweight read_repair_rollout_path path instead of full reconcile_rollout.
  • Track thread IDs proven by the filesystem scan and only fully reconcile SQLite-filtered hits that the filesystem scan did not return, preserving stale-DB false-positive cleanup without full-reading every healthy rollout.
  • Leave search listings on full reconciliation, since search depends on full title metadata rather than only source/provider/cwd metadata from the rollout head.

Verification

  • cargo test -p codex-rollout list_threads
  • cargo test -p codex-app-server thread_list

@etraut-openai etraut-openai changed the title Speed up TUI resume startup Fix TUI resume performance regression Apr 25, 2026
@etraut-openai etraut-openai force-pushed the etraut/resume-perf-regression branch from 1536c25 to 319d4e1 Compare April 25, 2026 19:47
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1536c25e63

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/tui/src/lib.rs Outdated
Comment thread codex-rs/tui/src/resume_picker.rs Outdated
@etraut-openai etraut-openai force-pushed the etraut/resume-perf-regression branch from 319d4e1 to 905e1d0 Compare April 25, 2026 20:25
@etraut-openai etraut-openai changed the title Fix TUI resume performance regression Fix filtered thread-list resume regression Apr 25, 2026
@etraut-openai etraut-openai force-pushed the etraut/resume-perf-regression branch from 905e1d0 to 6fecc78 Compare April 25, 2026 20:28
@etraut-openai etraut-openai force-pushed the etraut/resume-perf-regression branch from 6fecc78 to 4075c53 Compare April 25, 2026 20:29
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4075c5390a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +459 to 462
if search_term.is_some() {
state_db::reconcile_rollout(
state_db_ctx.as_deref(),
item.path.as_path(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Reconcile non-search filtered filesystem hits fully

When search_term is None, filtered listings (source/provider/cwd) now call read_repair_rollout_path for filesystem hits. That helper does not refresh full metadata fields like model_provider/source from JSONL. If SQLite has stale filter fields for a thread present in fs_page, the later DB loop never fixes it (it only reconciles DB-only hits), so subsequent state-db-only filtered listings can keep missing valid threads.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this is a small but legitimate hole, but it existed prior to #18502. The only reason that #18502 "fixed" this hole is because it forced us to go through an expensive remediation path every time.

If we decide that this is a hole we want to fix (I'd look to @jif-oai for advice here), then I think we should do it as a follow-up PR.

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.

Yeah I would ignore this

@etraut-openai etraut-openai changed the title Fix filtered thread-list resume regression Fix filtered thread-list resume regression in TUI Apr 25, 2026
@xoofx
Copy link
Copy Markdown

xoofx commented Apr 26, 2026

Glad that a fix is coming, after switching to 0.124.0, discovered that thread-list was extremely slow.

Comment on lines +459 to 462
if search_term.is_some() {
state_db::reconcile_rollout(
state_db_ctx.as_deref(),
item.path.as_path(),
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.

Yeah I would ignore this

@etraut-openai etraut-openai merged commit 850f035 into main Apr 27, 2026
25 checks passed
@etraut-openai etraut-openai deleted the etraut/resume-perf-regression branch April 27, 2026 20:02
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: codex resume picker slowed from 2-3s to 8-60s after updating to 0.124.0

3 participants