GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — docs(compaction): ceiling doesn't document limit.input vs limit.context precedence; context-only limit overrides are a silent no-op · Issue #52954 · anomalyco/opencode

docs(compaction): ceiling doesn't document limit.input vs limit.context precedence; context-only limit overrides are a silent no-op #52954

New issue
Copy link
New issue
Copy link
Done
#66803
Done
docs(compaction): ceiling doesn't document limit.input vs limit.context precedence; context-only limit overrides are a silent no-op#52954
#66803
Copy link
Assignees
jlongster

Description

@Kusts
Kusts
opened on Oct 3, 2026
Issue body actions

Description

The V2 docs never specify which model limit drives the automatic-compaction ceiling. In v2.0.22 the code computes the ceiling from limit.input || limit.context (packages/core/src/session/compaction.ts, calculateCeiling, reserve = max(window * 0.1, 16_000)). For split-window models (catalog input < context), auto-compaction therefore targets the input window, and a user config limit override of only context silently does not change the ceiling — the override must set both fields. This makes the workaround for #44821 undiscoverable from the docs.

Environment

  • Docs pages checked (2026-10-03): /v2/docs/compaction, /v2/docs/config, /v2/docs/providers, /v2/docs/models
  • Behavior verified against: opencode v2.0.22 source (packages/core/src/session/compaction.ts, packages/core/src/config/plugin/provider.ts) and a running v2.0.22 instance (/api/model)
  • OS: Windows x64 (docs issue; behavior verified locally on this platform)

Reproduction

  1. Read /v2/docs/compaction: "When a session approaches the model's context limit..." — no mention of limit.input vs limit.context.
  2. Configure a split-window model override raising only context, e.g. providers.openai.models."gpt-6.1-sol".limit = { "context": 1050000 } while the effective catalog input is clamped to 272000 by the ChatGPT OAuth transform (see fix(openai): OAuth transform treats Codex product budget as endpoint context limit #44821).
  3. Observe that auto-compaction still fires near the input-based ceiling (272000 − max(27200, 16000) = 244800), not near the configured context — the context-only override is a silent no-op for compaction.

Expected Behavior

The docs should state:

  1. Which limit drives the automatic-compaction ceiling (limit.input first, falling back to limit.context in 2.0.22).
  2. The reserve formula, including the undocumented 16,000-token floor (RESERVE_MIN) below the documented "10% of the limit".
  3. That model limit config is merged per field ({ ...catalog.limit, ...config.limit }), so an override intended to move the compaction ceiling must set both context and input.

Actual Behavior

  • /v2/docs/compaction says "approaches the model's context limit" — ambiguous, and contradicted by:
  • /v2/docs/config, Compaction section: "Automatic compaction uses the selected model's usable input budget" — the only hint about input-vs-context anywhere, and it uses different wording than /compaction.
  • buffer default is documented as "10% of the limit" (/compaction) but the effective reserve is max(10%, 16_000); the /config example shows "buffer": 20000 without noting that it is not the default.

Additional Context

  • Source refs (v2.0.22): calculateCeiling in packages/core/src/session/compaction.ts; per-field limit merge in packages/core/src/config/plugin/provider.ts (if (config.limit !== undefined) model.limit = { ...model.limit, ...config.limit }).
  • Note for versioning: the dev branch calculation changed to use context only, so the docs should either describe the versioned behavior or the behavior should be unified — today a doc sentence that is correct for one version is wrong for the other.
  • Practical impact observed in the wild: users hitting fix(openai): OAuth transform treats Codex product budget as endpoint context limit #44821 (1M-context OpenAI models compacting at ~245k) could not discover from the docs that the workaround requires overriding both fields; a context-only override appears to "not work".
  • Suggested placement: a short "Ceiling" subsection in /v2/docs/compaction (which limit + formula + reserve floor + override guidance), plus one sentence in /v2/docs/models near the limit field.

Cross-refs: #44821, #51251, #43703

Activity

  1. github-actions
    assigned
    jlongster
    on Oct 3, 2026
  2. github-actions
    added
    needs:complianceThis means the issue will auto-close after 2 hours.
    and removed
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Oct 3, 2026
  3. github-actions commented on Oct 3, 2026

    @github-actions
    github-actionsBot
    on Oct 3, 2026 – with GitHub Actions
    Contributor
    More actions

    Thanks for updating the issue. It now includes the required description and reproduction details.

  4. opencodejr commented on Oct 27, 2026

    @opencodejr
    opencodejrBot
    on Oct 27, 2026
    Contributor
    More actions

    Thanks for the detailed write-up! To restate the request: the compaction docs should say that the automatic-compaction ceiling comes from limit.input (falling back to limit.context), explain the reserve, and note that model limit overrides are merged field by field. A config override has to set input as well, or the ceiling doesn't move.

    I checked current dev and it still prefers limit.input over limit.context. The default reserve there is 15% of the window, with a 16k minimum for windows of 32k or more. So the input-vs-context behaviour you describe applies to current versions as well as 2.0.22, and the docs page still only says "context limit".

    There is already an open docs PR for this, #56509, and maintainers will look at it.

    Related:

    • docs: explain automatic compaction input limits and reserve #56509: docs PR documenting input-limit precedence, the reserve and per-field limit overrides
    • fix(openai): OAuth transform treats Codex product budget as endpoint context limit #44821: the ChatGPT OAuth input clamp that made this matter
    • [FEATURE]: per-model compaction threshold (reserved/buffer) #43703: request for a per-model compaction buffer
  5. neriousy
    closed this as completedin #66803on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @jlongster
    jlongster

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.