Restore thread cwd from owned settings snapshots (#41567)

## Why

Resuming a thread without an explicit `cwd` should restore that thread's latest
retained setting. Forked history can contain settings copied from another
thread, while compaction can move the latest setting outside the replay window.

## What changed

- Record the owning thread ID on new settings snapshots and only use snapshots
  owned by the resumed thread when restoring `cwd`. Older snapshots without an
  owner remain readable but do not override the startup `cwd`.
- Checkpoint the current settings after compaction and serialize checkpoints
  with settings updates so the retained history contains an accepted, current
  snapshot.
- Cover resume behavior across compaction, forks, reverts, legacy histories,
  and concurrent settings updates.

GitOrigin-RevId: 1efc9cf55472d6b88c465c4efe44672a232dbf64
This commit is contained in:
rhan-oai authored and copyberry committed 2026-08-29 19:57:06 +00:00
1 parent 4210c08def
commit f5636bb733
20 files changed
+462 -35

No files matched your search

+5
View File
@@ -129,6 +129,11 @@ impl PreparedTurnInputSettings {
cyber_access_program,
} = self.start_options;
let emit_thread_settings_applied = self.thread_settings_update.is_some();
let _settings_guard = if emit_thread_settings_applied {
Some(thread_settings::acquire_persistence_lock(session).await)
} else {
None
};
let mut updates = self.thread_settings_update.unwrap_or_default();
updates.service_tier_for_turn = service_tier;