c454d32feb
_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 e7faa34199f553d2b1d30c4009856a983cc87707)