fix(hermes): wire config.yaml through to AIAgent + fix client is_closed false positive#809
Merged
fix(hermes): wire config.yaml through to AIAgent + fix client is_closed false positive#809
Conversation
Contributor
ApprovabilityVerdict: Needs human review This PR wires provider_routing, fallback_model, and reasoning_config from config.yaml through to AIAgent, enabling configuration-driven provider selection that wasn't previously active. Additionally, it changes Docker dependency installation from You can customize Macroscope's approvability policy. Learn more. |
…ed false positive AgentRunner bypassed several config.yaml sections that the upstream Hermes gateway/cli properly pass to AIAgent: - provider_routing (only, ignore, order, sort, require_parameters, data_collection) - fallback_providers / fallback_model - agent.reasoning_effort This meant our provider_routing.only restriction was dead config — OpenRouter could route to any provider. Also monkey-patches _is_openai_client_closed to fix an upstream bug where openai SDK's is_closed (a method) is checked via bool(getattr(client, "is_closed", False)) — the bound method is always truthy, so every API call falsely detects the shared client as closed and recreates it, adding ~2 unnecessary TCP+TLS round trips per call. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ith upstream PR
- Use (cfg.get("agent") or {}) to handle null values so the
HERMES_REASONING_EFFORT env var fallback still works
- Align monkey-patch with the version submitted upstream
(NousResearch/hermes-agent#4378)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
e979c19 to
760c713
Compare
.[all] installs every optional dependency (Matrix, Telegram, Discord, Slack, SMS, DingTalk, voice, Modal, etc.) — most of which we don't use. The matrix extra in particular requires python-olm which needs cmake and C++ compilation, breaking local dev on macOS. Install only the extras we actually use: cron, honcho, mcp, pty. Applied to both Dockerfile and install-deps.sh. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
760c713 to
15f8e20
Compare
We don't use honcho and just removed the dependency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
staticmethod descriptor assigned to an instance attribute isn't callable — would raise TypeError at runtime. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
AgentRunnerwas creatingAIAgentwithout passingprovider_routing,fallback_model, orreasoning_configfrom config.yaml. The upstream gateway and CLI both read these sections and pass them through — we were silently ignoring them. This meantprovider_routing.onlywas dead config and OpenRouter could route to any provider._is_openai_client_closedto fix an upstream bug (reported at [Bug]: _is_openai_client_closed false positive — openai SDK is_closed is a method, not a property NousResearch/hermes-agent#4377) where the openai SDK'sis_closedmethod is checked viabool(getattr(client, "is_closed", False)). Sinceis_closedis a method (not a property), the bound method object is always truthy — every API call falsely detects the shared client as closed and recreates it, adding ~2 unnecessary TCP+TLS round trips per call.Why
Investigating slow API call latency. Two root causes found:
🤖 Generated with Claude Code
Note
Wire
config.yamlintoAIAgentand fixis_closedfalse positive inAgentRunnerAgentRunner._create_agentnow loadsHERMES_HOME/config.yamland passes provider routing options (only/ignore/order/sort/require_parameters/data_collection), fallback model, and reasoning config into theAIAgentconstructor._is_openai_client_closedto handle cases whereis_closedis a bound method (not a bool), inspect the underlyinghttp_client._client.is_closed, and correctly handleunittest.mock.Mockinstances.[all]to[cron,mcp,pty,homeassistant]in both the Dockerfile and install-deps.sh, removing unintended optional dependencies from the image.honcho_session_keyis no longer passed toAIAgent.Macroscope summarized 73d6c8a.