Skip to content

fix(tui): make agent lineage recovery bounded and resumable - #736

Merged
GraciousGazelles merged 14 commits into
mainfrom
successor/pr675-current-main-w12636-20260904
Sep 4, 2026
Merged

GraciousGazelles merged 14 commits into
mainfrom
successor/pr675-current-main-w12636-20260904

Conversation

@GraciousGazelles

Copy link
Copy Markdown
Collaborator

Summary

Supersedes the stale PR #675 implementation on the exact current main tip. This current-main successor preserves the existing loaded-thread pagination validation while making persisted subagent lineage recovery bounded, resumable, and safe for large or malformed spawn graphs.

What changed

  • query only the selected primary thread's persisted descendant lineage, with compatibility fallback for older servers;
  • bound recursive persisted relation traversal and expose a truncation signal without widening the query or memory budget;
  • add the missing historical thread_spawn_edges migration, idempotently and without synthesizing missing parents;
  • retain active/parent-owned/protected picker entries at capacity, evicting only safe closed entries;
  • bound picker row construction with rotating windows so repeated opens expose retained descendants without an all-history spike;
  • preserve pagination cursors and pending metadata reads across bounded attempts, including retryable errors and cursor-cycle degradation;
  • preserve current turn-message IDs and unrelated current-main behavior.

Validation

  • exact base: d3dcf9fb32211ed7319f2fd7148b5e2f23777373
  • candidate head: 61a9b7af340535ea5726735859d838331e0d7db7
  • git diff --check passed
  • cargo fmt --all -- --check passed from codex-rs
  • state leaf performed bounded SQLite migration/CTE/cycle smoke checks and did not run local heavy builds/tests
  • please run the targeted TUI/state/app-server lanes and the normal protected/frontier checks on this exact head

Scope and safety

This is a current-main successor, not a wholesale replay of stale PR #675 or PR #663. No workflow, runner, credential, protection, destructive, dependency, continuity, or unrelated chatwidget changes are included. All review conversations must be resolved before landing.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-04T01:04:25.431209Z 61a9b7a PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a safety limit of 3,200 on the number of tracked subagent threads to prevent unbounded memory and CPU usage in both the SQLite state database and the TUI. It bounds recursive descendant queries in the database, implements incremental lineage validation in the TUI via a new accumulator and page budget, and introduces rotating picker slices to display bounded subsets of threads. A critical review comment identifies a compilation error in threads.rs where a usize is passed directly to QueryBuilder::push, as well as a performance bottleneck caused by an ORDER BY clause inside the recursive CTE.

Comment thread codex-rs/state/src/runtime/threads.rs Resolved
@GraciousGazelles
GraciousGazelles force-pushed the successor/pr675-current-main-w12636-20260904 branch from 663b0c6 to 5003e3f Compare September 4, 2026 01:51
@GraciousGazelles
GraciousGazelles force-pushed the successor/pr675-current-main-w12636-20260904 branch from 5003e3f to 4c603e9 Compare September 4, 2026 02:00
@GraciousGazelles GraciousGazelles added the code-reviewed Completed required code review label Sep 4, 2026
@GraciousGazelles
GraciousGazelles added this pull request to the merge queue Sep 4, 2026
Merged via the queue into main with commit f40ba8f Sep 4, 2026
114 checks passed
@GraciousGazelles
GraciousGazelles deleted the successor/pr675-current-main-w12636-20260904 branch September 4, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-reviewed Completed required code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant