Enhance error handling and state management in access card and session modules

- Updated the `render_access_panel` function to conditionally hide LLM errors when the Ollama model is operational, improving user experience by reducing unnecessary error visibility.
- Introduced a new `_notes_from_disk` function to streamline the retrieval of notes from disk, enhancing state management during GPU environment checks.
- Refactored error handling in the `_bind_access` function to ensure that stack and GPU environment errors are accurately recorded and managed, improving robustness in session state updates.
- Added tests to validate the new behavior of error handling and state management, ensuring that LLM errors are appropriately suppressed when conditions are met.
This commit is contained in:
Leonid Pershin
2026-08-21 20:20:49 +03:00
parent f8f8dcc93e
commit 79cb0a7e25
6 changed files with 156 additions and 22 deletions
+18
View File
@@ -259,3 +259,21 @@ def test_jit_fail_strips_sage_extra_args(tmp_path, monkeypatch):
assert marker["pip_ok"] is True
assert marker["jit_ok"] is False
assert "--use-sage-attention" not in backends.read_text(encoding="utf-8")
def test_triton_jit_ok_runs_a_py_file(tmp_path, monkeypatch):
mod = _load()
py = tmp_path / "python"
py.write_text("", encoding="utf-8")
seen: list[list[str]] = []
def fake_output(cmd, **kw):
seen.append(list(cmd))
return "triton JIT ok\n"
monkeypatch.setattr(mod.subprocess, "check_output", fake_output)
assert mod.triton_jit_ok(py) is True
assert seen
assert seen[0][0] == str(py)
assert seen[0][1].endswith(".py")
assert "-c" not in seen[0]