Allow replacing dynamic tools between model steps (#57553)

## What changed

Add `CodexThread::replace_dynamic_tools` to replace the tool catalog without starting a turn. Updates apply to subsequent model steps and future turns while preserving in-flight calls; an empty list clears the catalog.

Require host opt-in through `allow_persistent_dynamic_tool_updates` for persistent threads. Persist replacements before publishing them, restore the latest catalog on resume, and preserve replacements and explicit clears through compaction. Keep explicit resume overrides separate from the persisted catalog.

## Testing

Add coverage for pending calls during replacement, replacement and clearing across restart, compaction recovery, resume overrides, submission ordering after caller cancellation, host opt-in, and persistence failures.

GitOrigin-RevId: fd2634906895a9b72ae7892ddd9435dced45eccb
This commit is contained in:
Steve Coffey
2026-10-27 19:50:41 +00:00
committed by copyberry
parent 0d6838318f
commit f088e0c4ff
50 changed files with 976 additions and 105 deletions
@@ -338,7 +338,8 @@ impl ThreadMetadataSync {
update.approval_mode = Some(settings.approval_policy);
update.permission_profile = Some(settings.permission_profile.clone());
}
RolloutItem::SessionMeta(_)
RolloutItem::DynamicToolsUpdated { .. }
| RolloutItem::SessionMeta(_)
| RolloutItem::EventMsg(_)
| RolloutItem::ResponseItem(_)
| RolloutItem::InterAgentCommunication(_)