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 — GitHub Copilot plugin ignores user-configured model limit overrides · Issue #21564 · anomalyco/opencode

GitHub Copilot plugin ignores user-configured model limit overrides #21564

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
GitHub Copilot plugin ignores user-configured model limit overrides#21564
Copy link
Assignees
jlongster

Description

@giorgosdi
giorgosdi
opened on Apr 8, 2026
Issue body actions

Problem

User-configured limit overrides for GitHub Copilot models are silently discarded. The Copilot plugin always overwrites limit.context, limit.input, and limit.output with API-reported values, even when the user explicitly sets them in opencode.json.

This causes compaction to trigger much earlier than expected — around 11-13% of the configured context window — because:

  1. The user sets limit.context: 1000000 in config
  2. The Copilot plugin fetches model info from the API and rebuilds limits entirely from the response (max_context_window_tokens, max_prompt_tokens, max_output_tokens)
  3. The prev model (carrying user config) is passed to build() but only used for family, name, options, variants, capabilities, etc. — not for limit
  4. Compaction checks limit.input (= max_prompt_tokens, ~128K from API), not limit.context
  5. The UI percentage is calculated against limit.context, so compaction at ~128K tokens shows as ~12.8% of 1M

Config example

{
  "provider": {
    "github-copilot": {
      "models": {
        "claude-opus-4.6": {
          "limit": {
            "context": 1000000,
            "output": 64000
          }
        }
      }
    }
  },
  "compaction": {
    "auto": true,
    "prune": true,
    "reserved": 2000
  }
}

Despite this config, compaction triggers at ~128K tokens (the API-reported max_prompt_tokens), not at ~1M.

Root cause

In packages/opencode/src/plugin/github-copilot/models.ts, the build() function:

function build(key: string, remote: Item, url: string, prev?: Model): Model {
  return {
    // ...
    limit: {
      context: remote.capabilities.limits.max_context_window_tokens,
      input: remote.capabilities.limits.max_prompt_tokens,
      output: remote.capabilities.limits.max_output_tokens,
    },
    // prev is used for family, name, options, variants, etc. but NOT limit
  }
}

Other fields from prev (user config) are preserved with the prev?.field ?? remote.field pattern, but limit always comes from the API response.

Expected behavior

User-configured limit overrides should be respected, consistent with how other model properties (options, variants, capabilities) from user config take precedence. Something like:

limit: {
  context: prev?.limit?.context ?? remote.capabilities.limits.max_context_window_tokens,
  input: prev?.limit?.input ?? remote.capabilities.limits.max_prompt_tokens,
  output: prev?.limit?.output ?? remote.capabilities.limits.max_output_tokens,
},

Additional context

The compaction trigger in overflow.ts prioritizes limit.input over limit.context:

const usable = input.model.limit.input
  ? input.model.limit.input - reserved
  : context - maxOutputTokens(model)

So even if limit.context were respected, users would also need to set limit.input to actually delay compaction. This should be documented, or limit.context should influence the compaction calculation when limit.input is not explicitly set by the user.

Reacted by turtton and Dennis Mayer

Activity

  1. github-actions
    assigned
    rekram1-node
    on Apr 8, 2026
  2. github-actions
    added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 8, 2026
  3. github-actions commented on Apr 8, 2026

    @github-actions
    github-actionsBot
    on Apr 8, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of existing issues. Please check:

    • Compaction triggers too soon in comparison to context window size #21520: Same symptom — compaction triggers too soon (~128K) on GitHub Copilot despite larger configured context window
    • fix: GitHub Copilot Claude models have wrong context limits and missing thinking variants #20317: GitHub Copilot Claude models report incorrect/wrong context limits (root cause may overlap)
    • Claude Opus in GitHub Copilot and Anthropic have different context window #18832: Claude Opus via GitHub Copilot has a smaller context window than expected, causing compaction failures

    Please review those issues and consider whether this is a duplicate or a related but distinct problem (e.g. user-configured overrides being ignored vs. API-reported limits being wrong in the first place).

  4. thdxr
    removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  5. thdxr
    assigned
    jlongster
    and unassigned
    rekram1-node
    on May 3, 2026
  6. github-actions commented on Jul 3, 2026

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

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  7. github-actions
    closed this as not plannedon Jul 3, 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.