Files
hermes-agent/agent
teknium1 ff1f5d425a fix(agent): scope auxiliary client eviction to the calling profile and stop closing in-flight clients
Two review findings on the re-armed _evict_cached_clients:

1. It matched on the provider slot only and ignored the leading hermes_home_key() slot, so an
   OAuth rotation/refresh in profile A also dropped (and closed) profile B's cached client for
   the same provider in a multiplexing gateway, although B's per-profile credentials did not
   change. Callers all run inside the rotating profile's scope, so filter on key[0] too.

2. It closed the shared client inline. A concurrent caller mid-request on the same cached
   client (the normal cache-hit case for parallel compressions) got ReadError, and any caller
   still holding it got "Cannot send a request, as the client has been closed" - the exact
   hazard the #113022 reporter cited for NOT enabling eviction. Pop the entry instead and let
   the dropped client retire via GC, as the FIFO overflow path in _get_cached_client already
   does; the next call builds a fresh client from the rotated credentials.

Part of #113022
2026-09-16 16:51:06 -07:00
..
…
…
…