feat(safety): default to guarded review with TUI approvals

This commit is contained in:
oyasumi
2026-08-11 06:53:30 +00:00
parent 32bd2a2181
commit 41b7b4f392
46 changed files with 2094 additions and 327 deletions
+16 -2
View File
@@ -173,7 +173,6 @@ def test_apply_override_and_load_settings_round_trip(tmp_path: Path) -> None:
"env": {
"STRIX_LLM": "round-trip-model",
"PERPLEXITY_API_KEY": "pk",
"STRIX_SAFETY_MODE": "guarded",
"STRIX_SAFETY_MODEL": "openai/safety-model",
"STRIX_SAFETY_TIMEOUT": "12",
}
@@ -187,13 +186,28 @@ def test_apply_override_and_load_settings_round_trip(tmp_path: Path) -> None:
assert settings.llm.model == "round-trip-model"
assert settings.integrations.perplexity_api_key == "pk"
assert settings.safety.mode == "guarded"
assert settings.safety.model == "openai/safety-model"
assert settings.safety.timeout == 12
# Second call is memoized -> same object.
assert loader.load_settings() is settings
def test_removed_safety_mode_environment_is_rejected(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("STRIX_SAFETY_MODE", "observe")
with pytest.raises(ValueError, match="--dangerously-disable-safety"):
loader.load_settings()
def test_removed_safety_mode_config_is_rejected(tmp_path: Path) -> None:
path = tmp_path / "cli-config.json"
path.write_text(json.dumps({"env": {"STRIX_SAFETY_MODE": "off"}}), encoding="utf-8")
loader.apply_config_override(path)
with pytest.raises(ValueError, match="STRIX_SAFETY_MODE was removed"):
loader.load_settings()
def test_apply_config_override_invalidates_cache(tmp_path: Path) -> None:
first = tmp_path / "first.json"
first.write_text(json.dumps({"env": {"STRIX_LLM": "first-model"}}), encoding="utf-8")