Skip to content

feat: add native Codex compaction - #25253

Closed
juanalcasar wants to merge 1 commit into
NousResearch:mainfrom
juanalcasar:feat/codex-native-compaction
Closed

feat: add native Codex compaction#25253
juanalcasar wants to merge 1 commit into
NousResearch:mainfrom
juanalcasar:feat/codex-native-compaction

Conversation

@juanalcasar

@juanalcasar juanalcasar commented May 13, 2026

Copy link
Copy Markdown

Summary

  • Add native Codex /responses/compact support for openai-codex in Codex Responses mode.
  • Persist and replay encrypted compaction_summary items through SessionDB/conversation reload paths.
  • Preserve textual fallback behavior and prior Codex checkpoints when native compaction fails.
  • Harden token-bearing endpoint gating to https://chatgpt.com/backend-api/codex only.
  • Sanitize Codex compaction metadata before chat-completions providers and preserve compressor api_mode across fallback/restore.

Verification

  • scripts/run_tests.sh tests/agent/test_codex_native_compaction.py tests/run_agent/test_primary_runtime_restore.py tests/agent/transports/test_chat_completions.py tests/agent/test_context_compressor.py tests/agent/test_context_compressor_summary_continuity.py tests/run_agent/test_run_agent_codex_responses.py tests/agent/transports/test_codex_transport.py tests/test_hermes_state.py tests/test_hermes_state_wal_fallback.py — 511 passed
  • python -m compileall -q on touched Python files — passed
  • git diff --check — passed
  • Live smoke test against https://chatgpt.com/backend-api/codex/responses/compact — returned compaction_summary with encrypted content
  • Independent reviewer re-review — approved after blocker fixes

Notes

  • Full suite was run and had unrelated/orthogonal failures outside the changed Codex compaction surface. Focused coverage for the modified surfaces is green.
  • Security-sensitive endpoint detection avoids substring matching and requires HTTPS, exact host, and exact path.
  • The live endpoint rejects store on /responses/compact; replay still uses the normal Codex Responses path semantics.

@juanalcasar
juanalcasar marked this pull request as ready for review May 13, 2026 22:05
@alt-glitch alt-glitch added type/feature New feature or request P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/openai OpenAI / Codex Responses API labels May 13, 2026
Add native /responses/compact support for openai-codex in Codex Responses mode, including encrypted compaction item replay through SessionDB and gateway reload paths.

Preserve textual fallback behavior, retain prior Codex checkpoints during fallback, and harden endpoint gating to HTTPS chatgpt.com/backend-api/codex only.

Also sanitize Codex compaction metadata before chat-completions providers and preserve compressor api_mode across fallback/restore.

Verification:
- scripts/run_tests.sh focused surface: 511 passed
- python -m compileall on touched files
- git diff --check
- independent review approved after blocker fixes

Note: full suite has unrelated pre-existing/orthogonal failures outside the changed Codex compaction surface.
@juanalcasar
juanalcasar force-pushed the feat/codex-native-compaction branch from 240aabe to 3ed527a Compare May 13, 2026 22:15
@juanalcasar

Copy link
Copy Markdown
Author

Closing at request of the author.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists provider/openai OpenAI / Codex Responses API type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants