fix(proxy): refresh takeover backup on hot-switch#295
Conversation
Refresh the restore backup from the selected provider during takeover hot-switches so disabling proxy restores the provider the user chose instead of the one active when takeover began.
|
@unive3sal Thanks for the fix. The direction makes sense, but I think this still needs one more pass before merge. The new backup refresh currently uses a two-way merge from the existing restore backup into the selected provider snapshot. That updates keys that exist in the selected provider, but it does not remove provider-owned keys that only existed on the previous provider. A concrete case:
After {
"env": {
"ANTHROPIC_API_KEY": "b-key",
"ANTHROPIC_BASE_URL": "https://a.example",
"LOCAL_ONLY": "kept"
}
}So disabling proxy would restore provider B's key mixed with provider A's base URL. That still leaves part of #292 unfixed. I think this needs a base-aware merge: base = previous selected provider snapshot, local = existing restore backup, incoming = newly selected provider snapshot. That would preserve local-only fields like Could you add a regression test for this case? The current tests cover overwriting shared keys and preserving local-only keys, but not removing stale provider-owned keys. |
Use the previous provider snapshot as the merge base when refreshing takeover restore backups so stale provider-owned keys are removed while local-only edits are preserved. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
LGTM, THANKS |
Refresh the restore backup from the selected provider during takeover hot-switches so disabling proxy restores the provider the user chose instead of the one active when takeover began.
Fixes #292