Skip to content

Fix Codex Responses WebSocket memory retention and weekly limit handling - #1581

Closed
be0hhh wants to merge 1 commit into
cheaper-inference:release/v3.7.0from
be0hhh:fix-codex-gpt-5-5-websocket-oom-fix
Closed

be0hhh wants to merge 1 commit into
cheaper-inference:release/v3.7.0from
be0hhh:fix-codex-gpt-5-5-websocket-oom-fix

Conversation

@be0hhh

@be0hhh be0hhh commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Serialize Codex Responses WebSocket client frame processing and add bounded buffer/message limits with 1009 close handling for oversized frames.
  • Tighten Codex executor stream lifecycle cleanup: remove abort listeners, implement cancel, close upstream sockets on terminal/abort/cancel, and avoid enqueue/send after closure.
  • Bound memory extraction, request logging, stream summaries, semantic cache writes, and detailed stream chunk retention so large Codex sessions do not retain multi-hundred-message request/response payloads after completion.
  • Map Codex WS response.failed/error quota and usage-limit failures to 429, and propagate late stream failures so the selected Codex account is marked unavailable for the next retry/request.
  • Replace direct internal bridge secret comparison with timing-safe hash comparison.

Verification

  • node --import tsx/esm --test tests/unit/responses-ws-proxy.test.mjs tests/unit/executor-codex.test.ts tests/unit/stream-utils.test.ts tests/unit/memory-extraction.test.ts tests/unit/translator-resp-openai-responses.test.ts tests/unit/quota-policy-generalization.test.ts tests/unit/codex-quota-fetcher.test.ts
  • npm run build:cli (completed; existing MITM TypeScript warnings are non-fatal in prepublish)
  • npm run check:pack-artifact
  • npm pack --dry-run
  • npm install -g .
  • omniroute --version -> 3.6.9

@be0hhh
be0hhh requested a review from diegosouzapw as a code owner April 25, 2026 06:00
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@diegosouzapw
diegosouzapw changed the base branch from main to release/v3.7.0 April 25, 2026 10:18
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Olá @be0hhh! Muito obrigado por essa contribuição massiva e importante para estabilizar a memória do WebSocket do Codex! 🎉

Durante o processo de merge para a branch release/v3.7.0, encontramos alguns conflitos de mesclagem severos.

Isso aconteceu porque a PR #1573 (feat(codex): support GPT-5.5 responses websocket) foi mergeada recentemente e já introduziu grande parte da estrutura do WebSocket Proxy (como o arquivo scripts/responses-ws-proxy.mjs e rotas internas) que esta PR também tenta adicionar ou modificar.

Para podermos seguir com a sua PR e integrá-la ao próximo lançamento (v3.7.0), precisamos que você resolva esses conflitos atualizando a sua branch com as mudanças mais recentes da release/v3.7.0.

🛠️ Passo a Passo para Resolver os Conflitos (Rebase):

  1. Atualize seu repositório local:

    git fetch upstream

    (Nota: assumindo que upstream aponta para diegosouzapw/OmniRoute e origin é o seu fork).

  2. Faça o checkout da sua branch:

    git checkout fix-codex-gpt-5-5-websocket-oom-fix
  3. Inicie o rebase em cima da branch de lançamento:

    git rebase upstream/release/v3.7.0
  4. Resolva os conflitos:
    O Git vai pausar nos arquivos com conflito (principalmente em providerRegistry.ts, executors/codex.ts, route.ts e os scripts/testes do responses-ws-proxy).
    Abra sua IDE, remova as linhas duplicadas da feat(codex): support GPT-5.5 responses websocket #1573 e preserve as suas melhorias de uso de memória e segurança (hash comparison).
    Após resolver os conflitos de um arquivo, use:

    git add <arquivo-resolvido>

    E continue o processo:

    git rebase --continue
  5. Envie as alterações atualizadas:
    Como a história do Git foi alterada com o rebase, você precisará forçar o push:

    git push origin fix-codex-gpt-5-5-websocket-oom-fix --force

Assim que isso for feito e os testes (CI) passarem, ficaremos felizes em fazer o merge definitivo! Obrigado novamente pela dedicação! 🚀

@be0hhh

be0hhh commented Apr 25, 2026

Copy link
Copy Markdown
Contributor Author

Okey! i will do it soon :)

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks @be0hhh for this extensive fix! 🎉 I have manually resolved the merge conflicts and squashed it directly into the release/v3.7.0 branch. It will be part of the upcoming v3.7.0 release. Great work on the memory optimization and the WS lifecycle cleanup!

@be0hhh

be0hhh commented Apr 25, 2026

Copy link
Copy Markdown
Contributor Author

oh I see, thanks

@diegosouzapw diegosouzapw mentioned this pull request Apr 25, 2026
diegosouzapw pushed a commit that referenced this pull request Apr 28, 2026
…ession from #1581) (#1715)

Integrated into release/v3.7.3 — restores Codex namespace MCP tools and hosted-tool whitelist
This was referenced Apr 28, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…ession from cheaper-inference#1581) (cheaper-inference#1715)

Integrated into release/v3.7.3 — restores Codex namespace MCP tools and hosted-tool whitelist
Poid-ZA pushed a commit to Poid-ZA/OmniRoute that referenced this pull request Aug 5, 2026
Poid-ZA pushed a commit to Poid-ZA/OmniRoute that referenced this pull request Aug 5, 2026
…ession from cheaper-inference#1581) (cheaper-inference#1715)

Integrated into release/v3.7.3 — restores Codex namespace MCP tools and hosted-tool whitelist
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…ession from cheaper-inference#1581) (cheaper-inference#1715)

Integrated into release/v3.7.3 — restores Codex namespace MCP tools and hosted-tool whitelist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants