Add thread section management APIs (#36380)

## What changed

- Add `threadSection/create`, `threadSection/update`, and `threadSection/delete` app-server methods, with generated protocol schemas and TypeScript bindings.
- Persist custom sections in SQLite with stable UUIDv7 identities, trim and validate display names, and prevent renaming or deleting the built-in pinned section.
- Delete sections transactionally and return their active and archived threads to the unsectioned list.
- Serialize section mutations with section listing so concurrent requests observe ordered updates.

## Testing

- Cover section persistence across restarts, ordered renames, member cleanup on deletion, invalid requests, unsupported stores, and thread-store/state-runtime behavior.

GitOrigin-RevId: dc9a4be283c21dbc93ab1829eafc4825d8df6575
This commit is contained in:
joeytrasatti-openai authored and copyberry committed 2026-07-31 19:08:45 +00:00
1 parent d62353a312
commit c42ea41ee0
38 files changed
+1862 -62

No files matched your search

+39
View File
@@ -14,6 +14,7 @@ mod rollout_lineage;
mod search_threads;
mod thread_history;
mod thread_history_materialization;
mod thread_sections;
mod unarchive_thread;
mod update_thread_metadata;
mod writer_lock;
@@ -41,10 +42,13 @@ use crate::AppendThreadItemsParams;
use crate::ArchiveThreadParams;
use crate::ArchiveThreadsParams;
use crate::CreateThreadParams;
use crate::CreateThreadSectionParams;
use crate::DeleteThreadParams;
use crate::DeleteThreadSectionParams;
use crate::DeleteThreadsParams;
use crate::ItemPage;
use crate::ListItemsParams;
use crate::ListThreadSectionsParams;
use crate::ListThreadsParams;
use crate::ListTurnsParams;
use crate::LoadThreadHistoryParams;
@@ -53,12 +57,15 @@ use crate::PrepareForkParams;
use crate::PreparedFork;
use crate::ReadThreadByRolloutPathParams;
use crate::ReadThreadParams;
use crate::RenameThreadSectionParams;
use crate::ResumeThreadParams;
use crate::SearchThreadOccurrencesParams;
use crate::SearchThreadsParams;
use crate::StoredModelContext;
use crate::StoredThread;
use crate::StoredThreadHistory;
use crate::StoredThreadSection;
use crate::StoredThreadSectionsPage;
use crate::ThreadOccurrenceSearchPage;
use crate::ThreadPage;
use crate::ThreadSearchPage;
@@ -458,6 +465,38 @@ impl ThreadStore for LocalThreadStore {
Box::pin(async move { list_threads::list_threads(self, params).await })
}
fn supports_thread_sections(&self) -> bool {
self.state_db.is_some()
}
fn list_thread_sections(
&self,
params: ListThreadSectionsParams,
) -> ThreadStoreFuture<'_, StoredThreadSectionsPage> {
Box::pin(async move { thread_sections::list_thread_sections(self, params).await })
}
fn create_thread_section(
&self,
params: CreateThreadSectionParams,
) -> ThreadStoreFuture<'_, StoredThreadSection> {
Box::pin(async move { thread_sections::create_thread_section(self, params).await })
}
fn rename_thread_section(
&self,
params: RenameThreadSectionParams,
) -> ThreadStoreFuture<'_, Option<StoredThreadSection>> {
Box::pin(async move { thread_sections::rename_thread_section(self, params).await })
}
fn delete_thread_section(
&self,
params: DeleteThreadSectionParams,
) -> ThreadStoreFuture<'_, bool> {
Box::pin(async move { thread_sections::delete_thread_section(self, params).await })
}
fn supports_paginated_history_lists(&self) -> bool {
self.state_db.is_some()
}