Skip to content

fix(providers): honor named custom timeout settings - #74099

Closed
okbexx wants to merge 1 commit into
NousResearch:mainfrom
okbexx:fix/custom-provider-timeout-resolution
Closed

okbexx wants to merge 1 commit into
NousResearch:mainfrom
okbexx:fix/custom-provider-timeout-resolution

Conversation

@okbexx

@okbexx okbexx commented Jul 29, 2026 •

Copy link
Copy Markdown

Summary

  • preserve the requested provider identity when a named custom provider canonicalizes to the runtime custom transport
  • resolve request and stale timeouts from the named route first, with case-insensitive provider IDs and normalized display-name aliases and providers.custom retained as a fallback
  • apply the same identity across initialization, streaming/non-streaming calls, model switching, credential refresh, primary recovery, API/ACP, TUI/background, delegation, curator, and platform fork entry points

Root cause

Named custom providers intentionally resolve to provider="custom" at runtime. Timeout lookup used only that canonical runtime ID, so settings under providers.<named-route> were skipped and the generic stale watchdog default was used instead. Several secondary AIAgent construction paths also dropped the already-resolved requested_provider identity.

Tests

  • added an integration regression covering AIAgent(provider="custom", requested_provider="custom:sub2api")
  • added identity-propagation assertions for TUI/background, ACP, and API Server agent construction
  • 266 targeted tests passed across 12 current test files after rebasing onto the pruned main suite covering timeout resolution, stale watchdogs, custom-provider switching, fallback, rollback, credential-pool recovery, background review, curator, TUI, ACP, API Server, delegation, and Feishu comment agents
  • full AST/manual audit covers explicit and **kwargs AIAgent construction paths
  • Ruff, bytecode compilation, and git diff --check passed

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles needs-decision Awaiting maintainer decision before any implementation sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 29, 2026
@alt-glitch

Copy link
Copy Markdown

This was generated by AI during triage.

Related: #34078, #33153, and #28869. #74099 preserves and prioritizes requested custom:<name> config keys, with bare-name and providers.custom fallbacks, across more runtime paths. #34078 forwards the requested route but resolves it to a bare config key. This is a config-contract choice, so these are related competing repairs rather than duplicates.

@okbexx
okbexx force-pushed the fix/custom-provider-timeout-resolution branch 3 times, most recently from bf9ca8a to da15bb5 Compare July 29, 2026 14:01
@okbexx

okbexx commented Jul 29, 2026 •

Copy link
Copy Markdown
Author

Thanks for surfacing #34078, #33153, and #28869. The config contract intended by this PR is deliberately backward-compatible:

  1. Preserve the original requested route identity when a named custom provider canonicalizes to the runtime custom transport.
  2. Resolve timeouts in this order: the requested providers.custom:<name> route, the equivalent bare/normalized provider key or display-name alias, then the existing providers.custom block as the fallback.
  3. Keep model-level timeout overrides ahead of provider-level values at each matched route.

The distinction from #34078 is that this PR does not collapse the config contract to bare keys only. Hermes runtime routing already accepts named custom routes, normalized provider keys, and display name aliases, so timeout resolution follows that same identity contract while retaining providers.custom behavior for existing configurations.

The identity is also preserved through the secondary AIAgent construction paths (TUI/Desktop background and preview agents, ACP, API Server, CLI background, delegation, curator/background review, credential refresh, model switching, and primary recovery), rather than fixing only the main CLI/gateway path.

Current verification after rebasing onto main 240afd0b7 (which pruned the old suite): 266 targeted tests across 12 surviving files, including direct AIAgent(provider="custom", requested_provider="custom:<name>"), mixed-case keys, display-name aliases, fallback/model-switch/recovery, and surface-specific propagation tests. Ruff, bytecode compilation, and git diff --check pass.

I’m happy to narrow or rebase this onto whichever config contract maintainers choose, but wanted to make the compatibility intent explicit.

@okbexx
okbexx force-pushed the fix/custom-provider-timeout-resolution branch from da15bb5 to 542ce1f Compare July 30, 2026 01:02
@teknium1

