skillguard/.agents/memory/openai-temperature-gpt5.md
amertensreplit 9f7b67972f Task #2: Skill mit konfigurierter KI tatsächlich semantisch analysieren
Verified the AI analysis end-to-end with a real provider and fixed two gaps
found during the live run.

Findings & fixes:
- gpt-5 series (Replit AI Integrations modelfarm default) rejected the hardcoded
  `temperature: 0.1` with HTTP 400, silently disabling AI analysis. Removed the
  temperature param from the OpenAI-compatible request for broad model
  compatibility (aiAnalysis.ts).
- Per-rule AI config (enable/disable/severity) was only a global on/off gate and
  AI findings weren't mapped to the AI rule IDs, so individual rule severity was
  ignored. runAiAnalysis now receives the enabled AI rules, instructs the model
  to classify each finding into one of those ruleIds, drops findings for
  disabled rules, and overrides severity/axis with the configured values
  (aiAnalysis.ts + scanEngine.ts).

End-to-end verification (Replit OpenAI integration, gpt-5-mini provider):
- "KI-Analyse aktivieren" produces AI findings mapped to AI-PROMPT-INJECTION,
  AI-MALICIOUS-INTENT, AI-DATA-PRIVACY.
- Disabling AI-MALICIOUS-INTENT removed its finding; setting AI-PROMPT-INJECTION
  to critical was reflected in the result.
- Wrong baseUrl and invalid token (real OpenAI endpoint) produce understandable
  aiError messages with no token leak.

Side effects / notes:
- Set up the Replit OpenAI AI Integration (env vars) and created one enabled
  provider row ("Replit OpenAI") so AI analysis works out of the box. Each
  AI-enabled scan bills the user's Replit credits.
- Test scans created during verification were deleted.
- artifacts/api-server typecheck passes.

Replit-Task-Id: 7321caa4-5079-4db7-8ed2-4ccaa74fa577
2026-06-10 13:56:15 +00:00

1.1 KiB

name description
OpenAI gpt-5 series rejects non-default temperature gpt-5* models error on temperature != 1; omit temperature in OpenAI-compatible clients for cross-model compatibility

OpenAI-compatible client: do not send a non-default temperature

When calling OpenAI-compatible chat/completions, the gpt-5 series (e.g. gpt-5-mini, the Replit AI Integrations modelfarm default) returns HTTP 400 unsupported_value: "temperature does not support 0.1 with this model. Only the default (1) value is supported." This silently disables AI analysis (aiUsed:false, aiError set).

Rule: omit temperature from the request body for broad model compatibility, rather than hardcoding a low value for determinism.

Why: older models accepted temperature: 0.1 but gpt-5* only accept the default. A hardcoded low temperature breaks every scan against modern models.

How to apply: in artifacts/api-server/src/lib/aiAnalysis.ts the OpenAI-compatible path no longer sends temperature. If reintroducing sampling controls, gate them per model or make them optional.