Skip to content

fix: prevent @opencode-ai/plugin@local install and respect user model limits#30088

Open
cola0908 wants to merge 3 commits into
anomalyco:devfrom
cola0908:fix/plugin-local-version-and-copilot-limits
Open

fix: prevent @opencode-ai/plugin@local install and respect user model limits#30088
cola0908 wants to merge 3 commits into
anomalyco:devfrom
cola0908:fix/plugin-local-version-and-copilot-limits

Conversation

@cola0908
Copy link
Copy Markdown

@cola0908 cola0908 commented May 31, 2026

Issue for this PR

Closes #27676
Closes #21564

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fixes two bugs:

#27676.opencode/package.json references non-existent @opencode-ai/plugin@local

InstallationLocal only checked InstallationChannel === "local" but missed the case where InstallationVersion itself fell back to "local" (when OPENCODE_VERSION is unset). This caused the literal string "local" to be used as an npm version tag, resulting in install failures and ~30s cumulative startup delay.

Fix: added || InstallationVersion === "local" to the InstallationLocal guard in packages/core/src/installation/version.ts, so undefined is passed as the version instead of "local".

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

The build() function in models.ts always overwrote limit.context, limit.input, and limit.output with API-reported values, discarding user-configured overrides from opencode.json. This caused compaction to trigger much earlier than expected (e.g. at ~128K tokens instead of the user-configured 1M).

Fix: changed the limit block to use prev?.limit?.X ?? remote.capabilities.limits.X, consistent with how other fields (family, name, options) already preserve user config.

How did you verify your code works?

Added a test case "preserves user-configured limit overrides from existing models" in packages/opencode/test/plugin/github-copilot-models.test.ts that verifies context, input, and output limits from user config survive a model refresh.

Screenshots / recordings

N/A — no UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

… limits

- Guard InstallationLocal against version fallback to 'local' (anomalyco#27676)
- Preserve user-configured limit overrides in Copilot model build (anomalyco#21564)
- Add test for limit preservation on model refresh
@github-actions github-actions Bot added needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels May 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

I found one related PR to check:

Potentially Related PR:

This appears to address similar functionality around model limit overrides that users can configure. Since the current PR (30088) includes a fix to respect user model limits in the GitHub Copilot plugin's models.ts, there may be overlap or dependency with PR #29354's per-model limit override feature.

However, the searches show that PR #30088 (the current PR) is the only one directly matching most of the specific issues being fixed. No clear duplicate PRs were found for the @opencode-ai/plugin@local installation issue or the specific model limit preservation fix.

@github-actions github-actions Bot removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels May 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Labels

None yet

Projects

None yet

1 participant