Add persisted thread pinning to the app server (#34840)

## What changed

- Add `isPinned` to thread responses and allow `thread/metadata/update` to pin or unpin stored threads.
- Add an `isPinned` filter to `thread/list`, including cursor-based pagination and combinations with relationship filters.
- Persist pin state in SQLite without modifying rollout files, default existing threads to unpinned, and preserve pins through reconciliation and archive transitions.

## Testing

- Cover protocol serialization, database migration and indexing, pin updates, filtered pagination, rollout reconciliation, and archive/unarchive behavior.

GitOrigin-RevId: c2eacabd6dae465e2ae6ce8a169e00740960cdb7
This commit is contained in:
joeytrasatti-openai authored and copyberry committed 2026-07-22 22:54:28 +00:00
1 parent d7e8f4c3dc
commit 400ee190c3
71 files changed
+1058 -60

No files matched your search

+11
View File
@@ -640,6 +640,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,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -660,6 +661,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,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -680,6 +682,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,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -793,6 +796,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,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -813,6 +817,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,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -869,6 +874,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,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -889,6 +895,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,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -937,6 +944,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,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -1110,6 +1118,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,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -1477,6 +1486,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,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,
@@ -1497,6 +1507,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,
cwd: Some(Path::new(".").to_path_buf()),
git_branch: None,
git_sha: None,