fix: gateway provider resolution and model config parity with CLI#42
Closed
VencentSoliman wants to merge 2 commits into
Closed
fix: gateway provider resolution and model config parity with CLI#42VencentSoliman wants to merge 2 commits into
VencentSoliman wants to merge 2 commits into
Conversation
The gateway was hardcoding OpenRouter as the LLM provider, ignoring the provider setting in config.yaml and Nous OAuth credentials. This brings the gateway in line with how the CLI resolves providers, models, and credentials. Changes: - Add provider resolution via resolve_provider() from hermes_cli.auth - Add _ensure_runtime_credentials() that re-reads .env and config.yaml per message (preserving hot-reload for long-lived gateway process) - Support Nous OAuth: refresh access tokens and mint agent keys - Fix model resolution to match CLI priority chain (HERMES_MODEL > LLM_MODEL > config.yaml model.default) - Pass api_key and base_url to both AIAgent call sites (main message handler + memory flush on reset) - Update /model command to use centralized self._model state
- Updated model configuration to prioritize environment variables and config file settings for better consistency. - Added functionality to persist model changes to both config.yaml and .env, aligning with CLI behavior. - Improved error handling during the saving process to ensure robustness.
Contributor
|
partially fixed in cbde854 going to close and add the remainder, added you as a coauthor to that commit so you are still a contributor now ^_^ thank you <3 |
Contributor
Author
😐 |
sudo-yf
pushed a commit
to sudo-yf/hermes-agent
that referenced
this pull request
Apr 5, 2026
…arkdown-update docs: comprehensive markdown update for v0.24
lex-assistant
suggested changes
May 17, 2026
lex-assistant
left a comment
There was a problem hiding this comment.
Review: PR #42
Verdict: Good direction, needs rebase + some polish
What is good
- Extracting credential/resolution logic into _ensure_runtime_credentials() is the right abstraction.
- Nous OAuth flow with agent key minting and TTL/timeout via env vars is solid.
- /model persistence writing to both config.yaml and .env mirrors CLI behavior.
- Fixing both call sites (_handle_reset_command and run_sync()) is correct.
Blocking issues
- Needs rebase: Branch is from Feb 26 with merge conflicts. ~20 commits to gateway/run.py since then. Commit cbde854 already added Nous auth inline in run_sync() — simpler form. Your approach is more comprehensive but needs careful rebase.
- Return value unchecked: _ensure_runtime_credentials() return value is ignored in both run_sync() and _handle_reset_command. If credential refresh fails, gateway proceeds with stale creds.
- Hardcoded Path.home(): Codebase is migrating to get_hermes_home() from hermes_constants.py. The inline config reads here should use it.
Non-blocking suggestions
- Move imports to module level if possible (or comment circular import concern).
- Consider logger.debug instead of logger.info for provider/model on init.
- Extract a shared helper for config.yaml read + model resolution to avoid duplication between init and _ensure_runtime_credentials.
Summary
This is a meaningful improvement over both the original hardcoded OpenRouter code and the minimal cbde854 partial fix. Needs rebase, return-value checks, and hardcoded path fix. Please rebase onto current main, resolve conflicts, and re-submit.
4 tasks
This was referenced Jun 9, 2026
jarvis-stark-ops
pushed a commit
to 1Team-Engineering/hermes-agent
that referenced
this pull request
Jun 10, 2026
Adds two new completion gates that fire alongside the Part 1/2 gates. Closes hermes-jarvis#63 (PR-existence verification) Closes hermes-jarvis#32 (doc-drift check) Context: hermes-jarvis#61 (bootstrap-paradox case study) ## NousResearch#63 — verify_pr_urls_exist When a verdict result or summary contains a GitHub PR URL pattern, the dispatcher runs `gh pr view <url> --json number` to verify each URL resolves. Phantom URLs (404 with "Not Found" / "Could not resolve" / "no pull request" in stderr) reject the completion. Indeterminate cases (gh missing, network error, unauthenticated) fall open — workers can still complete in offline / broken-gh envs without being trapped. Catches the 2026-06-09 Tchalla case (hermes-jarvis#61): release-gate reviewer blocked with "cannot run gh pr diff 42" on PR NousResearch#42 that didn't exist. With this gate, his completion would have surfaced the phantom URL specifically, prompting him to surface the real cause. Opt-out: `metadata.x_phantom_pr_ok` with ≥20-char string reason. ## NousResearch#32 — verify_doc_drift For tasks whose tenant slug encodes a version (`marvel-swarm-vN-N-test`), the gate scans `README.md` / `README` in the workspace for older `vX.Y` mentions outside a history-style heading (`## History`, `## Older versions`, `## Previous versions`, `## Archive`). Stale mentions reject the completion. CHANGELOG.md is intentionally skipped — older versions are expected there by definition. Catches the 2026-06-09 agent-dashboard PR #1 case (hermes-jarvis#61): README still said "v6.2 Marvel swarm test target" while the chain was v6.6. No reviewer flagged it. Opt-out: `metadata.x_doc_drift_ok` with ≥20-char string reason. ## Tests 19 new tests added to `test_kanban_completion_gates.py`: - TestPRExistence (8) — no PR URL skipped, real passes, phantom rejects, mixed real+phantom flags only phantom, indeterminate falls open, summary scanned, dedup, opt-out - TestDocDrift (10) — non-versioned tenant skips, no README skips, stale README rejects, current README passes, History section excused, CHANGELOG file excused, higher version not stale, scratch skipped, opt-out 83 passed in test_kanban_completion_gates.py (up from 64). Zero regressions on adjacent paths. Co-Authored-By: Claude Opus 4.7 (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
The gateway was hardcoding OpenRouter as the LLM provider, ignoring the
providersetting inconfig.yamland Nous OAuth credentials. This brings the gateway in line with how the CLI resolves providers, models, and credentials.resolve_provider()fromhermes_cli.auth, supporting both Nous OAuth and OpenRouter_ensure_runtime_credentials()that refreshes access tokens and mints agent keys before each AIAgent creationHERMES_MODEL>LLM_MODEL>config.yaml model.default).envandconfig.yamlper message (builds on 55a0178) so credential/config changes are picked up without gateway restart/reset/modelcommand: Now uses centralizedself._modelstate instead of env var👇 Thats a table (Summary of changes)
config.yamlprovider settingHERMES_MODELenv varHERMES_MODEL>LLM_MODEL>config.yamlapi_key/base_urlpassed/modelcommandself._modeldirectlyTest plan
provider: nousinconfig.yaml, verify gateway uses Nous inference endpointprovider: openrouter(or remove provider), verify gateway uses OpenRouterLLM_MODELin.envwithout restart, verify gateway picks it up on next message/modelcommand shows and changes the active model/resetcommand (memory flush agent uses correct provider)