Skip to content

fix(gateway): set empty dict instead of None for request_overrides - #7320

Closed
joesaiw1208-stack wants to merge 1 commit into
NousResearch:mainfrom
joesaiw1208-stack:fix/request-overrides-none-bug
Closed

fix(gateway): set empty dict instead of None for request_overrides#7320
joesaiw1208-stack wants to merge 1 commit into
NousResearch:mainfrom
joesaiw1208-stack:fix/request-overrides-none-bug

Conversation

@joesaiw1208-stack

Copy link
Copy Markdown

When service_tier is empty, _build_turn_route() was setting request_overrides to None, which would later override the dict initialized in AIAgent.init. This caused an AttributeError when code tried to call .get() on None in run_agent.py line 5522.

The fix is to use {} instead of None, consistent with how request_overrides is initialized in AIAgent.init.

…en service_tier is unset

When service_tier is empty, _build_turn_route() was setting
request_overrides to None, which would later override the dict
initialized in AIAgent.__init__. This caused an AttributeError
when code tried to call .get() on None in run_agent.py line 5522.

The fix is to use {} instead of None, consistent with how
request_overrides is initialized in AIAgent.__init__:
  self.request_overrides = dict(request_overrides or {})
@alt-glitch alt-glitch added type/bug Something isn't working P1 High — major feature broken, no workaround comp/gateway Gateway runner, session dispatch, delivery labels Apr 29, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #7281 — competing fix for the same AttributeError crash when request_overrides is None (reported in #7259).

@teknium1

Copy link
Copy Markdown
Contributor

Automated hermes-sweeper review: this PR's requested fix is already implemented on current main.

Evidence:

  • PR fix(gateway): set empty dict instead of None for request_overrides #7320 changes gateway/run.py so _resolve_turn_agent_config() returns {} instead of None for request_overrides when no service_tier applies.
  • Current main already does that in gateway/run.py:3612, and also normalizes unsupported fast-mode overrides with overrides or {} at gateway/run.py:3619.
  • Current main also guards cached-agent turn updates with agent.request_overrides = turn_route.get("request_overrides") or {} at gateway/run.py:16492.
  • Regression coverage exists in tests/gateway/test_fast_command.py:129, asserting the unsupported-model path returns {}.
  • The equivalent fix landed in commit e4b69bf149290eaf423e658cf285fb024262b2d4 (fix(gateway): guard against None request_overrides in _build_api_kwargs).

Thanks for the report and patch. This overlaps with the related competing fix mentioned in the thread (#7281 / #7259), so the behavioral guarantee is now covered on main.

@teknium1 teknium1 closed this Jun 29, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P1 High — major feature broken, no workaround sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants