Skip to content

fix(delegation): carry provider request_overrides through the base_url path (#65035) - #65054

Open
ayushnangia wants to merge 1 commit into
NousResearch:mainfrom
ayushnangia:fix/delegation-baseurl-request-overrides
Open

fix(delegation): carry provider request_overrides through the base_url path (#65035)#65054
ayushnangia wants to merge 1 commit into
NousResearch:mainfrom
ayushnangia:fix/delegation-baseurl-request-overrides

Conversation

@ayushnangia

Copy link
Copy Markdown
Contributor

Summary

Carry the configured provider's request_overrides (and max_output_tokens) through _resolve_delegation_credentials()'s base_url short-circuit, so subagents pinned to an explicit endpoint stop silently losing provider request settings like extra_body: {thinking: {type: disabled}} (#65035).

Changes

  • tools/delegate_tool.py: _resolve_delegation_credentials() — when delegation.provider is configured alongside delegation.base_url, resolve the provider runtime (best-effort) and include its request_overrides + max_output_tokens in the returned bundle. Explicitly configured base_url / api_key / api_mode keep winning; a resolution failure logs at debug and proceeds without overrides instead of failing the dispatch (the explicit endpoint worked before this change even when the provider couldn't resolve)
  • tests/tools/test_delegate.py: 3 tests in TestDelegationCredentialResolution — provider+base_url carries the runtime's overrides while config endpoint/key win; bare base_url returns None overrides (shape parity with the inherit path); runtime failure keeps the endpoint working. All 3 fail on unfixed code (KeyError: request_overrides)

Root cause

_resolve_delegation_credentials() has three return paths. The provider path includes "request_overrides": dict(runtime.get("request_overrides") or {}); the inherit path returns "request_overrides": None; but the base_url path — which wins whenever delegation.base_url is set, even with a provider configured — returns a dict without the key entirely. The caller then does

override_request_overrides=creds.get("request_overrides"),
override_max_tokens=creds.get("max_output_tokens"),

so both silently resolve to None, and _build_child_agent()'s override_provider-gated branch hands the child dict(None or {}) — empty overrides. A custom provider whose runtime definition carries extra_body behaves correctly in the parent conversation and reverts to provider defaults in every subagent.

Sibling of #65038 (fixed in #65052): same file, same class — a delegation config value accepted but dropped on one resolution path. Adjacent to #56876 (parent-runtime request_overrides inheritance semantics in _build_child_agent); this change is confined to _resolve_delegation_credentials and doesn't touch that region, so the two compose rather than conflict.

Validation

delegation: config Before After
provider + base_url (provider runtime carries extra_body) request_overrides: None, max_output_tokens: None — overrides silently dropped runtime's request_overrides + max_output_tokens carried; configured base_url/api_key still win
base_url only key absent (.get → None) None explicitly (shape parity)
provider + base_url, provider unresolvable endpoint works endpoint still works, overrides skipped, debug log

E2E on the resolution path (mocked runtime with thinking: {type: disabled}):

BEFORE (main):  request_overrides: None            max_output_tokens: None
AFTER (fix):    request_overrides: {'extra_body': {'thinking': {'type': 'disabled'}}}   max_output_tokens: 8192
  • scripts/run_tests.sh tests/tools/test_delegate.py tests/tools/test_async_delegation.py — 2 files, 191 passed, 0 failed

Fixes #65035. Refs #65038/#65052, #56876.

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint tool/delegate Subagent delegation area/config Config system, migrations, profiles P2 Medium — degraded but workaround exists labels Jul 15, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Looks Good

  • Well-scoped fix: carries request_overrides through the base_url delegation path, addressing issue #65035
  • Clean additions only (82 lines), no deletions
  • Logic is straightforward — preserves the override dict and passes it through provider_request_overrides

Reviewed by Hermes Agent

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused delegation fix. The premise remains valid on current main: the direct delegation.base_url branch returns without request_overrides or max_output_tokens at tools/delegate_tool.py:3116-3122, while the child construction path consumes those fields at tools/delegate_tool.py:2530-2531 and applies override request settings at tools/delegate_tool.py:1350-1354.

The proposed best-effort runtime lookup preserves the existing explicit endpoint behavior while forwarding values that the runtime resolver already exposes for custom providers (hermes_cli/runtime_provider.py:993-1005, 1037-1045). The added resolution tests cover the populated, absent-provider, and resolver-failure cases.

This is an automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 16, 2026
@GottZ

GottZ commented Aug 3, 2026

Copy link
Copy Markdown

This was generated by AI during triage.

Summary

One PR addresses #65035. The diff in #65054 corrects the reported explicit-base_url path by forwarding the configured provider runtime’s request_overrides and max_output_tokens while retaining explicit endpoint, key, and API-mode precedence.

Related pull requests

Suggested consolidation

Keep #65054 open with a salvage path: preserve its direct credential-path fix and regression coverage, with author action to rebase onto main if needed. It is the only PR in this complex, so there are no duplicates to close.

Complex graph

flowchart LR
    classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
    classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
    classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
    classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
    classDef best stroke-width:3px,stroke:#b45309
    classDef target stroke-width:3px,stroke:#4338ca
    I65035(["issue #65035 (open)"])
    P65054["PR #65054 (open)"]
    P65054 -->|best fix| I65035
    class I65035 open
    class P65054 open
    class P65054 best
    class P65054 target
    click I65035 "https://github.com/NousResearch/hermes-agent/issues/65035"
    click P65054 "https://github.com/NousResearch/hermes-agent/pull/65054"
Loading

Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label).

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

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/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform 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.

bug: delegation config with base_url drops request_overrides/extra_body

5 participants