mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-13 02:12:21 +02:00
refactor(model-routing): centralize explicit foreground fallback policy (#6020)
* refactor(model-routing): centralize explicit foreground fallback policy Make foreground fallback an explicit per-user, availability-only policy shared by streaming Chat, non-stream Chat, and Agent runs. Preserve strict defaults, owner/model and credential boundaries, pinned Agent routes, and truthful per-round provenance/accounting. Carry provider-reported model identifiers through native streaming adapters, non-stream responses, and caches, and keep legacy default_model_fallbacks as tombstoned raw storage that generic settings APIs and agent tools cannot expose or mutate. * fix(agent-loop): restore rebase-dropped qwen routing, workspace prompt, and temperature clamp * fix(model-routing): thread selected endpoint identity, fix cost classification and fallback eligibility * fix(chat): restore stream helpers and harden run stop lifecycle * fix(model-routing): let numeric provider codes win over symbolic rate-limit statuses * fix(agent-loop): apply qwen temperature and notes-tool clamps per fallback candidate * fix(chat): honor queued stop across resend and reload canonical terminal on EOF * fix(chat): track stop queue and cleanup ownership by per-send generation * fix(agent-loop): preserve requested temperature for non-qwen fallback candidates * fix(chat): reserve send ownership before any await and scope stop to the current send * fix(chat): clear the previous run identity at send reservation --------- Co-authored-by: RaresKeY <158580472+RaresKeY@users.noreply.github.com> Co-authored-by: StressTestor <212606152+StressTestor@users.noreply.github.com>
This commit is contained in:
co-authored by
RaresKeY
StressTestor
parent
b52296471b
commit
c4369305f0
@@ -117,6 +117,31 @@ def test_agent_system_prompt_includes_shared_current_time(monkeypatch):
|
||||
assert "Australia/Brisbane, UTC+10:00" in datetime_messages[0]["content"]
|
||||
|
||||
|
||||
def test_route_prompt_rebuild_restores_leading_user_system_message(monkeypatch):
|
||||
import src.agent_loop as agent_loop
|
||||
|
||||
monkeypatch.setattr(agent_loop, "_build_base_prompt", lambda *args, **kwargs: ("AGENT PROMPT", ""))
|
||||
monkeypatch.setattr(agent_loop, "set_active_model", lambda model: None)
|
||||
monkeypatch.setattr(agent_loop, "get_builtin_overrides", lambda: {})
|
||||
monkeypatch.setattr(agent_loop, "_cached_base_prompt", None)
|
||||
monkeypatch.setattr(agent_loop, "_cached_base_prompt_key", None)
|
||||
|
||||
original = [
|
||||
{"role": "system", "content": "USER PERSONA"},
|
||||
{"role": "user", "content": "hello"},
|
||||
]
|
||||
built, _ = agent_loop._build_system_prompt(
|
||||
original,
|
||||
model="selected-model",
|
||||
active_document=None,
|
||||
mcp_mgr=None,
|
||||
)
|
||||
|
||||
assert built[0]["content"] == "USER PERSONA\n\nAGENT PROMPT"
|
||||
assert built[0]["_agent_injected"] == "merged_prompt"
|
||||
assert agent_loop._strip_agent_injected_messages(built) == original
|
||||
|
||||
|
||||
def test_calendar_relative_time_parser_handles_dotted_pm(monkeypatch):
|
||||
import routes.calendar_routes as calendar_routes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user