fix: pass runtime route details into webui agent — v0.50.66
Forwards `api_mode`, `acp_command`, `acp_args`, and `credential_pool` from the resolved runtime provider into `AIAgent.__init__()` in the WebUI streaming path. Fixes Codex account switching and credential pool support for WebUI sessions. Also adds 6 defensive variable initializations to prevent NameError in cleanup paths. Tests: 1329 passed, 0 skipped. Full TestRuntimeRouteInjection suite passes. PR by @suinia. Rebased and CHANGELOG added by maintainer. Co-authored-by: suinia <suinia@users.noreply.github.com>
This commit is contained in:
@@ -551,6 +551,12 @@ def _run_agent_streaming(session_id, msg_text, model, workspace, stream_id, atta
|
||||
q = STREAMS.get(stream_id)
|
||||
if q is None:
|
||||
return
|
||||
s = None
|
||||
_rt = {}
|
||||
old_cwd = None
|
||||
old_exec_ask = None
|
||||
old_session_key = None
|
||||
old_hermes_home = None
|
||||
|
||||
# ── MCP Server Discovery (lazy import, idempotent) ──
|
||||
# discover_mcp_tools() is called here (rather than at server startup) so that
|
||||
@@ -829,6 +835,10 @@ def _run_agent_streaming(session_id, msg_text, model, workspace, stream_id, atta
|
||||
provider=resolved_provider,
|
||||
base_url=resolved_base_url,
|
||||
api_key=resolved_api_key,
|
||||
api_mode=_rt.get('api_mode'),
|
||||
acp_command=_rt.get('command'),
|
||||
acp_args=_rt.get('args'),
|
||||
credential_pool=_rt.get('credential_pool'),
|
||||
platform='cli',
|
||||
quiet_mode=True,
|
||||
enabled_toolsets=_toolsets,
|
||||
|
||||
Reference in New Issue
Block a user