Responses ingress ignores body prompt_cache_key when no session_id header is sent, so non-Codex clients (OMP) get near-zero cache reuse on ChatGPT-backed models

Aperta
#9,137 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@shu-chen-dot-ca ci sta già lavorando.

Dal 25/11/2026.

  • #9145 di @shu-chen-dot-ca — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
api, backend

Direzione di ricerca

Start with conversationIdFromResponsesRequest in src/server/responses/request-prepare.ts and compare how src/grok/session-identity.ts promotes a request identifier. Trace how the Responses ingress maps conversation identity to the upstream session_id; done means a request with prompt_cache_key and no session header gets the intended affinity. Issue #9145 already has an open pull request, so check its status before starting.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug proxy
Client or integration

Other — Oh My Pi (OMP) 19.1.1 calling /v1/responses on the loopback endpoint (api: openai-responses)

Area

Proxy and routing

Summary

OMP sends a stable per-session prompt_cache_key in the Responses body but no session_id / session-id / thread-id header. opencodex resolves the conversation identity on the Responses ingress from headers only (conversationIdFromResponsesRequest in src/server/responses/request-prepare.ts), so every OMP request is logged with affinity: "unbound", affinityReason: "no_conversation", and the ChatGPT Codex backend does not reuse the warmed prefix.

#6520 fixed the same symptom for Chat Completions ingress by promoting x-session-id (#6880). The Responses ingress has no equivalent fallback for a caller that only sends prompt_cache_key.

Expected: when no session header is present, use the body prompt_cache_key as the upstream session_id (the same way src/grok/session-identity.ts promotes x-grok-conv-id), or offer an opt-in for it.

Reproduction
  1. Build one ~73K-token Responses body for gpt-6.2-sol with "prompt_cache_key": "capt-test-key-1", store: false, reasoning.effort: "low".
  2. POST it to http://127.0.0.1:10100/v1/responses three times without a session header, then three times with session_id: <fixed uuid>.
Header input_tokens_details.cached_tokens (1st, 2nd, 3rd)
no session_id 0, 0, 0
session_id set 0, 72832, 72832

Same account, same model, same byte-identical body; only the header differs.

Version

2.100.8

Operating system

macOS (Darwin 27.2.0, arm64)

Provider and model

OpenAI (ChatGPT OAuth) — gpt-6.2-sol, gpt-6.2-astra

Logs or error output

From usage.jsonl, OMP /v1/responses traffic on GPT models (requests with more than 20K input tokens):

client / affinityReason requests cached share
unknown / no_conversation (OMP, no session header) 342 32.6%
unknown / request_owned (conversation id present) 161 80.1%
codex_cli / request_owned 32 89.0%

Within one OMP session, the cached count jumps between 0, ~17,920, and partial values from turn to turn while the prefix only grows.

Headers OMP sends (captured): accept, accept-encoding, connection, content-length, content-type, host, user-agent: omp/19.1.1. Body keys: model, input, stream, prompt_cache_key, store, max_output_tokens, tools, include, reasoning.

Checks
  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.
Lingua principale
TypeScript
Stelle
16.9k
Fork
1.3k
Merge medio
1g 4h
PR unite (30g)
814

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di lidge-jun/opencodex

Tutte le issue di lidge-jun/opencodex

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.