Copy link
Copy Markdown
Collaborator

Thanks for the focused compatibility repair. The premise is verified on current main: named custom routes are canonicalized to runtime provider custom in hermes_cli/runtime_provider.py:1130, while timeout lookup reads only providers[provider_id] in hermes_cli/timeouts.py:27-40; active request/stale paths therefore miss named-route settings at run_agent.py:1358 and run_agent.py:1381.

The PR's route-first candidate lookup (hermes_cli/timeouts.py:14-95) preserves the requested identity before falling back to providers.custom, and its propagation changes cover the affected initialization, request, recovery, and secondary-agent construction paths. The added timeout regression test covers the canonicalized runtime identity and model-level request/stale precedence.

No blocking issue found in this read-only review. This is an automated hermes-sweeper review.

@teknium1 teknium1 added the sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform label Jul 30, 2026
@alt-glitch alt-glitch added comp/gateway Gateway runner, session dispatch, delivery comp/acp Agent Communication Protocol adapter comp/plugins Plugin system and bundled plugins comp/tui Terminal UI (ui-tui/ + tui_gateway/) platform/feishu Feishu / Lark adapter tool/delegate Subagent delegation labels Jul 31, 2026
@GottZ

GottZ commented Aug 3, 2026

Copy link
Copy Markdown

This was generated by AI during triage.

Summary

Seven open PRs address or reference this issue complex: #33153, #34078, and #74099 directly repair named-custom-provider timeout lookup, while #33466, #38644, #57194, and #62326 change adjacent timeout or streaming controls without repairing the same identity-loss cause. The direct fixes differ materially: #33153 infers identity from static config, #34078 propagates the runtime-requested provider but uses bare-key resolution, and #74099 propagates that identity across more construction paths with route-first alias and fallback lookup.

Related pull requests

Suggested consolidation

Keep #74099 open with the concrete salvage path of retaining its route-first alias/fallback lookup, broad identity propagation, and integration coverage while explicitly reconciling the config-key contract with #34078. Preserve #34078 as the recorded best-fix candidate but require author action to rebase onto main and complete the contributor-requested timeout paths and entrypoint tests; #33153 should likewise remain open only for a revised runtime-identity approach, and #33466, #38644, #57194, and #62326 should be triaged separately because their diffs address distinct timeout or streaming features, leaving no evidence-backed duplicate closures in this set.

Cross-PR triage: Reviewed 7 pull requests and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 149 kB of PR diffs, 22 kB of issue/PR text, 16 kB of discussion (13 comments), 3 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

@okbexx
okbexx force-pushed the fix/custom-provider-timeout-resolution branch from 542ce1f to 2c8dfd3 Compare August 16, 2026 08:21
@alt-glitch alt-glitch removed the needs-decision Awaiting maintainer decision before any implementation label Aug 16, 2026

Copy link
Copy Markdown

Production validation from a multi-profile Hermes deployment:

  • Reproduced the named custom-provider timeout identity bug on Hermes Agent v0.20.3, where a configured named route was normalized to runtime provider custom and the provider-specific timeout setting was not honored.
  • A focused local repair preserving the requested named-provider identity fixed the observed behavior.
  • Upgraded the deployment to current v0.20.5 / main at 7a54ab22.
  • The local repair cherry-picked cleanly onto that current main generation with no conflicts.
  • Targeted regression test: tests/hermes_cli/test_timeouts.py → 3/3 passed.
  • Seven systemd-managed profile gateways plus the remote Desktop backend were restarted successfully on the patched v0.20.5 checkout.

This is additional real-world evidence that the requested named-provider identity needs to survive canonicalization to the runtime custom transport for timeout lookup, and that this fix remains relevant on the current release generation.

For clarity, I’m not opening a competing PR here because #74099 already addresses the same root cause more comprehensively; I wanted to add production validation from a current multi-profile deployment.

@alt-glitch alt-glitch removed the sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform label Aug 23, 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/acp Agent Communication Protocol adapter comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have platform/feishu Feishu / Lark adapter sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades tool/delegate Subagent delegation type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants