Default durable threads to paginated history (#40677)

## What changed

When `thread/start` omits `historyMode`, select `paginated` for durable
threads whose store supports `thread/turns/list` and `thread/items/list`.
Continue to default ephemeral threads and threads backed by stores without
those APIs to `legacy`.

Explicit `legacy` and `paginated` selections keep their existing behavior.

## Testing

- Verify durable threads use paginated history with the local store.
- Verify ephemeral threads and stores without history-list support use legacy
  history.

GitOrigin-RevId: c94b6a3b522049d541da33c41618c4142370f1a7
This commit is contained in:
Owen Lin
2026-08-25 19:10:35 +00:00
committed by copyberry
parent d132b69219
commit 17c4c47dfa
11 changed files with 58 additions and 6 deletions
@@ -1415,6 +1415,10 @@ impl ThreadRequestProcessor {
DynamicToolSpec::Namespace(namespace) => namespace.tools.len(),
})
.sum();
let history_mode = history_mode.or_else(|| {
(!config.ephemeral && thread_store.supports_paginated_history_lists())
.then_some(ThreadHistoryMode::Paginated)
});
let mut thread_extension_init = ExtensionDataInit::new();
if !selected_capability_roots.is_empty() {
thread_extension_init.insert(selected_capability_roots);