mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
8057603d0c
## Why `thread/list` can filter direct children with `parentThreadId`, but clients cannot request an entire spawned subtree. Discovering every descendant requires repeated client-side requests and gives up the database's existing filtering and pagination path. ## What changed Experimental clients can use `ancestorThreadId` to return strict descendants at any depth while `parentThreadId` retains its direct-child meaning. The filters are mutually exclusive, the ancestor is excluded, and every result preserves its immediate `parentThreadId` so callers can reconstruct the tree. ## How it works - **Explicit relationship:** Internal list parameters distinguish direct children from transitive descendants without changing the meaning of `parentThreadId`. - **Existing graph:** Persisted parent-child spawn edges remain the source of truth, so descendant lookup needs no schema migration or ancestry cache. - **Indexed traversal:** A recursive SQLite query starts from the parent-edge index, walks each generation, and applies thread filters, sorting, and cursor pagination in the same database request. - **Reconstructable results:** The response stays flat and normally ordered while carrying each descendant's immediate parent. ## Verification Ran 550 tests across the protocol, state, rollout, and thread-store crates, then reran the four focused state, store, and app-server descendant-listing tests after the final diff reduction. Scoped Clippy and formatting checks passed. Stable and experimental schema generation was checked; the stable fixtures remain unchanged while the experimental schema includes the new field.
58 lines
1.8 KiB
Rust
58 lines
1.8 KiB
Rust
//! Storage-neutral thread persistence interfaces.
|
|
//!
|
|
//! Application code should treat [`codex_protocol::ThreadId`] as the only durable thread handle.
|
|
//! Implementations are responsible for resolving that id to local rollout files, RPC requests, or
|
|
//! any other backing store.
|
|
|
|
mod error;
|
|
mod in_memory;
|
|
mod live_thread;
|
|
mod local;
|
|
mod store;
|
|
mod thread_metadata_sync;
|
|
mod types;
|
|
|
|
pub use error::ThreadStoreError;
|
|
pub use error::ThreadStoreResult;
|
|
pub use in_memory::InMemoryThreadStore;
|
|
pub use in_memory::InMemoryThreadStoreCalls;
|
|
pub use live_thread::LiveThread;
|
|
pub use live_thread::LiveThreadInitGuard;
|
|
pub use local::LocalThreadStore;
|
|
pub use local::LocalThreadStoreConfig;
|
|
pub use store::ThreadStore;
|
|
pub use store::ThreadStoreFuture;
|
|
pub use types::AppendThreadItemsParams;
|
|
pub use types::ArchiveThreadParams;
|
|
pub use types::ClearableField;
|
|
pub use types::CreateThreadParams;
|
|
pub use types::DeleteThreadParams;
|
|
pub use types::ExtraConfig;
|
|
pub use types::GitInfoPatch;
|
|
pub use types::ItemPage;
|
|
pub use types::ListItemsParams;
|
|
pub use types::ListThreadsParams;
|
|
pub use types::ListTurnsParams;
|
|
pub use types::LoadThreadHistoryParams;
|
|
pub use types::ReadThreadByRolloutPathParams;
|
|
pub use types::ReadThreadParams;
|
|
pub use types::ResumeThreadParams;
|
|
pub use types::SearchThreadsParams;
|
|
pub use types::SortDirection;
|
|
pub use types::StoredThread;
|
|
pub use types::StoredThreadHistory;
|
|
pub use types::StoredThreadItem;
|
|
pub use types::StoredThreadSearchResult;
|
|
pub use types::StoredTurn;
|
|
pub use types::StoredTurnError;
|
|
pub use types::StoredTurnItemsView;
|
|
pub use types::StoredTurnStatus;
|
|
pub use types::ThreadMetadataPatch;
|
|
pub use types::ThreadPage;
|
|
pub use types::ThreadPersistenceMetadata;
|
|
pub use types::ThreadRelationFilter;
|
|
pub use types::ThreadSearchPage;
|
|
pub use types::ThreadSortKey;
|
|
pub use types::TurnPage;
|
|
pub use types::UpdateThreadMetadataParams;
|