Skip to content

Fix Codex per-model context and compaction configuration - #53

Merged
scaryrawr merged 1 commit into
mainfrom
scaryrawr-codex-auto-compaction
Nov 17, 2026
Merged

scaryrawr merged 1 commit into
mainfrom
scaryrawr-codex-auto-compaction

Conversation

@scaryrawr

Copy link
Copy Markdown
Owner

Summary

Codex configuration rewrites deleted user-set auto-compaction limits, and catalog reconstruction could discard the selected model's known context window when status metadata was missing. Catalog entries also lacked a ceiling to prevent a stale global Codex context override from raising a model's advertised limit.

  • Emit each model's effective server context as both context_window and max_context_window, plus an explicit auto-compaction threshold at Codex's existing 90% default.
  • Preserve selected-model metadata when reconstructing the catalog without status, and retain user-set compaction settings across repeated config rewrites.
  • Document the distinction between global overrides and per-model budgets. Existing Codex sessions need a restart after context limits change; this does not establish a fix for long-context memory-pressure failures.

Validation

Apple M4 Max, 128 GiB RAM; Python 3.12.

  • UV_PYTHON=python3.12 uv run --python python3.12 pytest tests/test_integrations.py tests/test_context_window.py -q - passed, 309 tests.
  • Bundled Codex 0.169.0-alpha.11.1, using a loopback mock Responses endpoint and the Flash-Next catalog entry: a fresh process with a stale model_context_window=262144 override reported 194,560 usable tokens, respecting the catalog's 204,800-token ceiling and Codex's 95% usable-context calculation. No model inference was performed.
  • Full suite and real-model long-context inference were not run.

Checklist

  • I read CONTRIBUTING.md.
  • I understand every change in this PR and can explain it in review.
  • For UI or UX changes, I attached before and after screenshots. (N/A: no UI changes.)

Emit explicit catalog context ceilings and compaction budgets, retain selected-model limits when status is unavailable, and preserve user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 17, 2026 21:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approved

The review reports no active issues with the Codex context-limit and compaction-setting changes.

No open issues 🎉

What changed in this PR

This PR updates oMLX’s Codex integration to preserve user compaction settings while keeping context limits tied to each served model.

Changes:

  • Add per-model context ceilings and explicit auto-compaction thresholds at 90% of the effective context window.
  • Preserve selected-model metadata when status data is missing and retain user compaction settings across configuration rewrites.
  • Add regression tests and document global settings, per-model limits, and the need to restart Codex after context changes.
File Description
tests/​test_integrations.py Tests per-model limits, missing-status fallback, and compaction-setting preservation.
README.md Explains compaction settings, catalog limits, and restart requirements.
omlx/​integrations/​codex.py Adds catalog limits, preserves selected-model metadata, and retains user compaction overrides.

Review effort: Balanced

@scaryrawr
scaryrawr merged commit 083c988 into main Nov 17, 2026
1 of 3 checks passed
scaryrawr added a commit that referenced this pull request Nov 18, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Nov 18, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Nov 19, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Nov 20, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Nov 21, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Nov 21, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Nov 22, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Nov 22, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Nov 23, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Nov 24, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Nov 25, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Nov 27, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Nov 29, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Nov 30, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Dec 1, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Dec 2, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Dec 3, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Dec 3, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Dec 4, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scaryrawr added a commit that referenced this pull request Dec 4, 2026
Emit explicit catalog context ceilings and compaction budgets, use selected-model limits when status is unavailable, and respect user compaction settings across configuration rewrites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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