fix(model_metadata): add HERMES_DISABLE_MODEL_METADATA and tighter timeout - #46685
Closed
vanthinh6886 wants to merge 1 commit into
Closed
fix(model_metadata): add HERMES_DISABLE_MODEL_METADATA and tighter timeout#46685vanthinh6886 wants to merge 1 commit into
vanthinh6886 wants to merge 1 commit into
Conversation
…meout Gate fetch_model_metadata() behind HERMES_DISABLE_MODEL_METADATA env var so air-gapped/proxied deployments can skip the OpenRouter fetch entirely. Also change timeout=10 to timeout=(5, 10) to fail fast on connect when the endpoint is unreachable through a proxy. Fixes NousResearch#46620
Collaborator
|
Related: fix PR for #46620. |
Contributor
|
Verified. Clean and well-scoped:
No issues found. |
Contributor
|
Thanks for the fix, @vanthinh6886 — and for the accurate diagnosis of the startup-hang root cause. Closing as already fixed on
Together that eliminates the 7-minute proxy hang without needing to disable anything. On the two changes here specifically:
If you can still reproduce a startup hang on current |
kshitijk4poor
pushed a commit
that referenced
this pull request
Jul 9, 2026
… on banner _cli's show_banner() calls _resolve_active_context_length() at every startup. For non-OpenRouter providers (e.g. minimax-cn, kimi-coding, custom endpoints) the resolver falls through to step 6 (OpenRouter live /models fetch), which blocks ~2-3s per CLI launch and adds up to 7+ minutes when openrouter.ai is unreachable through a proxy that 403s CONNECT (#46620). Two complementary changes: 1. model_tools.py: read model.context_length from config.yaml and pass it as config_context_length to get_model_context_length. The step-0 config override short-circuits the entire resolution chain including the OpenRouter fetch. No network call is made when the user has set the value explicitly. 2. agent/model_metadata.py: replace flat timeout=10 with (5, 10) tuple at all five sites (fetch_model_metadata + four endpoint probes). urllib3 can otherwise block for 10s per retry stage through proxies that 403 CONNECT. The tuple bounds connect at 5s while still allowing slow reads. Complements the in-flight PR #46685 (which adds HERMES_DISABLE_MODEL_METADATA env var + same timeout tuple change for fetch_model_metadata). This PR extends the timeout fix to the other four endpoint probes and adds the config-override path that addresses the slow-but-reachable scenario where env-var disable is too heavy-handed. Refs #46620, PR #46685. (cherry picked from commit e7faa34)
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
… on banner _cli's show_banner() calls _resolve_active_context_length() at every startup. For non-OpenRouter providers (e.g. minimax-cn, kimi-coding, custom endpoints) the resolver falls through to step 6 (OpenRouter live /models fetch), which blocks ~2-3s per CLI launch and adds up to 7+ minutes when openrouter.ai is unreachable through a proxy that 403s CONNECT (NousResearch#46620). Two complementary changes: 1. model_tools.py: read model.context_length from config.yaml and pass it as config_context_length to get_model_context_length. The step-0 config override short-circuits the entire resolution chain including the OpenRouter fetch. No network call is made when the user has set the value explicitly. 2. agent/model_metadata.py: replace flat timeout=10 with (5, 10) tuple at all five sites (fetch_model_metadata + four endpoint probes). urllib3 can otherwise block for 10s per retry stage through proxies that 403 CONNECT. The tuple bounds connect at 5s while still allowing slow reads. Complements the in-flight PR NousResearch#46685 (which adds HERMES_DISABLE_MODEL_METADATA env var + same timeout tuple change for fetch_model_metadata). This PR extends the timeout fix to the other four endpoint probes and adds the config-override path that addresses the slow-but-reachable scenario where env-var disable is too heavy-handed. Refs NousResearch#46620, PR NousResearch#46685. (cherry picked from commit e7faa34)
justemu
pushed a commit
to justemu/hermes-agent
that referenced
this pull request
Jul 18, 2026
… on banner _cli's show_banner() calls _resolve_active_context_length() at every startup. For non-OpenRouter providers (e.g. minimax-cn, kimi-coding, custom endpoints) the resolver falls through to step 6 (OpenRouter live /models fetch), which blocks ~2-3s per CLI launch and adds up to 7+ minutes when openrouter.ai is unreachable through a proxy that 403s CONNECT (NousResearch#46620). Two complementary changes: 1. model_tools.py: read model.context_length from config.yaml and pass it as config_context_length to get_model_context_length. The step-0 config override short-circuits the entire resolution chain including the OpenRouter fetch. No network call is made when the user has set the value explicitly. 2. agent/model_metadata.py: replace flat timeout=10 with (5, 10) tuple at all five sites (fetch_model_metadata + four endpoint probes). urllib3 can otherwise block for 10s per retry stage through proxies that 403 CONNECT. The tuple bounds connect at 5s while still allowing slow reads. Complements the in-flight PR NousResearch#46685 (which adds HERMES_DISABLE_MODEL_METADATA env var + same timeout tuple change for fetch_model_metadata). This PR extends the timeout fix to the other four endpoint probes and adds the config-override path that addresses the slow-but-reachable scenario where env-var disable is too heavy-handed. Refs NousResearch#46620, PR NousResearch#46685. (cherry picked from commit e7faa34)
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
… on banner _cli's show_banner() calls _resolve_active_context_length() at every startup. For non-OpenRouter providers (e.g. minimax-cn, kimi-coding, custom endpoints) the resolver falls through to step 6 (OpenRouter live /models fetch), which blocks ~2-3s per CLI launch and adds up to 7+ minutes when openrouter.ai is unreachable through a proxy that 403s CONNECT (NousResearch#46620). Two complementary changes: 1. model_tools.py: read model.context_length from config.yaml and pass it as config_context_length to get_model_context_length. The step-0 config override short-circuits the entire resolution chain including the OpenRouter fetch. No network call is made when the user has set the value explicitly. 2. agent/model_metadata.py: replace flat timeout=10 with (5, 10) tuple at all five sites (fetch_model_metadata + four endpoint probes). urllib3 can otherwise block for 10s per retry stage through proxies that 403 CONNECT. The tuple bounds connect at 5s while still allowing slow reads. Complements the in-flight PR NousResearch#46685 (which adds HERMES_DISABLE_MODEL_METADATA env var + same timeout tuple change for fetch_model_metadata). This PR extends the timeout fix to the other four endpoint probes and adds the config-override path that addresses the slow-but-reachable scenario where env-var disable is too heavy-handed. Refs NousResearch#46620, PR NousResearch#46685. (cherry picked from commit e7faa34)
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
… on banner _cli's show_banner() calls _resolve_active_context_length() at every startup. For non-OpenRouter providers (e.g. minimax-cn, kimi-coding, custom endpoints) the resolver falls through to step 6 (OpenRouter live /models fetch), which blocks ~2-3s per CLI launch and adds up to 7+ minutes when openrouter.ai is unreachable through a proxy that 403s CONNECT (NousResearch#46620). Two complementary changes: 1. model_tools.py: read model.context_length from config.yaml and pass it as config_context_length to get_model_context_length. The step-0 config override short-circuits the entire resolution chain including the OpenRouter fetch. No network call is made when the user has set the value explicitly. 2. agent/model_metadata.py: replace flat timeout=10 with (5, 10) tuple at all five sites (fetch_model_metadata + four endpoint probes). urllib3 can otherwise block for 10s per retry stage through proxies that 403 CONNECT. The tuple bounds connect at 5s while still allowing slow reads. Complements the in-flight PR NousResearch#46685 (which adds HERMES_DISABLE_MODEL_METADATA env var + same timeout tuple change for fetch_model_metadata). This PR extends the timeout fix to the other four endpoint probes and adds the config-override path that addresses the slow-but-reachable scenario where env-var disable is too heavy-handed. Refs NousResearch#46620, PR NousResearch#46685. (cherry picked from commit e7faa34)
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
… on banner _cli's show_banner() calls _resolve_active_context_length() at every startup. For non-OpenRouter providers (e.g. minimax-cn, kimi-coding, custom endpoints) the resolver falls through to step 6 (OpenRouter live /models fetch), which blocks ~2-3s per CLI launch and adds up to 7+ minutes when openrouter.ai is unreachable through a proxy that 403s CONNECT (NousResearch#46620). Two complementary changes: 1. model_tools.py: read model.context_length from config.yaml and pass it as config_context_length to get_model_context_length. The step-0 config override short-circuits the entire resolution chain including the OpenRouter fetch. No network call is made when the user has set the value explicitly. 2. agent/model_metadata.py: replace flat timeout=10 with (5, 10) tuple at all five sites (fetch_model_metadata + four endpoint probes). urllib3 can otherwise block for 10s per retry stage through proxies that 403 CONNECT. The tuple bounds connect at 5s while still allowing slow reads. Complements the in-flight PR NousResearch#46685 (which adds HERMES_DISABLE_MODEL_METADATA env var + same timeout tuple change for fetch_model_metadata). This PR extends the timeout fix to the other four endpoint probes and adds the config-override path that addresses the slow-but-reachable scenario where env-var disable is too heavy-handed. Refs NousResearch#46620, PR NousResearch#46685. (cherry picked from commit e7faa34)
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.
Fixes #46620
Problem
fetch_model_metadata()usestimeout=10(single int) which sets both connect and read timeout to 10s. Through a corporate HTTP proxy that returns 403 on CONNECT toopenrouter.ai, urllib3 can retry/block for 7+ minutes, preventing the gateway from reachingstart_polling.Changes
HERMES_DISABLE_MODEL_METADATAenv var — allows completely skipping the OpenRouter metadata fetch. Useful for air-gapped/proxied deployments whereopenrouter.aiis unreachable. Returns cached data (memory or disk) if available, otherwise empty dict.Tuple timeout
(5, 10)— 5s connect timeout, 10s read timeout. Fails fast when the endpoint is unreachable through a proxy, instead of allowing urllib3 to block for the full 10s per retry stage.Testing
HERMES_DISABLE_MODEL_METADATA=1and verify gateway starts without hanging