hermes - ✅(Solved) Fix Auxiliary tasks (compression, title generation) ignore custom base_url for named providers [1 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#16719Fetched 2026-04-28 06:51:19
View on GitHub
Comments
2
Participants
2
Timeline
8
Reactions
0
Author
Timeline (top)
labeled ×4commented ×2closed ×1cross-referenced ×1

Root Cause

Two interrelated issues in resolve_provider_client() (agent/auxiliary_client.py):

Fix Action

Workaround

Setting provider: auto for auxiliary tasks avoids the PROVIDER_REGISTRY path:

auxiliary:
  compression:
    provider: auto
  title_generation:
    provider: auto

This relies on _resolve_auto() which has a workaround re-routing to provider: custom.

PR fix notes

PR #16819: fix(auxiliary): custom provider URL rewrite + main_runtime model for title gen

Description (problem / solution / changelog)

Summary

Auxiliary client improvements, rebased cleanly on upstream/main:

Changes

  1. agent/auxiliary_client.py:

    • Apply _to_openai_base_url() to custom provider base_url (fixes /anthropic → /v1 rewrite missing for provider="custom")
    • Use main_runtime.get("model") instead of _read_main_model() so auxiliary tasks follow system default model changes
  2. agent/title_generator.py: Thread main_runtime through generate_title → auto_title_session → maybe_auto_title

  3. cli.py / gateway/run.py: Pass main_runtime dict to maybe_auto_title

  4. tests/agent/test_title_generator.py: Update mock assertions for new main_runtime parameter

Files: 5 changed, +26/-7 lines


Supersedes the auxiliary portion of #16055 (restart hang fix is already in upstream).

Changed files

  • agent/auxiliary_client.py (modified, +2/-2)
  • agent/title_generator.py (modified, +8/-3)
  • cli.py (modified, +7/-0)
  • gateway/run.py (modified, +7/-0)
  • tests/agent/test_title_generator.py (modified, +2/-2)

Code Example

provider: zai
   base_url: https://custom-endpoint.example.com/v1

---

base_url = _to_openai_base_url(
       str(creds.get("base_url", "")).strip().rstrip("/") or explicit_base_url or pconfig.inference_base_url
   )

---

auxiliary:
  compression:
    provider: auto
  title_generation:
    provider: auto
RAW_BUFFERClick to expand / collapse

Bug Summary

When using a named provider (e.g. zai) with a custom base_url, auxiliary tasks — context compression, title generation, and session summarization — silently use the provider's default endpoint instead of the configured custom one. This causes context truncation failures when the auxiliary request hits the wrong endpoint.

Root Cause

Two interrelated issues in resolve_provider_client() (agent/auxiliary_client.py):

1. PROVIDER_REGISTRY path ignores explicit_base_url (line ~1992)

When a named provider from PROVIDER_REGISTRY is resolved, base_url is constructed from only creds["base_url"] or the provider's default pconfig.inference_base_url. The explicit_base_url parameter passed to the function is completely ignored in this branch.

The "custom" provider path (line ~1842) correctly honors explicit_base_url.

2. Direct callers don't pass main_runtime

  • title_generator.py (line 54-60): calls call_llm() without main_runtime
  • trajectory_compressor.py (line 610-616, 679-685): calls call_llm() / async_call_llm() with an explicit provider= and no main_runtime

Without main_runtime, the _resolve_auto() workaround (which re-routes named providers with custom base_url through provider="custom") never triggers. And even if main_runtime were passed, the explicit provider= parameter causes _resolve_auto() to be bypassed entirely in favor of the PROVIDER_REGISTRY path.

Steps to Reproduce

  1. Configure a named provider with a custom base_url in config.yaml:
    provider: zai
    base_url: https://custom-endpoint.example.com/v1
  2. Start a long conversation that triggers context compression
  3. Observe that the compression request goes to the default zai endpoint, not the custom one

Expected Behavior

Auxiliary tasks should honor the same base_url as the main conversation loop.

Suggested Fix

  1. In resolve_provider_client(), the PROVIDER_REGISTRY path should fall back to explicit_base_url when it's provided:
    base_url = _to_openai_base_url(
        str(creds.get("base_url", "")).strip().rstrip("/") or explicit_base_url or pconfig.inference_base_url
    )
  2. Thread main_runtime through to title_generator.py and trajectory_compressor.py so _resolve_auto() can access the runtime's base_url/api_key.

Workaround

Setting provider: auto for auxiliary tasks avoids the PROVIDER_REGISTRY path:

auxiliary:
  compression:
    provider: auto
  title_generation:
    provider: auto

This relies on _resolve_auto() which has a workaround re-routing to provider: custom.

Version

Hermes Agent v0.11.0 (2026.4.23)

Affected Files

  • agent/auxiliary_client.pyresolve_provider_client() PROVIDER_REGISTRY branch (~line 1992)
  • agent/title_generator.pycall_llm() call (~line 54)
  • trajectory_compressor.pycall_llm() / async_call_llm() calls (~lines 610, 679)

extent analysis

TL;DR

The most likely fix involves modifying the resolve_provider_client() function to honor the explicit_base_url parameter and passing main_runtime to auxiliary tasks.

Guidance

  • Modify the resolve_provider_client() function in agent/auxiliary_client.py to use the explicit_base_url when provided, as suggested in the issue.
  • Pass main_runtime to title_generator.py and trajectory_compressor.py to enable the _resolve_auto() workaround.
  • As a temporary workaround, set provider: auto for auxiliary tasks in the configuration to avoid the PROVIDER_REGISTRY path.
  • Verify the fix by checking that auxiliary tasks use the custom base_url instead of the default provider endpoint.

Example

base_url = _to_openai_base_url(
    str(creds.get("base_url", "")).strip().rstrip("/") or explicit_base_url or pconfig.inference_base_url
)

Notes

The suggested fix requires modifying the resolve_provider_client() function and passing main_runtime to auxiliary tasks. The workaround of setting provider: auto for auxiliary tasks may not be a permanent solution.

Recommendation

Apply the workaround by setting provider: auto for auxiliary tasks, as it is a simpler and more immediate solution that avoids the need for code modifications. This relies on the _resolve_auto() workaround, which re-routes named providers with custom base_url through provider: custom.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING