Add persisted sections for organizing threads (#35722)

## What changed

- Replace the `isPinned` thread metadata and filters with an optional persisted
  `section` and `sectionId`.
- Add the paginated `threadSection/list` app-server method so clients can
  discover sections even when they contain no threads.
- Seed a stable `Pinned` section, validate section assignments, and support
  filtering for a specific section or for unsectioned threads.

## Testing

- Cover section protocol serialization, listing and pagination, metadata
  updates, filtering, persistence, migration compatibility, and operation
  without SQLite state.

GitOrigin-RevId: 7972b5471d29317b9387bfd90aa9f573f691ad4c
This commit is contained in:
joeytrasatti-openai authored and copyberry committed 2026-07-28 05:26:16 +00:00
1 parent 9291a123fb
commit 85c6da1c79
85 files changed
+1826 -419

No files matched your search

@@ -164,6 +164,17 @@ pub struct GitInfo {
pub origin_url: Option<String>,
}
/// An independently persisted, user-visible thread section.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadSection {
/// Opaque UUIDv7 identity that remains stable when the section is renamed.
pub id: String,
/// The current user-visible section name.
pub name: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, ExperimentalApi)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
@@ -183,9 +194,9 @@ pub struct Thread {
pub preview: String,
/// Whether the thread is ephemeral and should not be materialized on disk.
pub ephemeral: bool,
/// Whether the thread has been pinned by the user.
/// The independently persisted section selected for this thread, if any.
#[serde(default)]
pub is_pinned: bool,
pub section: Option<ThreadSection>,
/// Persisted thread history contract selected when this thread was created.
#[experimental("thread.historyMode")]
#[serde(default)]