Repository navigation
bug(runtime): every auxiliary model call fails on OpenAI Codex subscription connections (titles, goal evaluation, recap, Daily Review, prompt suggestions) #5711
Description
What happened
On an openai-codex (ChatGPT/Codex subscription OAuth) connection, main turns work, but every Host auxiliary model call fails. These are the calls that go through runHostAuxiliaryModelCall → generateToolFreeModelCall / generateProviderPrefixModelCall, which use non-streaming generateText:
- Session titles
- Goal evaluation
- Session recap
- Memory extraction
- Daily Review
- WorkHub routing
- feat(desktop): add opt-in next prompt suggestions #5629's next-prompt suggestions
For example, sessions on a Codex subscription never get an auto-generated title.
This is from a real Desktop workspace's usage_llm_calls. Every auxiliary row for the Codex connection is a failure, and none succeeded:
| model | callKind | status | errorClass | rows |
|---|---|---|---|---|
| gpt-6-astra | session_title | error | OpenAiCodexHttpError | 7 |
| gpt-6-astra | session_title | aborted | TimeoutError | 2 |
| gpt-5.6-sol | session_title | error | OpenAiCodexHttpError | 6 |
| gpt-5.5 | session_title | error | OpenAiCodexHttpError / AI_RetryError | 2 |
| gpt-5.6-sol | goal_evaluation | error | OpenAiCodexHttpError | 1 |
I captured the backend's response bodies and found three separate causes, each exposed once the one before it is fixed:
400 {"detail":"Stream must be set to true"}. The Codex backend only acceptsstream: true. Main turns stream, butgenerateTextsends a non-streaming Responses request.buildOpenAiCodexFetch(packages/runtime/src/subscription-model-fetch.ts:127-178) rewritesinstructions,storeandtext.verbosity, but notstream.400 {"detail":"Unsupported parameter: max_output_tokens"}. Every auxiliary call setsmaxOutputTokens, which the Codex backend rejects. Main turns don't send it.- Empty text after a successful stream. When forced to stream, the terminal
response.completedevent carried no output items. The usage row wassuccesswith 11 output tokens, but the assembled text was"". The message item only arrives in the earlierresponse.output_item.doneevents.
How to reproduce
- Configure an
openai-codexconnection (ChatGPT sign-in) and pick e.g.gpt-6-astra,gpt-5.6-solorgpt-5.5. - Start a new Session and finish a turn.
- The Session never gets a generated title. The Usage store records a
session_titlerow withstatus: 'error'anderrorClass: 'OpenAiCodexHttpError', and the error message carriesHTTP 400 {"detail":"Stream must be set to true"}.
For a headless check, I ran a Runtime Host from source (upstream/main) on a copy of that Desktop workspace:
- Unmodified: every
session.prompt-suggestion.generatecall recordedOpenAiCodexHttpError. - With all three causes worked around in the Codex fetch layer: suggestions came back from
gpt-6-astra, e.g.Let's go with parseISODate.andYes, give me a checklist., and the usage rows weresuccess.
Environment
- Maka commit:
f1f259b67(also present at99cfeb7e9) - OS: Windows 10 x64
- Surface: Runtime Host auxiliary model calls, visible in Desktop (Session titles, Goal, Daily Review, prompt suggestions)
- Connection:
openai-codexvia ChatGPT OAuth
Logs, screenshots, or additional context
Proposed fix, contained in buildOpenAiCodexFetch:
- When the caller's body is not streaming, send
stream: true. - Drop
max_output_tokens. - Read the SSE stream to its terminal event (
response.completed/response.incomplete/response.failed). - Rebuild
outputfromresponse.output_item.doneitems when the terminal response omits them. - Return that response as the JSON body the non-streaming Responses parser expects.
This keeps the provider quirk in the provider's fetch adapter. Auxiliary callers stay unchanged, and streaming callers are untouched.
Side effect: Codex auxiliary calls lose their output cap. They are bounded only by their prompts. The next-prompt path also rejects output over 80 characters.
A related tuning point, not part of this bug: measured gpt-6-astra suggestion latency was 3.2–8.3 s, while #5629's deadline is 5 s. So on Codex some suggestions will still time out once this is fixed.
I'm happy to send the fix.
AI disclosure: Claude Code (Claude Opus) found the failure while verifying #5690 against a real Codex connection, captured the backend responses, and drafted this issue; liugddx reviewed it and is the human contributor of record.
Activity
liugddx commentedon Sep 25, 2026
take
fix(runtime): stream and fold non-streaming Codex OAuth calls (#5723)