fix: prevent @opencode-ai/plugin@local install and respect user model limits#30088
fix: prevent @opencode-ai/plugin@local install and respect user model limits#30088cola0908 wants to merge 3 commits into
Conversation
… 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
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
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 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 |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Issue for this PR
Closes #27676
Closes #21564
Type of change
What does this PR do?
Fixes two bugs:
#27676 —
.opencode/package.jsonreferences non-existent@opencode-ai/plugin@localInstallationLocalonly checkedInstallationChannel === "local"but missed the case whereInstallationVersionitself fell back to"local"(whenOPENCODE_VERSIONis 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 theInstallationLocalguard inpackages/core/src/installation/version.ts, soundefinedis passed as the version instead of"local".#21564 — GitHub Copilot plugin ignores user-configured model limit overrides
The
build()function inmodels.tsalways overwrotelimit.context,limit.input, andlimit.outputwith API-reported values, discarding user-configured overrides fromopencode.json. This caused compaction to trigger much earlier than expected (e.g. at ~128K tokens instead of the user-configured 1M).Fix: changed the
limitblock to useprev?.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.tsthat verifiescontext,input, andoutputlimits from user config survive a model refresh.Screenshots / recordings
N/A — no UI changes.
Checklist