SIGN IN SIGN UP

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
O
Owen Lin committed
37f4bb94c9f4e180535a12e3f2c2f93f4a773df0
Parent: 98ee29c
Committed by copyberry <copyberry@app.openai.com> on 8/26/2026, 4:23:06 AM