Skip to content

fix: Codex preflight summaries fail with unsupported max_output_tokens #663

Description

@Wuxie233

Problem

With billion-context 0.1.95 proxying Codex through https://chatgpt.com/backend-api/codex/responses, an over-window request enters preflight compression, but the summary request is rejected with:

{"detail":"Unsupported parameter: max_output_tokens"}

Bili then returns HTTP 502 (preflight compression could not bring it under ... HTTP 400). Repeated client retries cannot recover the session.

Reproduction

  1. Use the Codex ChatGPT Responses backend with valid authentication (credentials omitted).
  2. Trigger proxy-side preflight compression for an over-window conversation.
  3. src/preflight.ts builds a Responses summary payload with max_output_tokens: MAX_SUMMARY_OUTPUT_TOKENS.
  4. The backend rejects that parameter with HTTP 400. A minimal authenticated request with this field reproduces the rejection independently of history size.

Observations

  • Ordinary short streaming model requests succeed through the same outbound proxy.
  • Existing Bili compression had successfully reduced an earlier turn; context management was active.
  • The previous upstream usage was approximately 92k tokens, while the next processed payload was locally estimated at approximately 437k against a configured 272k budget. These are different measurements, not proof of a tokenizer defect.
  • The immediate blocker is the unsupported summary parameter. The source of the payload growth is not yet established.
  • Existing summary fallback handles stream must be true, but not this parameter rejection.

Expected behavior

Generate a compatible summary request for the Codex ChatGPT backend (or narrowly learn/retry the explicitly rejected optional parameter), while retaining output limits for standard Responses providers and preserving the preflight overflow guard. Cover both summary generation and successful recovery/forwarding in regression tests.

No credentials, session contents, or private host configuration are included. We are preparing a minimal local fix to restore availability.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions