What I was trying to do
Remove or rotate one configured BYOK API key with hound keys remove while keeping another key for the same provider, relying on the existing runtime config refresh rather than restarting Hound.
Unexpected behavior
_refresh_pools() adds newly configured keys, but it does not remove individual keys that disappeared from the current configuration while the provider still has at least one key.
For example, after changing a Serper configuration from ["keep-key", "removed-key"] to ["keep-key"], the in-memory pool still contains both entries and can continue rotating to removed-key until the server restarts.
Minimal reproduction
_POOLS["serper"] = KeyPool(["keep-key", "removed-key"])
# load_byok_keys() now returns only {"serper": ["keep-key"]}
_refresh_pools()
assert _POOLS["serper"]._keys == ["keep-key"] # currently fails
Expected behavior
A refresh should reconcile pool membership and order with the current configuration, immediately remove deleted keys, preserve health/cooldown state for retained keys, and safely maintain rotation.
Environment
- Hound:
12.3.0
- Python:
3.12
- Linux
Proposed fix
I prepared a focused PR that reconciles existing pools without discarding retained-key state. Regression tests cover partial removal, reordered keys, removal around the rotation cursor, state preservation, and removal of an empty provider pool. The new BYOK lifecycle is a useful addition; this just makes key removal as dynamic as key addition.
What I was trying to do
Remove or rotate one configured BYOK API key with
hound keys removewhile keeping another key for the same provider, relying on the existing runtime config refresh rather than restarting Hound.Unexpected behavior
_refresh_pools()adds newly configured keys, but it does not remove individual keys that disappeared from the current configuration while the provider still has at least one key.For example, after changing a Serper configuration from
["keep-key", "removed-key"]to["keep-key"], the in-memory pool still contains both entries and can continue rotating toremoved-keyuntil the server restarts.Minimal reproduction
Expected behavior
A refresh should reconcile pool membership and order with the current configuration, immediately remove deleted keys, preserve health/cooldown state for retained keys, and safely maintain rotation.
Environment
12.3.03.12Proposed fix
I prepared a focused PR that reconciles existing pools without discarding retained-key state. Regression tests cover partial removal, reordered keys, removal around the rotation cursor, state preservation, and removal of an empty provider pool. The new BYOK lifecycle is a useful addition; this just makes key removal as dynamic as key addition.