fix(gateway): boot-md hook inherits model/provider/api_mode from config.yaml#11069
Open
saamuelng601-pixel wants to merge 1 commit into
Open
fix(gateway): boot-md hook inherits model/provider/api_mode from config.yaml#11069saamuelng601-pixel wants to merge 1 commit into
saamuelng601-pixel wants to merge 1 commit into
Conversation
…ig.yaml When the boot-md hook spawns its one-shot AIAgent on gateway startup, it was passing only behavioral flags (quiet_mode, skip_context_files, skip_memory, max_iterations) and no model configuration. AIAgent.__init__ then fell back to its defaults: model="", provider="" (from None), api_mode=None. The api_mode resolution chain checks self.provider in order; with an empty provider, all elif branches fail and api_mode lands on "chat_completions". On an openai-codex setup that resolves base_url from state to https://chatgpt.com/backend-api/codex/, the agent then POSTs to /chat/completions — a route the Codex backend does not expose (only /responses exists on the ChatGPT-account tier). The backend replies HTTP 404 {"detail":"Not Found"} and the boot agent is aborted as a non-retryable client error. Fix: read ~/.hermes/config.yaml inside _run_boot_agent() and forward model/provider/api_mode (from the dict form) or model (from the legacy string form) to AIAgent so it picks the correct API adapter. This is the same configuration path every other AIAgent invocation already uses; only the boot hook was skipping it. Verified on a local install with model.default=gpt-5.4 via provider=openai-codex, api_mode=codex_responses: Before fix (session 20260416_220458_542285): body.model = "" url = https://chatgpt.com/backend-api/codex/chat/completions result = HTTP 404 Not Found, 0 messages exchanged After fix (session 20260416_221913_84a6bb): model = "gpt-5.4" url = https://chatgpt.com/backend-api/codex/responses result = 14 messages exchanged, boot checklist completed No behavioral change for users who configure model as a plain string (the legacy shape is handled explicitly).
Collaborator
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
The built-in
boot-mdhook (gateway/builtin_hooks/boot_md.py) spawns a one-shotAIAgenton gateway startup without forwarding the user's model configuration.AIAgent.__init__then falls back to defaults (model="",provider="",api_mode=None), the api_mode resolution chain pickschat_completions, and on anopenai-codexsetup the boot agent POSTs tochatgpt.com/backend-api/codex/chat/completions— a route the Codex backend does not expose. The backend repliesHTTP 404 {"detail":"Not Found"}and the boot checklist is aborted before anything runs.This is the only
AIAgentcall in the codebase that skips the standard model-config plumbing — every other caller passes it in explicitly.Fix
Load
~/.hermes/config.yamlviahermes_cli.config.load_config()inside_run_boot_agent()and forwardmodel/provider/api_modetoAIAgent. Both the current dict shape (model: {default, provider, api_mode}) and the legacy string shape (model: "...") are handled explicitly, matching howruntime_provider.pyandweb_server.pyalready read the config.Repro + verification
On a local install configured with:
Before fix — session
20260416_220458_542285:https://chatgpt.com/backend-api/codex/chat/completionsbody.model:""HTTP 404 {"detail":"Not Found"}— boot agent exits immediately, 0 messages exchangedAfter fix — session
20260416_221913_84a6bb:model:"gpt-5.4"/responsesTest plan
AIAgentconfig path)openai-codex+ non-emptyBOOT.mdand confirm noNon-retryable client error: 404in~/.hermes/logs/errors.log