Skip to content

[codex] expose model context windows#31

Merged
0x4007 merged 1 commit into
developmentfrom
codex/model-context-window-capabilities
May 12, 2026
Merged

[codex] expose model context windows#31
0x4007 merged 1 commit into
developmentfrom
codex/model-context-window-capabilities

Conversation

@0x4007

@0x4007 0x4007 commented May 12, 2026

Copy link
Copy Markdown
Member

Summary

  • Preserves Codex snapshot token-window metadata during CLI extraction and admin upload normalization.
  • Exposes context_window_tokens, max_context_window_tokens, and auto_compact_token_limit_tokens from GET /uos/models/capabilities while keeping /v1/models OpenAI-shaped.
  • Carries capability token-window fields through the browser model merge and documents the client contract.

Why

Clients need context-window limits, but OpenAI-compatible /v1/models should not grow gateway-only fields. The gateway-specific capabilities endpoint is the right place for this metadata.

Validation

  • deno fmt scripts/codex-models.ts src/openai.ts src/admin.ts tests/codex-models.test.ts tests/openai-compat.test.ts tests/admin-auth.test.ts static/chat.js README.md static/docs/llms-agents.md
  • deno lint scripts/codex-models.ts src/admin.ts src/openai.ts tests/codex-models.test.ts tests/admin-auth.test.ts tests/openai-compat.test.ts static/chat.js
  • deno test -A tests/codex-models.test.ts tests/admin-auth.test.ts tests/openai-compat.test.ts
  • deno task build
  • deno task lint
  • deno test --env --allow-env=VOYAGEAI_API_KEY

Note: deno task test currently fails on development because tests/embeddings.test.ts reads VOYAGEAI_API_KEY but the task does not grant that env permission. I kept that unrelated config fix out of this PR; local branch codex/fix-test-env-permission contains the one-line task change.

@github-actions

Copy link
Copy Markdown

@0x4007 0x4007 marked this pull request as ready for review May 12, 2026 20:26
@0x4007

0x4007 commented May 12, 2026

Copy link
Copy Markdown
Member Author

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown

@0x4007 On it!

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b5914624-8312-4f18-9940-95aa5a335d4c

📥 Commits

Reviewing files that changed from the base of the PR and between 7cbc13b and 38c3490.

📒 Files selected for processing (9)
  • README.md
  • scripts/codex-models.ts
  • src/admin.ts
  • src/openai.ts
  • static/chat.js
  • static/docs/llms-agents.md
  • tests/admin-auth.test.ts
  • tests/codex-models.test.ts
  • tests/openai-compat.test.ts

📝 Walkthrough

Walkthrough

This PR extends the model capabilities system to propagate three numeric fields—context_window, max_context_window, and auto_compact_token_limit—from Codex model metadata through CLI ingestion, normalization, OpenAI API transformation, and client-side merging. Normalization helpers validate and truncate numeric inputs. The gateway endpoint /uos/models/capabilities now exposes these as token-denominated capability fields, while /v1/models remains OpenAI-compatible without these gateway extensions. Documentation and tests are updated throughout.

Possibly related PRs

  • ubiquity/ai.ubq.fi#28: Extends the same model-capabilities handling logic in src/openai.ts and static/chat.js that this PR depends on for field mapping and client-side merging.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main change: exposing model context windows through new capability fields across the codebase.
Description check ✅ Passed The description clearly outlines the changes, rationale, and validation steps performed, directly aligning with the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/model-context-window-capabilities

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@0x4007 0x4007 merged commit fa3cb41 into development May 12, 2026
2 checks passed
@0x4007 0x4007 deleted the codex/model-context-window-capabilities branch May 12, 2026 20:36
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.

1 participant