From 3f850d4dc6288c9148b1a2e648edeef8b85314fa Mon Sep 17 00:00:00 2001 From: poria-lang Date: Mon, 10 Aug 2026 18:40:31 +0300 Subject: [PATCH 1/2] fix(test): use real Settings object in runner root prompt tests --- tests/test_runner_root_prompt.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/tests/test_runner_root_prompt.py b/tests/test_runner_root_prompt.py index 2c346203..3b0a07eb 100644 --- a/tests/test_runner_root_prompt.py +++ b/tests/test_runner_root_prompt.py @@ -6,7 +6,6 @@ flow through to the root agent's ``build_strix_agent`` call. from __future__ import annotations -import types from typing import Any import httpx @@ -16,6 +15,7 @@ from openai import RateLimitError import strix.tools.notes.tools as notes_tools import strix.tools.todo.tools as todo_tools +from strix.config.settings import Settings from strix.core import runner from strix.core.agents import AgentCoordinator from strix.runtime import session_manager @@ -42,17 +42,14 @@ def _patch_engine_scaffold( monkeypatch.setattr(runner, "setup_scan_logging", lambda _run_dir: lambda: None) monkeypatch.setattr(runner, "set_scan_id", lambda _scan_id: None) - settings = types.SimpleNamespace( - llm=types.SimpleNamespace( - model="openai/gpt-4o", - reasoning_effort="high", - force_required_tool_choice=False, - timeout=300, - prompt_cache=True, - extra_headers=None, - ), - runtime=types.SimpleNamespace(max_context_images=3), - ) + settings = Settings() + settings.llm.model = "openai/gpt-4o" + settings.llm.reasoning_effort = "high" + settings.llm.force_required_tool_choice = False + settings.llm.timeout = 300 + settings.llm.prompt_cache = True + settings.llm.extra_headers = None + settings.runtime.max_context_images = 3 monkeypatch.setattr(runner, "load_settings", lambda: settings) monkeypatch.setattr(runner, "configure_sdk_model_defaults", lambda _settings: None) monkeypatch.setattr( From 65cd8fea195f578ccf867b27fce7a6ceac8a0260 Mon Sep 17 00:00:00 2001 From: poria-lang Date: Mon, 10 Aug 2026 20:41:08 +0300 Subject: [PATCH 2/2] fix(test): isolate Settings() from ambient settings env vars --- tests/test_runner_root_prompt.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/test_runner_root_prompt.py b/tests/test_runner_root_prompt.py index 3b0a07eb..17dbecfd 100644 --- a/tests/test_runner_root_prompt.py +++ b/tests/test_runner_root_prompt.py @@ -6,6 +6,7 @@ flow through to the root agent's ``build_strix_agent`` call. from __future__ import annotations +import os from typing import Any import httpx @@ -21,6 +22,30 @@ from strix.core.agents import AgentCoordinator from strix.runtime import session_manager +_SETTINGS_ENV_PREFIXES = ( + "STRIX_", + "LLM_", + "OPENAI_", + "DEDUPE_LLM_", + "LITELLM_", + "OLLAMA_", + "PERPLEXITY_", + "POSTMAN_", +) + + +@pytest.fixture(autouse=True) +def _clear_settings_env(monkeypatch: pytest.MonkeyPatch) -> None: + """Drop ambient settings env vars so Settings() builds deterministically. + + A malformed unrelated value (e.g. a non-JSON LLM_EXTRA_HEADERS) would + otherwise make Settings() raise before the fields under test are assigned. + """ + for key in list(os.environ): + if key.startswith(_SETTINGS_ENV_PREFIXES): + monkeypatch.delenv(key, raising=False) + + def _make_rate_limit_error() -> RateLimitError: request = httpx.Request("POST", "https://api.openai.com/v1/responses") response = httpx.Response(status_code=429, request=request)