Skip to content

feat(openai): make million-token context an explicit opt-in - #112916

Merged
steipete merged 3 commits into
mainfrom
steipete/fervent-easley-09d5c5
Jul 23, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/fervent-easley-09d5c5

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

OpenAI GPT-5.5 and GPT-5.6 expose a 1,050,000-token Platform API context window, but requests above 272,000 input tokens use materially higher long-context pricing. OpenClaw currently exposes the full GPT-5.6 window by default, which makes ordinary API-key sessions unexpectedly expensive, while the long-context configuration and Codex harness proof are incomplete.

This also fixes the Codex live harness silently ignoring its context overrides because app-server configuration flags were placed before the subcommand instead of after it.

Why This Change Was Made

The OpenAI plugin now keeps the native provider window as metadata while defaulting GPT-5.5 and GPT-5.6 active runtime budgets to 272,000 tokens across API-key and ChatGPT/Codex routes. Operators can explicitly opt into a derived 922,000-token input budget, with a conservative 700,000-token compaction target that leaves room for a large incoming turn.

The Codex harness now projects native context-window and prompt-token usage, applies app-server overrides in the correct argument position, and has separate automatic-compaction and full-context checkpoint stress modes. The embedded OpenAI runtime gets a permanent live repeated-compaction test as well.

AI-assisted: implementation and review used Claude Code and Codex autoreview. I understand and verified the resulting ownership boundaries and runtime behavior.

User Impact

  • Normal OpenAI GPT-5.5 and GPT-5.6 sessions stay on the 272,000-token cost tier by default.
  • Users who need long context can configure 922,000 input tokens explicitly for either the embedded OpenClaw runtime or native Codex harness.
  • The documented 700,000-token compaction target leaves 175,900 tokens before Codex's effective guard and 222,000 before the provider-safe input allowance.
  • /status and live proof can observe Codex's native effective context window instead of relying only on OpenClaw catalog metadata.

Evidence

pnpm check:changed was also attempted on Blacksmith Testbox https://github.com/openclaw/openclaw/actions/runs/29957455751; it stopped on the existing main-branch max-lines baseline shrink requirement before reaching changed-surface gates. Focused tests, build, docs checks, and live proofs above passed on the final candidate.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling extensions: openai extensions: codex size: L maintainer Maintainer-authored PR labels Jul 23, 2026
@steipete
steipete marked this pull request as ready for review July 23, 2026 05:19
@steipete
steipete force-pushed the steipete/fervent-easley-09d5c5 branch from ee66313 to 016d79b Compare July 23, 2026 06:28
@clawsweeper

clawsweeper Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: feat(openai): make million-token context an explicit opt-in This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete force-pushed the steipete/fervent-easley-09d5c5 branch from 016d79b to 060748d Compare July 23, 2026 07:05
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for 060748d883ce518201004a8730ab210e277548a2:

  • Focused OpenAI/Codex tests passed: provider catalog/defaults, native usage projection, app-server argument ordering, and harness helpers.
  • pnpm build passed, including dynamic import and plugin SDK surface checks.
  • Docs MDX, link, glossary, and generated map checks passed.
  • Embedded OpenAI live GPT-5.6 Terra proof used a 922k input budget with a 700k compaction target, crossed 272k prompt tokens, completed two automatic compactions, and retained the durable marker.
  • Native Codex live GPT-5.6 Terra proof reported an 875.9k effective window, crossed 272k prompt tokens, completed two compaction checkpoints per wave, restarted Gateway/app-server, repeated the wave, and continued successfully.
  • Native Codex reduced-threshold proof completed automatic compaction, persisted-count reconciliation, restart, and marker retention.
  • Control UI live dev proof completed three real compactions and continued successfully.
  • pnpm deadcode:exports passed after keeping usage helpers internal.
  • Final Codex autoreview was clean with no accepted/actionable findings.
  • Public model identifier audit passed against current official OpenAI model pages.

Known gap: the first Testbox check:changed attempt stopped on a then-current unrelated max-lines baseline shrink check. Exact-head hosted CI is now green after the PR-local docs-map, max-lines, and unused-export corrections.

@steipete
steipete merged commit 9f13f9b into main Jul 23, 2026
115 checks passed
@steipete
steipete deleted the steipete/fervent-easley-09d5c5 branch July 23, 2026 09:34
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 24, 2026
…#112916)

* feat(openai): add safe long-context opt-in

* fix(ci): keep long-context checks within gates

* fix(ci): keep Codex usage helpers internal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: codex extensions: openai gateway Gateway runtime maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant