Skip to content

fix(core): preserve OpenAI OAuth model context limits - #53080

Open
marwasha wants to merge 2 commits into
anomalyco:v2from
marwasha:oauth-context-limits
Open

marwasha wants to merge 2 commits into
anomalyco:v2from
marwasha:oauth-context-limits

Conversation

@marwasha

@marwasha marwasha commented Oct 4, 2026

Copy link
Copy Markdown

Issue for this PR

Fixes #47646

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Preserves model-specific context and input limits when connected through ChatGPT OAuth, removing the blanket 400K/272K override. Long-context models retain their catalog limits instead of reporting inflated context usage and compacting prematurely.

Updates the provider regression test to cover long-context models, a fast alias, and a smaller-context model.

How did you verify your code works?

  • Confirmed the updated regression fails with 400K/272K before the fix.
  • bun run test test/plugin/provider-openai.test.ts in packages/core: 5 passed.
  • bun typecheck in packages/core: passed.
  • Root bun run check: passed (lint warnings, no errors; 36 typecheck tasks succeeded).
  • Prettier check for both changed files: passed.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@marwasha

marwasha commented Oct 4, 2026

Copy link
Copy Markdown
Author

The needs:issue label appears to be a false positive: this PR has contained Fixes #47646 since opening. The standards run checks only closingIssuesReferences, which is empty for this PR targeting v2 rather than the default dev branch; the template-compliance check passes.

@rekram1-node, could you review this OpenAI provider fix when you have a chance, and help link #47646/remove the incorrect label? I chose you based on your recent changes in this provider. The production change removes the two-line blanket limit override; regression coverage checks long-context models, a fast alias, and a smaller-context model. The regression failed before the fix and passes afterward; the focused suite, core typecheck, and full bun run check pass locally.

rezenderaul added a commit to rezenderaul/opencode that referenced this pull request Oct 4, 2026
Drop the blanket 400K/272K override for gpt-5.5/5.6 OAuth models so
long-context models keep catalog limits instead of compacting
prematurely, and smaller-context models are not inflated.

Upstream: anomalyco#53080
@marwasha

marwasha commented Oct 5, 2026

Copy link
Copy Markdown
Author

Additional runtime verification on PR head dc65500: built the Linux x64 CLI with Bun 1.4.2 and ran its private server with a ChatGPT OAuth connection. After catalog initialization, /api/model reports {context: 1050000, input: 922000, output: 128000} for gpt-6.1-sol, gpt-6-astra, gpt-6-astra-fast, gpt-5.6-sol, and gpt-5.5, all using https://chatgpt.com/backend-api/codex. The five provider tests also pass on this head.

This verifies the effective metadata in the compiled server; it does not claim a million-token inference test.

@marwasha

marwasha commented Oct 5, 2026

Copy link
Copy Markdown
Author

Could a maintainer triage this for an OpenAI provider review, clear the false-positive needs:issue label, and enable any required upstream CI? This targets v2 and references #47646; local verification is listed above.

The key review question is whether ChatGPT OAuth should preserve model catalog limits instead of imposing the Codex CLI budget. #44821 reports a controlled GPT-5.6 Sol request accepting 921,858 input tokens through OAuth—evidence that the blanket 272K input cap is too low for that account/route, though not proof of identical capacity for every account. This PR preserves each model’s existing limits rather than introducing another universal limit.

If maintainers require account-specific limit discovery or an opt-in approach instead, guidance on that decision would help move the fix forward.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant