Skip to content

fix: preserve discover_models in _normalize_custom_provider_entry#26766

Closed
darvsum wants to merge 1 commit into
NousResearch:mainfrom
darvsum:fix/discover-models-normalize
Closed

fix: preserve discover_models in _normalize_custom_provider_entry#26766
darvsum wants to merge 1 commit into
NousResearch:mainfrom
darvsum:fix/discover-models-normalize

Conversation

@darvsum

@darvsum darvsum commented May 16, 2026

Copy link
Copy Markdown
Contributor

Problem

/api/model/options takes ~24s when custom_providers include unreachable endpoints with discover_models: false.

Root Cause

_normalize_custom_provider_entry() (hermes_cli/config.py) has two bugs:

  1. discover_models is not in _KNOWN_KEYS, so it is logged as an unknown key and discarded.
  2. The function builds the normalized dict by explicitly copying known fields — even without the warning, discover_models is never carried through to the output.

Downstream, model_switch.py calls entry.get("discover_models", True) and gets the default True, triggering /models HTTP probes on every custom_provider endpoint. Unreachable endpoints each timeout ~6s; with 4 such endpoints the total is ~24s.

Fix

  1. Add "discover_models" to _KNOWN_KEYS (suppresses the unknown-key warning).
  2. Copy discover_models into the normalized dict when present and boolean.

Result

/api/model/options response time: 24.5s → 0.4s

The _normalize_custom_provider_entry() function was dropping the
discover_models field from custom_provider entries because:

1. It was not listed in _KNOWN_KEYS, so it was logged as an
   unknown key and ignored.
2. The function builds the normalized dict by explicitly copying
   known fields, so even if the warning was suppressed, the value
   was not carried through.

This caused downstream model_switch.py to default discover_models
to True, triggering /models HTTP probes on unreachable endpoints.
With 4 unreachable internal endpoints at ~6s timeout each, the
/api/model/options endpoint took ~24s instead of <1s.
@darvsum darvsum force-pushed the fix/discover-models-normalize branch from d76fcb0 to 452d624 Compare May 16, 2026 05:22
@alt-glitch alt-glitch added type/perf Performance improvement or optimization P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles labels May 16, 2026
teknium1 added a commit that referenced this pull request May 17, 2026
…tors

Adds release-note attribution mappings for 9 contributors from group 3:
- @darvsum (PR #26766)
- @hueilau (PR #26498)
- @Timur00Kh (PR #27114)
- @Grogger (PR #27061)
- @lemassykoi (PR #27042)
- @draplater (PR #26707)
- @pr7426 (PR #27048)
- @therahul-yo (PR #26215)
- @flamiinngo (PR #27205)

#27154 dropped from this batch — already landed on main as 4e9cedc.
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #27302 — your commit was cherry-picked onto current main as part of a batch salvage of low-risk new-contributor PRs. Authorship preserved (fix: preserve discover_models in _normalize_custom_provider_entry). Thanks for the contribution.

@teknium1 teknium1 closed this May 17, 2026
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/perf Performance improvement or optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants