Skip to content

Commit 038bdd8

Browse files
Stabilize local dev merge
Align regression tests with the current Odysseus behavior after merging origin/dev into local main. - keep phone/name-only contacts valid and cover null email without crashes - pin explicit web-search false form submission in chat.js - update Cookbook dependency/download completion tests for combined live + persisted output - expose SGLang OS package repair hints from backend diagnosis - treat MLX and MLX-community repos as servable on Apple Metal while keeping CUDA behavior unchanged - keep desktop new-chat coverage on the shared preferred-model helper - remove a hardcoded crop overlay portal z-index literal - include the local agent-loop cleanup that removes the old manage_notes reminder repair shim Verified with: docker run --rm -v /home/pewds/odysseus-cookbook-fresh:/app -w /app odysseus-cookbook-fresh-odysseus python3 -m pytest -q (4515 passed, 4 skipped).
1 parent b5ec40d commit 038bdd8

12 files changed

Lines changed: 55 additions & 78 deletions

routes/cookbook_helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,7 @@ def _diagnose_serve_output(text: str) -> dict | None:
13061306
"SGLang native kernel/runtime is missing or mismatched on this server.",
13071307
[
13081308
{"label": "repair sglang-kernel in this Python environment", "op": "dependency", "package": "sglang-kernel"},
1309+
{"label": "install OS packages: libnuma-dev python3.12-dev build-essential", "op": "manual"},
13091310
{"label": "if libnvrtc is still missing, install the matching CUDA/NVRTC runtime on this host", "op": "manual"},
13101311
],
13111312
),

src/agent_loop.py

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -796,50 +796,6 @@ def _extract_last_user_message(messages: List[Dict]) -> str:
796796
return ""
797797

798798

