Files
agent-zero/tests/test_webui_agent_profile_switch_static.py
linkliti 7216b8641b fix(model-config): allow agent profile switch while chat runs
Remove the running-context guard from the agent profile endpoint and the switcher so a profile can be changed during an active monologue, matching chat model-preset overrides. Enable the switcher dropdown items while running by dropping the running gate from their disabled state; only the saving gate remains. The new profile applies to subsequent model turns and intentionally forfeits the prompt cache. Subordinate agents keep their own profile configs.

Validation: 73 subagent profile tests passed including a new endpoint test that switches the profile while a real task is running; static regression tests guard against reintroducing the running guard in the endpoint, switcher mixin, and dropdown markup; node --check passed on the switcher mixin.
2026-10-13 18:06:47 +03:00

32 lines
1.1 KiB
Python

from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parents[1]
def test_agent_profile_switching_has_no_running_guard() -> None:
endpoint = PROJECT_ROOT.joinpath("api", "agent_profile_set.py").read_text(encoding="utf-8")
mixin = PROJECT_ROOT.joinpath(
"plugins", "_model_config", "webui", "switcher-mixin.js"
).read_text(encoding="utf-8")
assert "is_running" not in endpoint
assert "409" not in endpoint
assert "Agent profile can be changed after the current run finishes." not in endpoint
assert "selectedContext?.running" not in mixin
assert "Agent profile can be changed after the current run finishes." not in mixin
def test_agent_profile_dropdown_items_stay_enabled_during_run() -> None:
switcher = PROJECT_ROOT.joinpath(
"plugins",
"_model_config",
"extensions",
"webui",
"chat-input-progress-start",
"model-switcher.html",
).read_text(encoding="utf-8")
assert ':disabled="$store.modelConfig.agentProfileSaving"' in switcher
assert "selectedContext.running" not in switcher