Expose thread originators through the app-server API (#42458)

## What changed

- Add the creation-time `originator` to app-server thread responses and `thread/started` notifications.
- Persist originators in thread metadata and preserve the first recorded value across list, read, resume, rollout, and SQLite paths.
- Add an `originators` allowlist to `thread/list` for hosted backends. The local app-server accepts omitted or empty values but rejects nonempty filters.

## Testing

- Cover originator persistence across server restarts and list, read, and resume requests.
- Verify local `thread/list` handling for nonempty, omitted, null, and empty originator filters.
- Heap-allocate large TUI dispatcher futures in affected tests to keep them within the Windows test-thread stack.

GitOrigin-RevId: 73ad6e61b8fdd2d93a22d1f971723a19ec7be3fc
This commit is contained in:
Can Sar authored and copyberry committed 2026-09-03 06:02:25 +00:00
1 parent 8ff74cc9b1
commit 728cb12fe5
75 files changed
+511 -12

No files matched your search

+1
View File
@@ -37,6 +37,7 @@ impl App {
.request_typed::<ThreadListResponse>(ClientRequest::ThreadList {
request_id: RequestId::String(Uuid::new_v4().to_string()),
params: ThreadListParams {
originators: None,
cursor,
limit: Some(AGENT_PICKER_PAGE_SIZE),
sort_key: None,
@@ -227,6 +227,7 @@ fn overview_thread(
status: ThreadStatus,
) -> Thread {
Thread {
originator: None,
environments: None,
id: thread_id.to_string(),
extra: None,
@@ -184,6 +184,7 @@ impl App {
.request_typed::<ThreadListResponse>(ClientRequest::ThreadList {
request_id: RequestId::String(Uuid::new_v4().to_string()),
params: ThreadListParams {
originators: None,
cursor,
limit: Some(20),
sort_key: Some(sort_key),
+1
View File
@@ -135,6 +135,7 @@ mod tests {
fn test_thread(thread_id: ThreadId, source: SessionSource) -> Thread {
Thread {
originator: None,
environments: None,
id: thread_id.to_string(),
extra: None,
+3
View File
@@ -4041,6 +4041,7 @@ async fn inactive_thread_started_notification_initializes_replay_session() -> Re
agent_thread_id,
ServerNotification::ThreadStarted(ThreadStartedNotification {
thread: Thread {
originator: None,
environments: None,
id: agent_thread_id.to_string(),
extra: None,
@@ -4143,6 +4144,7 @@ async fn inactive_thread_started_notification_preserves_primary_model_when_path_
agent_thread_id,
ServerNotification::ThreadStarted(ThreadStartedNotification {
thread: Thread {
originator: None,
environments: None,
id: agent_thread_id.to_string(),
extra: None,
@@ -4212,6 +4214,7 @@ async fn thread_read_session_state_does_not_reuse_primary_permission_profile() {
app.primary_session_configured = Some(primary_session);
let thread = Thread {
originator: None,
environments: None,
id: read_thread_id.to_string(),
extra: None,
@@ -1769,13 +1769,14 @@ async fn transcript_home_loads_every_older_history_page() -> Result<()> {
app.chat_widget
.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
let mut tui = crate::tui::test_support::make_test_tui()?;
app.handle_event(
// Keep the large dispatcher future off the Windows test thread's stack.
Box::pin(app.handle_event(
&mut tui,
&mut app_server,
AppEvent::ExportTranscript {
destination: TranscriptExportDestination::File(export_path.clone()),
},
)
))
.await?;
assert!(app.chat_widget.queued_user_message_texts().is_empty());
let markdown = std::fs::read_to_string(export_path)?;
@@ -1813,7 +1814,7 @@ async fn transcript_home_loads_every_older_history_page() -> Result<()> {
.await?
.ok_or_else(|| color_eyre::eyre::eyre!("history event channel closed"))?;
if matches!(event, AppEvent::OlderThreadHistoryLoaded { .. }) {
app.handle_event(&mut tui, &mut app_server, event).await?;
Box::pin(app.handle_event(&mut tui, &mut app_server, event)).await?;
}
}
@@ -2234,7 +2235,8 @@ async fn underfilled_scrollback_fetches_older_pages_without_opening_the_transcri
None => panic!("scrollback refill request channel closed"),
}
};
app.handle_event(&mut tui, &mut app_server, request).await?;
// Keep the large dispatcher future off the Windows test thread's stack.
Box::pin(app.handle_event(&mut tui, &mut app_server, request)).await?;
let loaded = loop {
match app_event_rx.recv().await {
Some(event @ AppEvent::OlderThreadHistoryLoaded { .. }) => break event,
@@ -2242,7 +2244,7 @@ async fn underfilled_scrollback_fetches_older_pages_without_opening_the_transcri
None => panic!("older history page channel closed"),
}
};
app.handle_event(&mut tui, &mut app_server, loaded).await?;
Box::pin(app.handle_event(&mut tui, &mut app_server, loaded)).await?;
assert!(app.overlay.is_none());
assert!(app.transcript_cells.len() > initial_cell_count);
+1
View File
@@ -933,6 +933,7 @@ async fn known_thread_started_preserves_session_without_reading_unmaterialized_r
);
let notification = ThreadStartedNotification {
thread: Thread {
originator: None,
environments: None,
id: thread_id.to_string(),
extra: None,
@@ -410,6 +410,7 @@ mod tests {
..test_thread_session(primary_thread_id, test_path_buf("/tmp/primary"))
};
let read_thread = Thread {
originator: None,
environments: None,
id: read_thread_id.to_string(),
extra: None,