799-
_REMINDER_TIME_RE = re.compile(
800-
r"\b(?:today|tonight|tomorrow|tmrw|yesterday)\b(?:\s+(?:at\s+)?\d{1,2}(?::\d{2})?\s*(?:am|pm)?)?"
801-
r"|\b\d{1,2}(?::\d{2})?\s*(?:am|pm)?\s+(?:today|tonight|tomorrow|tmrw|yesterday)\b"
802-
r"|\bin\s+\d+\s*(?:hour|hr|minute|min|day)s?\b",
803-
re.IGNORECASE,
804-
)
805-
806-
807-
def _extract_reminder_due_from_user(text: str) -> str:
808-
t = str(text or "").strip()
809-
if not re.search(r"\b(remind|reminder|alarm)\b", t, re.IGNORECASE):
810-
return ""
811-
m = _REMINDER_TIME_RE.search(t)
812-
return m.group(0).strip() if m else ""
813-
814-
815-
def _repair_manage_notes_reminder_block(block: ToolBlock, last_user: str) -> ToolBlock:
816-
"""Carry reminder time from the user message when the model omits due_date."""
817-
if block.tool_type != "manage_notes":
818-
return block
819-
try:
820-
args = json.loads(block.content or "{}")
821-
except Exception:
822-
return block
823-
if not isinstance(args, dict) or args.get("due_date"):
824-
return block
825-
826-
action = str(args.get("action") or "").replace("-", "_").strip().lower()
827-
if action not in {"add", "create", "new", "save", "remind", "reminder"}:
828-
return block
829-
830-
due = _extract_reminder_due_from_user(last_user)
831-
if not due:
832-
return block
833-
args["due_date"] = due
834-
if not args.get("title"):
835-
cleaned = re.sub(r"\b(make|create|add|set)\b", "", str(last_user or ""), flags=re.IGNORECASE)
836-
cleaned = re.sub(r"\b(a|an)?\s*(reminder|alarm)\b", "", cleaned, flags=re.IGNORECASE)
837-
cleaned = _REMINDER_TIME_RE.sub("", cleaned)
838-
cleaned = re.sub(r"\s+", " ", cleaned).strip(" :,-") or "Reminder"
839-
args["title"] = cleaned[:120]
840-
return ToolBlock(block.tool_type, json.dumps(args, ensure_ascii=False))
841-
842-
843799
def _user_turn_count(messages: List[Dict]) -> int:
844800
"""Count real user turns in the message list."""
845801
count = 0
@@ -4004,7 +3960,6 @@ async def stream_agent_loop(
40043960
tool_result_texts = [] # plain text for native tool role messages
40053961
budget_hit = False
40063962
for i, block in enumerate(tool_blocks):
4007-
block = _repair_manage_notes_reminder_block(block, _last_user)
40083963
# --- Tool budget check ---
40093964
if max_tool_calls > 0 and total_tool_calls >= max_tool_calls:
40103965
yield f'data: {json.dumps({"type": "budget_exceeded", "limit": max_tool_calls, "used": total_tool_calls})}\n\n'

static/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8688,7 +8688,7 @@ button.hamburger {
86888688
.attach-crop-overlay {
86898689
position: fixed;
86908690
inset: 0;
8691-
z-index: 100000;
8691+
z-index: var(--attach-crop-z, 100001);
86928692
background: rgba(0, 0, 0, 0.72);
86938693
display: flex;
86948694
align-items: center;

tests/test_chat_route_tool_policy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,6 @@ def test_frontend_always_sends_explicit_allow_bash():
254254
def test_frontend_sends_explicit_allow_web_search_false_in_agent_mode():
255255
"""chat.js must send allow_web_search=false when web toggle is off in agent mode."""
256256
source = _CHAT_JS.read_text(encoding="utf-8")
257-
assert "allow_web_search', 'false'" in source, (
257+
assert "fd.append('allow_web_search', el('web-toggle').checked ? 'true' : 'false')" in source, (
258258
"Frontend must send explicit allow_web_search=false in agent mode when toggle is off"
259259
)

tests/test_contacts_add_null_name.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ def _add_handler():
2424
def _stub_store(monkeypatch):
2525
created = []
2626
monkeypatch.setattr(cr, "_fetch_contacts", lambda *a, **k: [])
27-
monkeypatch.setattr(cr, "_create_contact", lambda name, email: created.append((name, email)) or True)
27+
monkeypatch.setattr(
28+
cr,
29+
"_create_contact",
30+
lambda name, email="", address="", phones=None: created.append((name, email, address, phones or [])) or True,
31+
)
2832
return created
2933

3034

@@ -33,10 +37,18 @@ def test_null_name_does_not_crash(_stub_store):
3337
result = asyncio.run(handler({"name": None, "email": "x@y.com"}, _admin="admin"))
3438
assert result["success"] is True
3539
# name fell back to the email local-part instead of crashing.
36-
assert _stub_store == [("x", "x@y.com")]
40+
assert _stub_store == [("x", "x@y.com", "", [])]
3741

3842

39-
def test_null_email_is_rejected_cleanly(_stub_store):
43+
def test_null_email_does_not_crash(_stub_store):
4044
handler = _add_handler()
4145
result = asyncio.run(handler({"name": "Bob", "email": None}, _admin="admin"))
42-
assert result == {"success": False, "error": "Email required"}
46+
assert result["success"] is True
47+
assert _stub_store == [("Bob", "", "", [])]
48+
49+
50+
def test_phone_only_contact_is_allowed(_stub_store):
51+
handler = _add_handler()
52+
result = asyncio.run(handler({"name": "Bob", "email": None, "phone": "0805412 7841"}, _admin="admin"))
53+
assert result["success"] is True
54+
assert _stub_store == [("Bob", "", "", ["0805412 7841"])]

tests/test_cookbook_dependency_completion_regression.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ def test_background_status_poll_reconciles_into_local_tasks():
2020
source = _read("static/js/cookbookRunning.js")
2121

2222
assert "const statusById = new Map(tasks.map(t => [t.session_id, t]));" in source
23-
assert "const nextStatus = live.status === 'completed'" in source
23+
assert "const completedByOutput = depDone || downloadDone;" in source
24+
assert "const nextStatus = completedByOutput" in source
25+
assert "live.status === 'completed'" in source
2426
assert "? 'done'" in source
2527
assert ": (live.status === 'error'" in source
2628
assert "? 'error'" in source
@@ -75,7 +77,8 @@ def test_background_poll_recovers_done_for_stopped_dependency_install():
7577
downgrading the card to crashed."""
7678
source = _read("static/js/cookbookRunning.js")
7779

78-
assert "const depDone = !!task.payload?._dep && _depInstallSucceeded(task.output);" in source
80+
assert "const combinedOutput = `${task.output || ''}\\n${live.output_tail || ''}`;" in source
81+
assert "const depDone = !!task.payload?._dep && _depInstallSucceeded(combinedOutput);" in source
7982
assert "(depDone || downloadDone) ? 'done' : (task.type === 'download' ? 'crashed' : 'stopped')" in source
8083

8184

@@ -91,14 +94,14 @@ def test_background_poll_recovers_done_for_completed_download():
9194
normalized = " ".join(source.split())
9295
assert (
9396
"const downloadDone = task.type === 'download' "
94-
"&& String(task.output || '').includes('DOWNLOAD_OK');"
97+
"&& String(combinedOutput || '').includes('DOWNLOAD_OK');"
9598
) in normalized
9699

97100

98101
def test_dependency_install_payload_keeps_env_path_for_refresh():
99102
source = _read("static/js/cookbook.js")
100103

101-
assert "env_path: _envState.envPath || ''" in source
104+
assert "env_path: targetEnvPath || ''" in source
102105

103106

104107
def test_local_dependency_probe_refreshes_user_site_visibility():

tests/test_cookbook_diagnosis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_diagnose_sglang_native_dependency_errors():
2929
diagnosis = _diagnose_serve_output(output)
3030

3131
assert diagnosis is not None
32-
assert "SGLang native dependencies" in diagnosis["message"]
32+
assert "SGLang native kernel/runtime" in diagnosis["message"]
3333
labels = [suggestion["label"] for suggestion in diagnosis["suggestions"]]
3434
assert any("libnuma-dev" in label for label in labels)
3535
assert any("python3.12-dev" in label for label in labels)

tests/test_cookbook_diagnosis_js.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ def test_sglang_native_dependency_diagnosis_is_exposed_to_browser():
1717

1818
assert r"Python\.h" in source
1919
assert r"libnuma\.so\.1" in source
20-
assert "SGLang native dependencies" in source
20+
assert "SGLang native kernel/runtime" in source
2121
assert "libnuma-dev python3.12-dev build-essential" in source
2222
assert "sglang-kernel" in source

tests/test_cookbook_same_host_server_profiles_js.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def test_selected_server_helpers_prefer_profile_key_before_host_fallback():
3131

3232
def test_cookbook_submodules_resolve_visible_profile_selection():
3333
assert "_serverByVal?.(_ssv)" in DOWNLOAD
34-
assert "_serverByVal?.(_envState.remoteServerKey || host)" in DOWNLOAD
35-
assert "_serverByVal?.(_envState.remoteServerKey || _zh)" in DOWNLOAD
34+
assert "_serverByVal?.(_envState.remoteServerKey || _envState.remoteHost || '')" in DOWNLOAD
35+
assert "_serverByVal?.(zombieCandidate.remoteServerKey || zombieCandidate.payload?.remote_server_key || _zh)" in DOWNLOAD
3636
assert "_serverByVal(_envState.remoteServerKey || remoteHost)" in HWFIT
3737
assert "hk: _currentServerValue()" in HWFIT
3838
assert "sel.value = _currentServerValue();" in HWFIT

tests/test_hwfit_macos.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@ def run(cmd):
4343
return run
4444

4545

46-
def test_mlx_models_hidden_on_metal():
47-
"""MLX-quantized models can't be served by llama.cpp or Ollama (the only
48-
Metal-capable engines Odysseus generates), so they must never be recommended
49-
on Apple Silicon — even though the catalog tags them as Apple-only."""
46+
def test_mlx_models_visible_on_metal():
47+
"""Apple Silicon can serve MLX models through the MLX engine, so Cookbook
48+
should surface MLX rows on Metal while still hiding them on CUDA."""
5049
results = rank_models(_metal_system(), limit=900)
5150
mlx = [m for m in results if str(m.get("quant", "")).startswith("mlx-")]
52-
assert mlx == [], f"MLX models surfaced but cannot be served: {[m['name'] for m in mlx]}"
51+
assert mlx, "MLX models should be available on Apple Silicon / Metal hardware"
5352

5453

5554
def _cuda_system():
@@ -65,17 +64,18 @@ def test_mlx_hidden_on_cuda_backend_unchanged():
6564
assert mlx == []
6665

6766

68-
def test_only_gguf_models_recommended_on_metal():
69-
"""llama.cpp and Ollama (the only Metal engines) need GGUF. Safetensors-only
70-
repos — incl. vLLM-only AWQ/GPTQ/FP8 — can't be served on Metal, so every
71-
model recommended on Apple Silicon must ship a servable GGUF."""
67+
def test_only_gguf_or_mlx_models_recommended_on_metal():
68+
"""Metal recommendations must be servable locally: either GGUF for
69+
llama.cpp/Ollama or MLX for the MLX engine."""
7270
catalog = {m["name"]: m for m in get_models()}
7371
unservable = [
7472
r["name"] for r in rank_models(_metal_system(), limit=900)
75-
if not (catalog.get(r["name"], {}).get("is_gguf")
73+
if not (str(r.get("quant", "")).startswith("mlx-")
74+
or str(r.get("name", "")).startswith(("mlx-community/", "lmstudio-community/"))
75+
or catalog.get(r["name"], {}).get("is_gguf")
7676
or catalog.get(r["name"], {}).get("gguf_sources"))
7777
]
78-
assert unservable == [], f"{len(unservable)} non-GGUF models on Metal, e.g. {unservable[:3]}"
78+
assert unservable == [], f"{len(unservable)} non-servable models on Metal, e.g. {unservable[:3]}"
7979

8080

8181
def test_qwen_catalog_entries_point_at_verified_gguf_repos():

0 commit comments

Comments
 (0)