Honor LLM_TIMEOUT, expose generation params, and harden black-box reports
Four small, independently-verified LLM/reporting fixes. Per maintainer request these are bundled into a single PR rather than four; each commit is self-contained and references its tracking issue, so they can be split or cherry-picked individually if preferred.
1. fix(llm): honor LLM_TIMEOUT during scans, not just warm-up (closes #426)
LLM_TIMEOUT is documented as the request timeout and is the recommended workaround for slow local models, but it was only applied to the warm-up call in strix/interface/main.py. Scan calls go through the SDK's LiteLLM model, which invokes litellm.acompletion without a timeout and falls back to LiteLLM's module default (6000s), so export LLM_TIMEOUT=600 had no effect on the actual run. _configure_litellm_request_timeout now sets litellm.request_timeout from settings inside configure_sdk_model_defaults.
2. fix(reporting): drop fabricated code_locations in black-box scans (closes #321)
In a black-box scan no source tree exists, yet create_vulnerability_report accepted code_locations unconditionally, letting the model fabricate file paths/line numbers into the customer-facing report. The existing is_whitebox flag is now threaded into the tool run-context (it propagates to child agents via dict(parent_ctx)), and code_locations are dropped when the scan is black-box; black-box guidance was added to the tool docstring and system prompt.
3. feat(llm): expose temperature, top_p, max_tokens (closes #514)
Adds optional STRIX_LLM_TEMPERATURE / STRIX_LLM_TOP_P / STRIX_LLM_MAX_TOKENS, threaded through make_model_settings into the SDK ModelSettings. All unset by default → provider defaults, so no behavior change. Params a model rejects are dropped automatically (litellm.drop_params is already enabled).
4. docs(local-models): document context-window sizing (closes #286)
Documents that agentic prompts easily exceed small local-runtime context windows (Ollama defaults to ~4096 tokens) and how to raise it. Docs only.
Verification
ruff 0.11.13(lint + format),mypy 1.16.0(strict,--install-types), andbanditare green on the full changed set.- Behavioral checks run locally for each change: the timeout setter, the black-box
code_locationsdrop (and whitebox-preserve), and generation-param threading withNonedefaults. strix --helpand importing every changed module both succeed.- No test harness is added — the project verifies statically, so introducing
pytestinfra would be out of scope for these fixes.
Greptile Summary
This PR bundles four self-contained fixes: honoring LLM_TIMEOUT in scan calls (guarded by model_fields_set so users without the env var keep LiteLLM's default), dropping fabricated code_locations in true black-box scans while correctly preserving them for repository-type targets via the new source_in_scope flag, and exposing temperature/top_p/max_tokens as optional generation params with Pydantic range constraints and None defaults.
- LLM_TIMEOUT fix:
_configure_litellm_request_timeoutis called only whenLLM_TIMEOUTis explicitly in the environment (model_fields_setcheck), so users who never set it are not silently capped at the 300 s Pydantic default. - Black-box
code_locationsfix:source_in_scope = is_whitebox or (type == \"repository\")is threaded into the root context and inherited by child agents viadict(parent_ctx)in_start_child_runner; the reporting tool dropscode_locationsonly when this flag is falsy. - Generation params: Pydantic
ge/leconstraints ontemperatureandtop_psurface bad values at config-load time;litellm.drop_paramshandles provider-level incompatibilities.
Confidence Score: 4/5
Safe to merge with awareness that litellm.request_timeout is now mutated as a module-level global on every scan start, which can affect concurrent in-flight requests if two scans with different timeouts overlap.
The _configure_litellm_request_timeout call writes to litellm.request_timeout, a module-level variable read by every acompletion call. Because it is invoked inside run_strix_scan rather than once at process startup, two concurrent scans with different LLM_TIMEOUT values can race to overwrite it mid-flight, potentially applying the wrong timeout to an already in-flight request. The model_fields_set guard correctly avoids the 300 s default regression, but the global-mutation race is a real production risk for any host running parallel scans.
strix/config/models.py — the new _configure_litellm_request_timeout function and its call site in configure_sdk_model_defaults.
Important Files Changed
| Filename | Overview |
|---|---|
| strix/config/models.py | Adds _configure_litellm_request_timeout called conditionally via model_fields_set check; extends the pre-existing module-level litellm global mutation pattern to request_timeout, which is called on every scan start and affects all in-flight concurrent requests. |
| strix/config/settings.py | Adds temperature, top_p, max_tokens optional fields with correct Pydantic ge/le constraints and None defaults; no behavior change when unset. |
| strix/core/runner.py | Correctly introduces source_in_scope (covers both local_code and repository scan types), threads it into the root context for child propagation, and wires the three new generation params into make_model_settings. |
| strix/tools/reporting/tool.py | Guards code_locations on the new source_in_scope context key, correctly preserving them for repository and local-code scans while dropping fabricated paths for true black-box targets. |
| strix/core/inputs.py | Adds temperature, top_p, max_tokens as optional kwargs to make_model_settings and passes them unconditionally to ModelSettings; None values are handled by the SDK/litellm layer. |
| strix/agents/prompts/system_prompt.jinja | Adds one-line black-box reporting instruction to the execution guidelines; no logic change. |
| docs/advanced/configuration.mdx | Documents the three new generation params; temperature range 0.0–2.0 is the constraint enforced by Strix but provider-specific narrower ranges (e.g. Anthropic: 0.0–1.0) are not mentioned. |
| docs/llm-providers/local.mdx | Adds context-window sizing guidance for Ollama, llama.cpp, LM Studio, and vLLM; docs-only change. |
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
docs/advanced/configuration.mdx:33-35
**Out-of-range temperature causes API errors, not silent drops**
The description says "Parameters unsupported by a given model are dropped automatically," but `litellm.drop_params` only removes parameters that the model does not accept **at all** — it does not sanitize out-of-range values. A user who sets `STRIX_LLM_TEMPERATURE=1.5` and points Strix at an Anthropic model (valid range: `0.0–1.0`) will get a provider API error at runtime rather than the graceful behaviour the copy implies. Clarifying that the statement refers to unsupported param *names* rather than out-of-range *values* would prevent confusion.
Reviews (2): Last reviewed commit: "Address review feedback on #549" | Re-trigger Greptile
Thanks for the review — addressed in 3804421.
1. is_whitebox=False covers repository scans (P1) — fixed. Correct catch: collect_local_sources mounts source for both local_code and repository, but is_whitebox is local_code-only, so the guard would have dropped valid code_locations on repo scans. The runner now threads source_in_scope = local_code OR repository, and create_vulnerability_report keys off that instead of is_whitebox. Repository and local-code scans keep their locations; only truly source-free scans (URL/IP/domain) drop them.
2. Default timeout 6000s → 300s regression (P1) — fixed. _configure_litellm_request_timeout is now only called when LLM_TIMEOUT is explicitly set (llm.model_fields_set). Users who never set it keep LiteLLM's built-in default; the documented setting still takes effect for scans when provided. This directly avoids regressing the slow-local-model case from #426.
3. Module-level global mutation / concurrent scans (P2) — intentionally out of scope. As noted, this is the pre-existing pattern for api_key/api_base in the same function, and Strix runs one scan per process (CLI). Reworking SDK-global config into per-scan state is a broader refactor that shouldn't ride along with these fixes — happy to file a separate issue if you'd like it tracked.
4. No range validation on temperature/top_p (P2) — fixed. Added ge=0.0, le=2.0 (temperature), ge=0.0, le=1.0 (top_p), and ge=1 (max_tokens) so bad values fail at config load; docs note the ranges.
All changes verified locally: ruff (lint + format), mypy --strict (with --install-types), bandit green, plus focused behavioral tests for the source-in-scope guard, the timeout gating, and the new bounds.
@greptile
Votre projet est super