Skip to content

fix(agent): plumb main_runtime through vision aux resolution#19470

Closed
konsisumer wants to merge 1 commit into
NousResearch:mainfrom
konsisumer:fix/aux-vision-runtime-resolution
Closed

fix(agent): plumb main_runtime through vision aux resolution#19470
konsisumer wants to merge 1 commit into
NousResearch:mainfrom
konsisumer:fix/aux-vision-runtime-resolution

Conversation

@konsisumer

Copy link
Copy Markdown
Contributor

Vision auxiliary tasks diverged from the main agent runtime after /model switches or fallback activations because resolve_vision_provider_client() resolved through _read_main_provider() / _read_main_model() — the config-only path — even when the caller had a live runtime snapshot.

What changed and why

  • resolve_vision_provider_client() accepts an optional main_runtime and uses it in the auto branch before falling back to config (agent/auxiliary_client.py).
  • call_llm(task="vision", ...) forwards its existing main_runtime kwarg into the vision resolver and into the auth-error retry path.
  • async_call_llm() gains a main_runtime parameter (parity with call_llm) and forwards it to both the vision resolver and _get_cached_client (including the auto fallback and auth-error retry).
  • The text-only resolution path was already runtime-aware; this closes the gap for the vision path called out in the issue (resolve_vision_provider_client listed under "Affected Code Paths").

How to test

  • pytest tests/agent/test_auxiliary_main_first.py -q — covers existing main-first behaviour plus two new regression tests:
    • test_runtime_override_wins_over_config_for_vision — runtime provider wins over config in the vision auto branch.
    • test_call_llm_vision_forwards_main_runtimecall_llm(task="vision") reaches resolve_vision_provider_client with main_runtime intact.
  • pytest tests/agent tests/run_agent tests/tools/test_web_tools_config.py -q — full auxiliary + run_agent coverage stays green (the only failures are pre-existing on main: tests/agent/test_anthropic_adapter.py::TestRunOauthSetupToken::* and tests/run_agent/test_concurrent_interrupt.py).

What platforms tested on

  • macOS on darwin-arm64 (local)

Fixes #19437

Vision auxiliary tasks (analyze_image, vision-aware tools) resolved
their provider via _read_main_provider() / _read_main_model() — the
config-only path. After a /model switch or fallback activation, the
main loop picked up the new provider/model from self._client_kwargs
but vision tasks kept hitting the original provider from config.

resolve_vision_provider_client() now accepts main_runtime and prefers
its provider/model in the auto branch. call_llm() and async_call_llm()
forward the kwarg they already accept (async_call_llm previously had
no main_runtime parameter at all — now matches sync parity).

Refs NousResearch#19437.
@alt-glitch alt-glitch added comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists tool/vision Vision analysis and image generation type/bug Something isn't working labels May 4, 2026
@konsisumer

Copy link
Copy Markdown
Contributor Author

Closing: superseded_by_other_pr. other PRs claim to close same issues: [(19437, 19485)]


autocontrib · housekeeping · 2026-05-04T03:29:31Z

@konsisumer konsisumer closed this May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists tool/vision Vision analysis and image generation type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auxiliary client uses independent resolution path, diverges from main conversation loop

2 participants