fix(auxiliary): rebuild closed cached sync clients - #39023
Closed
alex107ivanov wants to merge 1 commit into
Closed
alex107ivanov wants to merge 1 commit into
alex107ivanov wants to merge 1 commit into
Conversation
alex107ivanov
force-pushed
the
fix/auxiliary-evict-closed-sync-client
branch
from
June 6, 2026 10:28
879f9c9 to
e390bd2
Compare
Author
|
Closing this PR as superseded by #39790. The replacement PR has been rebased onto current upstream |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Evicts cached auxiliary clients whose underlying sync HTTP transport is already closed before reusing them. Without this guard, a closed cached sync client can be returned from
_get_cached_client, causing follow-up auxiliary calls to keep failing until process restart instead of rebuilding the provider client.Related Issue
Related to auxiliary client cache/transport lifecycle fixes; no dedicated issue found for this exact closed-sync-cache-hit path.
Type of Change
Changes Made
_client_is_closed()inagent/auxiliary_client.pyto detect cached clients or wrapped clients whose transport exposesis_closed is True._get_cached_client()to evict closed cached clients and rebuild them instead of returning them.tests/agent/test_auxiliary_client.pyproving a closed cached sync client is replaced with a fresh client.How to Test
PYTHONPATH=$PWD /workspace/repos/hermes-agent/.venv/bin/python -m pytest tests/agent/test_auxiliary_client.py::TestAuxiliaryClientPoisonedCacheEviction -q -o 'addopts='PYTHONPATH=$PWD /workspace/repos/hermes-agent/.venv/bin/python -m pytest tests/agent/test_auxiliary_client.py -q -o 'addopts='ln -sfn /workspace/repos/hermes-agent/.venv .venv && scripts/run_tests.sh tests/agent/test_auxiliary_client.py && rm -f .venvPYTHONPATH=$PWD /workspace/repos/hermes-agent/.venv/bin/python -m py_compile agent/auxiliary_client.py tests/agent/test_auxiliary_client.pyscripts/run_tests.shwas attempted in this environment but timed out after 10 minutes, with failures observed in unrelated CLI/gateway systemd tests before timeout.Checklist
Code
fix(auxiliary): ...)pytest tests/ -qand all tests pass (full suite attempted; blocked/timed out as noted above)Documentation & Housekeeping
docs/, docstrings) — N/A, internal cache lifecycle fix with no user-facing behavior/config changecli-config.yaml.exampleif I added/changed config keys — N/A, no config keys changedCONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/A, no contributor workflow changesScreenshots / Logs
Targeted regression failed before the fix on upstream main:
After the fix: