mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-09-10 18:22:20 +02:00
* 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>
43 lines
1.6 KiB
Python
43 lines
1.6 KiB
Python
import json
|
|
|
|
import routes.prefs_routes as prefs_routes
|
|
|
|
|
|
def test_load_ignores_non_object_prefs_file(tmp_path, monkeypatch):
|
|
prefs_file = tmp_path / "user_prefs.json"
|
|
prefs_file.write_text(json.dumps(["not", "a", "prefs", "object"]), encoding="utf-8")
|
|
monkeypatch.setattr(prefs_routes, "PREFS_FILE", str(prefs_file))
|
|
|
|
assert prefs_routes._load() == {}
|
|
assert prefs_routes._load_for_user("alice") == {}
|
|
|
|
|
|
def test_load_keeps_object_prefs_file(tmp_path, monkeypatch):
|
|
prefs_file = tmp_path / "user_prefs.json"
|
|
prefs_file.write_text(json.dumps({"theme": "dark"}), encoding="utf-8")
|
|
monkeypatch.setattr(prefs_routes, "PREFS_FILE", str(prefs_file))
|
|
|
|
assert prefs_routes._load_for_user(None) == {"theme": "dark"}
|
|
assert prefs_routes._load_for_user("alice") == {}
|
|
|
|
|
|
def test_named_preference_write_does_not_copy_flat_fallback_consent(tmp_path, monkeypatch):
|
|
prefs_file = tmp_path / "user_prefs.json"
|
|
prefs_file.write_text(json.dumps({
|
|
"theme": "light",
|
|
"foreground_fallback_enabled": True,
|
|
"foreground_model_fallbacks": [
|
|
{"endpoint_id": "legacy-single-user", "model": "legacy-model"},
|
|
],
|
|
}), encoding="utf-8")
|
|
monkeypatch.setattr(prefs_routes, "PREFS_FILE", str(prefs_file))
|
|
|
|
bob = prefs_routes._load_for_user("bob")
|
|
bob["theme"] = "dark"
|
|
prefs_routes._save_for_user("bob", bob)
|
|
|
|
raw = prefs_routes._load()
|
|
assert raw["_users"] == {"bob": {"theme": "dark"}}
|
|
assert raw["foreground_fallback_enabled"] is True
|
|
assert raw["foreground_model_fallbacks"][0]["endpoint_id"] == "legacy-single-user"
|