Start rollout migration after runtime feature enablement (#40668)

## Why

App-server clients can enable `background_paginated_rollout_migration` after the server has started, so the startup-only migration path does not handle that transition.

## What changed

- Allow runtime enablement of `background_paginated_rollout_migration`.
- Start the local rollout migration when the feature transitions from disabled to enabled at runtime.

## Testing

Update the app-server integration test to enable migration through the runtime feature API, wait for paginated history, and verify that cold resume preserves model context.

GitOrigin-RevId: d695624a03b4f056be94fcaac2075f91896f19e5
This commit is contained in:
Owen Lin authored and copyberry committed 2026-08-25 18:14:32 +00:00
1 parent 538900ee76
commit 45288d994d
3 files changed
+76 -30

No files matched your search

+21
View File
@@ -664,6 +664,27 @@ impl ThreadManager {
self.state.environment_manager.clone()
}
/// Starts the local rollout migration path after a runtime feature enablement.
///
/// Startup config handles the initial launch in [`thread_store_from_config`]. This covers
/// clients that decide to enable background migration after constructing the app-server.
pub fn start_background_rollout_migration(&self) {
let Some(store) = self
.state
.thread_store
.as_any()
.downcast_ref::<LocalThreadStore>()
else {
return;
};
let store = store.clone();
tokio::spawn(async move {
if let Err(err) = store.migrate_rollouts_on_startup().await {
warn!("failed to migrate legacy rollouts on startup: {err}");
}
});
}
/// Refreshes every loaded thread and marks threads that are still being created.
pub async fn invalidate_mcp_runtimes(&self) {
self.invalidate_starting_mcp_runtimes();