Skip to content

feat(app-server): filter threads by parent - #26662

Merged
btraut-openai merged 10 commits into
mainfrom
btraut/thread-list-parent-filter
Jun 14, 2026
Merged

feat(app-server): filter threads by parent#26662
btraut-openai merged 10 commits into
mainfrom
btraut/thread-list-parent-filter

Conversation

@btraut-openai

@btraut-openai btraut-openai commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Why

Clients that display or coordinate spawned subagents need an authoritative snapshot of a thread's immediate spawned children when they connect to app-server or recover after missing live events. thread/list cannot query by parent, so clients must otherwise scan unrelated threads or reconstruct relationships from rollout history and transient events.

The direct spawn relationship already exists in persisted thread_spawn_edges state. Review and Guardian threads do not participate in that lifecycle and are intentionally outside this filter's scope.

What changed

This adds an experimental parentThreadId filter to thread/list. Parent-filtered requests return direct spawned children from persisted state while preserving the existing response shape, explicit filters, sorting, and timestamp-only cursor behavior. The lookup does not read rollout transcripts or recursively return descendants.

Supersedes #25112 with the narrower thread/list filter approach.

How it works

  1. An experimental client passes a valid thread ID as parentThreadId.
  2. App-server routes the list through the existing thread-store and state-database boundaries.
  3. SQLite selects threads whose IDs have a direct persisted spawn edge from that parent.
  4. Omitted provider and source filters include all values; explicit filters keep ordinary thread/list semantics.
  5. Grandchildren, Review threads, and Guardian threads are excluded.

Verification

State (144 tests), rollout (69 tests), and focused app-server thread-list (31 tests) suites passed. Scoped Clippy checks and repository formatting also passed. Coverage includes direct spawned children, omitted grandchildren, pagination, malformed IDs, mixed source kinds, explicit filters, and operation without rollout files.

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

btraut-openai pushed a commit that referenced this pull request Jun 7, 2026
@btraut-openai
btraut-openai force-pushed the btraut/thread-list-parent-filter branch from c8ea2dd to acfa2ba Compare June 7, 2026 21:49
Ok(mut page) => {
// Parent-filtered listings intentionally treat persisted state as authoritative.
if parent_thread_id.is_some() {

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.

Codex: This is intentionally a narrow accommodation in the existing rollout/state adapter. Conceptually, querying indexed thread metadata and validating rollout-file existence would be separate layers; parent-filtered listing only needs the first. Extracting that boundary here would broaden the PR and risk existing thread/list behavior, so this branch returns authoritative persisted relationships before rollout validation while leaving the ordinary path unchanged.

@btraut-openai
btraut-openai marked this pull request as ready for review June 7, 2026 22:47
@btraut-openai
btraut-openai requested a review from a team as a code owner June 7, 2026 22:47
btraut-openai added a commit that referenced this pull request Jun 7, 2026
@btraut-openai
btraut-openai force-pushed the btraut/thread-list-parent-filter branch from 7b5cee5 to 7caeaaf Compare June 7, 2026 22:49

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

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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b5cee517c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/app-server-protocol/src/protocol/v2/thread.rs
Comment thread codex-rs/app-server/src/request_processors/thread_processor.rs Outdated
Comment thread codex-rs/app-server/src/request_processors/thread_processor.rs Outdated
Comment thread codex-rs/state/src/runtime/threads.rs Outdated
Comment thread codex-rs/state/src/runtime/threads.rs
Comment thread codex-rs/thread-store/src/types.rs
btraut-openai added a commit that referenced this pull request Jun 10, 2026
@btraut-openai
btraut-openai force-pushed the btraut/thread-list-parent-filter branch from 4ef72f3 to 0c79164 Compare June 10, 2026 06:42
btraut-openai added a commit that referenced this pull request Jun 11, 2026
@btraut-openai
btraut-openai force-pushed the btraut/thread-list-parent-filter branch from 0c79164 to 6cd747d Compare June 11, 2026 16:47

@jif-oai jif-oai left a comment

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.

This won't be backward compatible but lgtm after my comments
Please check with DDR as well, he did some work on sub-second ordering / reflection

Comment thread codex-rs/thread-store/src/local/create_thread.rs Outdated
Comment thread codex-rs/state/src/runtime/threads.rs Outdated
btraut-openai added a commit that referenced this pull request Jun 12, 2026
@btraut-openai
btraut-openai force-pushed the btraut/thread-list-parent-filter branch from 6cd747d to fee5e2f Compare June 12, 2026 16:02
@btraut-openai
btraut-openai force-pushed the btraut/thread-list-parent-filter branch from 9cbdb67 to 95d0018 Compare June 12, 2026 19:51
@btraut-openai
btraut-openai merged commit dfd03ea into main Jun 14, 2026
31 checks passed
@btraut-openai
btraut-openai deleted the btraut/thread-list-parent-filter branch June 14, 2026 07:14
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants