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

+11 -11
View File
@@ -650,7 +650,7 @@ async fn test_list_conversations_latest_first() {
thread_id: Some(thread_id_from_uuid(u3)),
first_user_message: Some("Hello from user".to_string()),
preview: Some("Hello from user".to_string()),
is_pinned: false,
section: None,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -671,7 +671,7 @@ async fn test_list_conversations_latest_first() {
thread_id: Some(thread_id_from_uuid(u2)),
first_user_message: Some("Hello from user".to_string()),
preview: Some("Hello from user".to_string()),
is_pinned: false,
section: None,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -692,7 +692,7 @@ async fn test_list_conversations_latest_first() {
thread_id: Some(thread_id_from_uuid(u1)),
first_user_message: Some("Hello from user".to_string()),
preview: Some("Hello from user".to_string()),
is_pinned: false,
section: None,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -806,7 +806,7 @@ async fn test_pagination_cursor() {
thread_id: Some(thread_id_from_uuid(u5)),
first_user_message: Some("Hello from user".to_string()),
preview: Some("Hello from user".to_string()),
is_pinned: false,
section: None,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -827,7 +827,7 @@ async fn test_pagination_cursor() {
thread_id: Some(thread_id_from_uuid(u4)),
first_user_message: Some("Hello from user".to_string()),
preview: Some("Hello from user".to_string()),
is_pinned: false,
section: None,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -884,7 +884,7 @@ async fn test_pagination_cursor() {
thread_id: Some(thread_id_from_uuid(u3)),
first_user_message: Some("Hello from user".to_string()),
preview: Some("Hello from user".to_string()),
is_pinned: false,
section: None,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -905,7 +905,7 @@ async fn test_pagination_cursor() {
thread_id: Some(thread_id_from_uuid(u2)),
first_user_message: Some("Hello from user".to_string()),
preview: Some("Hello from user".to_string()),
is_pinned: false,
section: None,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -954,7 +954,7 @@ async fn test_pagination_cursor() {
thread_id: Some(thread_id_from_uuid(u1)),
first_user_message: Some("Hello from user".to_string()),
preview: Some("Hello from user".to_string()),
is_pinned: false,
section: None,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -1128,7 +1128,7 @@ async fn test_get_thread_contents() {
thread_id: Some(thread_id_from_uuid(uuid)),
first_user_message: Some("Hello from user".to_string()),
preview: Some("Hello from user".to_string()),
is_pinned: false,
section: None,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -1496,7 +1496,7 @@ async fn test_timestamp_only_cursor_skips_same_second_filesystem_ties() {
thread_id: Some(thread_id_from_uuid(u3)),
first_user_message: Some("Hello from user".to_string()),
preview: Some("Hello from user".to_string()),
is_pinned: false,
section: None,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -1517,7 +1517,7 @@ async fn test_timestamp_only_cursor_skips_same_second_filesystem_ties() {
thread_id: Some(thread_id_from_uuid(u2)),
first_user_message: Some("Hello from user".to_string()),
preview: Some("Hello from user".to_string()),
is_pinned: false,
section: None,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,