RestoreModelOverride atomically restores the override to the value captured by `prev`, but only if the current override is still the one captured by `current` (pointer identity). If another caller has changed the override since `current` was captured, the restore is a no-op so that the concurrent ch
(prev, current ModelOverrideSnapshot)
| 265 | // scope (e.g. a skill sub-session) without clobbering changes made by |
| 266 | // concurrent callers such as the TUI model picker. |
| 267 | func (a *Agent) RestoreModelOverride(prev, current ModelOverrideSnapshot) { |
| 268 | if a.modelOverrides.CompareAndSwap(current.ptr, prev.ptr) { |
| 269 | slog.Debug("Restored model override", "agent", a.name) |
| 270 | } else { |
| 271 | slog.Debug("Model override changed concurrently; skipping restore", "agent", a.name) |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | // ConfiguredModels returns the originally configured models for this agent. |
| 276 | // This is useful for listing available models in the TUI picker. |