You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Grok Build turns on ChatGPT-backed OpenAI models get almost no prompt-cache reuse (missing session_id) #6481
Grok Build (the grok CLI, wired by ocx through the managed [model_providers.opencodex] block with x-opencodex-grok = "1") gets almost no prompt-cache reuse when it uses an OpenAI model served by the ChatGPT Codex backend (for example gpt-6-astra). The same model used from Codex reuses the prefix normally.
From the last 400 request-log entries on one machine:
Surface
Model
Requests
Cached input share
Affinity
Codex
gpt-6-astra
122
97.1%
—
Grok
gpt-6-astra
88
13.6%
new_bind on all 88
Grok
claude-opus-5-5
31
90.8%
—
The Grok rows show cachedInputTokens of 0 or a fixed 3200/4992 regardless of conversation length, and conversationId is never set.
Cause: Grok sends its conversation identity as x-grok-conv-id / x-grok-session-id and as the body prompt_cache_key, but it never sends the session_id header that Codex clients send. The ChatGPT Codex backend only reuses a warmed prefix when session_id is present, and opencodex also reads that header for thread affinity and request-log conversation identity. Grok's request bodies are append-only across turns (checked by diffing consecutive captured bodies: tools identical, input a strict prefix), so the client is not the problem.
Reproduction
ocx with an OpenAI (ChatGPT) account and the Grok integration enabled.
In Grok Build, pick ocx-gpt-6-astra and run a multi-turn task (several tool calls).
Open Logs: every Grok/gpt-6-astra row is affinity: new_bind and cached input stays near zero.
A/B confirmation by replaying one captured Grok request body (≈16.7k input tokens) three times against /v1/responses with the Grok headers:
Activity
fix(grok): forward the Grok conversation as session_id so OpenAI pref…
lidge-jun commentedon Oct 3, 2026
Fixed on dev by #6482.