Skip to content

fix: handle GPT-5 Chat Completions with deterministic parameters - #736

Merged
666ghj merged 2 commits into
mainfrom
agent/round2-pr-498-exec
Jul 22, 2026
Merged

fix: handle GPT-5 Chat Completions with deterministic parameters#736
666ghj merged 2 commits into
mainfrom
agent/round2-pr-498-exec

Conversation

@666ghj

@666ghj 666ghj commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • route GPT-5-family Chat Completions requests through a deterministic parameter policy
  • use max_completion_tokens and omit unsupported temperature values for GPT-5-family models
  • preserve the existing request shape for legacy models
  • keep response_format unless the caller explicitly omits it
  • extract text safely from supported SDK response content shapes
  • propagate provider errors instead of retrying based on error-message text

Why

PR #498 correctly identified that unconditional legacy parameters can make GPT-5-family requests fail. Its adaptive retry removed parameters by matching provider error strings, which could mutate valid requests unpredictably and hide unrelated failures. It also removed supported parameters too broadly and carried unrelated lockfile churn.

The maintained version uses an explicit model-family mapping and keeps provider errors observable.

Validation

  • uv run pytest -q tests/test_openai_chat_compat.py — 9 passed
  • covered GPT-5 and legacy request shapes, error propagation, and response content extraction
  • Python compileall passed
  • frontend production build passed
  • git diff --check passed
  • reconstructed on the current main branch

No paid OpenAI API request was made; the official parameter contract and mocked SDK boundary were used.

Preserves the original contributor commit and supersedes #498.

🤖 Sent by the MiroFish repository maintenance agent.

@666ghj 666ghj added LLM API Any questions regarding the LLM API size:L This PR changes 100-499 lines, ignoring generated files. labels Jul 22, 2026
@666ghj
666ghj merged commit 666a188 into main Jul 22, 2026
@666ghj
666ghj deleted the agent/round2-pr-498-exec branch July 22, 2026 12:17
brovzar-lab pushed a commit to brovzar-lab/MiroFish-Lemon that referenced this pull request Jul 28, 2026
Brings in: Zep memory cap for long runs (OOM fix, PR 666ghj#730), zep-cloud 3.25
modernization + barrier tests (666ghj#738-740), profile normalization (666ghj#737),
honest FAILED states (666ghj#732/666ghj#735), fabricated tool_result stripping (666ghj#734),
ontology JSON hardening + long-text sampling (666ghj#742/666ghj#584), GPT-5 param
compat (666ghj#736), Twitter-only data fix (666ghj#733), security fixes (666ghj#445/666ghj#727).

Conflict resolutions:
- llm_client.py: upstream compat-layer base + Lemon CreditExhaustedException
  (402 -> pause/Resume) re-added in _create_completion
- api/report.py: upstream barrier/lifecycle base + Lemon failed-report
  resume (reuse report_id), project-language locale for report thread,
  title-based download filename, 404 on empty download
- report_agent.py: upstream cleaned_response/tool_result stripping kept;
  Lemon language-instruction injection + partial-report salvage intact
- Step3Simulation.vue: upstream authoritative runner_status (drops Lemon
  platformsCompleted shortcut, superseded by the Zep ingestion barrier)

139 backend tests pass; vite build clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LLM API Any questions regarding the LLM API size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants