Conversation
WindLX
force-pushed
the
codex/output-budget-handoff
branch
from
September 29, 2026 08:52
4def866 to
156f6f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #69
Proxy-side issue: ranxianglei/billion-context#1678
Summary
Preserve the pre-clamp requested ceiling on the OpenAI transport using
x-bili-output-budget: <requested>:<raw-clamped>. Keep max_tokens's existing raw-input clamp for direct requests. A coordinated billion-context change consumes this metadata before rebuilding/compression, recalculates the reservation against rebuilt input, and removes the header before upstream forwarding.The header is sent even when the two values are equal, allowing the proxy to preserve deliberately small user budgets rather than apply its historical starvation heuristic. CLI transport remains unchanged because /alpha/generate is not a supported compression route. No extra retry, effort change, catalog/window inflation, config option, or history migration.
Compatibility and review
This is a cross-plugin protocol proposal, not a standalone fix. Older proxies/direct routes retain the clamped JSON budget. Both implementations must ship for the affected native DSH integration to benefit. Header naming and handshake design need maintainer agreement; this PR is intentionally a draft. The plugin version and Harness peer ranges are unchanged.
Verification
npm run typecheck: pass.npm test: 714 passed.npm run build: pass; generated lib/index.js and source map included according to the repository's existing tracked artifact surface.npm run test:engine: passed against DSH 0.2.0-rc.1 on the same adapter change before PR staging.Only synthetic fixtures and source changes are included; no user conversation, credentials, local config or traces are published.