Respect paginated history when stopping background tasks (#40787)

## Why

Stopping a task from the agents overview may need to look up its active turn. Paginated threads should use the turn history endpoint instead of requesting embedded full history.

## What changed

- Read the thread without turns first to determine its history mode.
- Fetch the first turn page for paginated threads when the app server supports it.
- Fall back to embedded turn history for legacy threads and legacy server negotiation.

## Testing

Added coverage for paginated and legacy threads, including fallback after legacy capability negotiation.

GitOrigin-RevId: 44d506b19e32c6b3c27fac11fb748c23b8e47b5e
This commit is contained in:
Owen Lin authored and copyberry committed 2026-08-26 04:23:06 +00:00
1 parent 98ee29c7cd
commit 37f4bb94c9
3 files changed
+118 -8

No files matched your search

+4
View File
@@ -652,6 +652,10 @@ impl AppServerSession {
self.managed_new_thread_defaults.as_ref()
}
pub(crate) fn supports_paginated_history(&self) -> bool {
self.history_support == ThreadHistorySupport::Paginated
}
/// Fetches the current account info without refreshing the auth token.
///
/// Used by both `bootstrap` (to populate the initial UI) and `get_login_status`