Repository navigation
fix(agents): upgrade opencode to 2.2.7 - #2857
Closed
github-actions[bot] wants to merge 1 commit into
Closed
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Move @opencode/sdk and @opencode/plugin to 2.2.7, with a peer range of ^2.2.3. OpenCode 2.2.1 stopped bundling @ai-sdk/vercel, which agents/models/opencode named as its carrier package. Since 2.2.3 OpenCode runs its npm loader after plugin sdk hooks, so the provider now answers the sdk hook itself. Move the harness off the deprecated sessions.wait and sessions.log to experimental.session, and update the test and example Vite configs for OpenCode's new effect paths and its 8 MB models.dev snapshot. Gardener-Operation: op_8e4ed46db651073a89730dfe01d0c0ef8e61f60edf2de3b83d05a9f0b44f93ef:2eea5a1351af9fb843f007a7f38209556e3732d9d5119f61197502b611828817
🦋 Changeset detectedLatest commit: 9b40079 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This was referenced Nov 10, 2026
Contributor
Author
|
Superseded by #2884 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves
agents/harness/opencodeandagents/models/opencodefrom opencode 2.0.24 to 2.2.7, and switches the Cloudflare provider to OpenCode'ssdkhook.@opencode/sdk(dev, example)2.0.242.2.7@opencode/plugin(dev, example)2.0.242.2.7@opencode/sdkpeer range^2.0.24^2.2.3@opencode/pluginpeer range^2.0.24^2.2.3opencode has published 20 v2 releases since 2.0.24 (2.0.25 to 2.2.7). Users can already install all of them under our
^2.0.24peer range, but on 2.2.1 and later everyagents/models/opencodeturn fails, because OpenCode no longer bundles@ai-sdk/vercel, the package our provider borrowed. This PR carries the same code changes as #2849 (2.2.6), moved to 2.2.7, and replaces it. Nothing in 2.2.7 needed further code changes.What changed upstream that affects us
@opencode/core2.2.1, a dependency of@opencode/sdk).packages/agents/src/models/opencode/index.tsnamedaisdk:@ai-sdk/vercelas the provider's package, so OpenCode'ssdkstep loaded it in-process and ourlanguagehook replaced the model. On 2.2.x that package goes to OpenCode's npm installer, which can't run in workerd. With 2.2.7 and the old provider code, 14 of 31harness-opencodetests fail withNpm.add is unavailable in the workerd profile. The fix uses the next item.@opencode/core2.2.3). Our plugin now answers thesdkhook for its own provider (packages/agents/src/models/opencode/index.ts:141), so it no longer needs a carrier package or the unreachable Vercel base URL:languagehook (index.ts:149) still builds the model fromagents/models/ai-sdk. Thesdkhook is disposed with the other hooks (index.ts:163). The comment onCARRIER_PACKAGE(index.ts:50) now explains why the name is safe.sessions.waitandsessions.logare marked@deprecated Use `client.experimental.session.wait`. Removed in the next minor.The harness called them atpackages/agents/src/harness/opencode/harness.ts:536,:670and:1242, andOpenCodeLogEventis derived fromsessions.log(types.ts:45). All four now use the new names:effect/unstable/httpapimoved toeffect/http-api(2.2.7 resolves effect 4.1.0), so the Vite stub for Scalar's UI matched nothing. Fixed inpackages/agents/src/harness/opencode/tests/vitest.config.ts:16andexamples/next/harnesses/opencode/vite.config.ts:16:@opencode/core2.2.x inlines models.dev's catalog as one ~8 MB string (// src/models-dev/snapshot.txt), too large for the message that carries a module into the vitest-pool-workers runtime.vitest.config.ts:25adds anempty-models-dev-snapshottransform that substitutes an empty catalog. These tests already setmodels: { fetch: false }and use only the Cloudflare provider.ctx.experimental.artifactto the pluginContextand exportsArtifactfrom@opencode/plugin. Not adopted: we have no artifact store to offer; possible follow-up.No effect on us (102)
New in 2.2.6 → 2.2.7 (each diff read for this PR):
model.*,agent.list,skill.*,generate.*,provider.*,rpc.calland similar handlers no longer wait for plugins to load. The harness calls none of them (onlysessions.*,experimental.session.*,message.list,permission.list,events.subscribe,close), andharness-opencodepasses 31/31 on 2.2.7. The sdk side is test-only.experimental.model.resolve; we register none.@opencode/core2.2.7 adds no database migration; the newest is still20261030054400_job.2.0.24 → 2.2.6: reviewed one by one in #2849. Our opencode code on
mainis unchanged since, and this PR carries the same code, so the verdicts stand:ctx.ui; our server plugins use none of it.@opencode/aiand sdk tests; we import nothing from@opencode/ai.experimental.idlehook; we register none.event.subscribe; the harness subscribes through the SDK client.SessionCompactionResult.providerStatetonative; we register no compaction hook.examples/next/harnesses/opencode/src/workspace.ts:143accurate; no change needed.instancesoption, which we don't use.effect.zodand@standard-schema/specfrom@opencode/plugin; we get neither through it.devandbeta(be315b1, 4b83402, fd0efe3, bcd713e, 316a688, 15d4afd, 3a58a0c): bring in versions, metadata and additive plugin API.Decisions
sdkhook instead of finding another bundled carrier. fix(agents): upgrade opencode to 2.2.1 #2776 carries the provider ingitlab-ai-providerand is on hold because that depends on OpenCode internals. Since 2.2.3 a plugin'ssdkhook runs before the npm fallback, so the provider namesaisdk:agents/models/opencode, a package that doesn't exist, and our hook supplies the SDK. The model still comes from the existinglanguagehook.^2.2.3, pins2.2.7. The provider needs the hook order from 2.2.3; on 2.0.24 to 2.2.2 OpenCode's npm loader would claimagents/models/opencodebefore our hook runs.experimental.session.*exists from 2.2.1. Nothing needs 2.2.4 to 2.2.7, so the floor stays at 2.2.3. Dev and example pins are exact at 2.2.7, the version tested here.sessions.waitandsessions.lognow. They still work on 2.2.7 but are marked "Removed in the next minor". The new floor guarantees the replacements exist.patch. Only source changed and the peer floor moves within major 2. The changeset states the new floor and that the door is one-way.Needs a maintainer
blobtable (migration20261025123711_blob), and 2.2.4 moves background job markers fromkvinto a newjobtable (20261030054400_job). Older releases can't read either; 2.2.7 adds no further migrations. Options: accept this (users on^2.0.24can already install 2.2.x), or add a rollback caveat to the harness example. Recommendation: accept it and rely on the changeset note, because the harness is@experimentaland the migrations are upstream's.Affected open PRs
github-actions[bot]has committed to it.sdk-hook provider fix(agents): upgrade opencode to 2.2.1 #2776 was waiting for (#60380, 2.2.3).packages/agents/src/harness/opencode/harness.tsaround:536, where fix(opencode): stop pausing wait() and prompt() after every run #2785 keepsopencode.sessions.wait(. Whichever lands second should keep both itsidleflag andexperimental.session.wait. Its use ofopencode.sessions.active()is not deprecated in 2.2.7.packages/agents/package.jsonorpnpm-lock.yamlfor other dependencies, not@opencode/*. Whichever lands second may need the lockfile regenerated.Other changes
packages/agents/package.json: dev pins2.0.24→2.2.7and peer ranges^2.0.24→^2.2.3for@opencode/sdkand@opencode/plugin.examples/next/harnesses/opencode/package.json: pins2.0.24→2.2.7.examples/next/harnesses/opencode/vite.config.ts: the effect path fix above.packages/agents/src/harness/opencode/tests/vitest.config.ts: the effect path fix and theempty-models-dev-snapshottransform above.packages/agents/src/harness/opencode/harness.ts,packages/agents/src/harness/opencode/types.ts: the move toexperimental.sessionabove.packages/agents/src/models/opencode/index.ts: thesdkhook, the new carrier name, the removed Vercel settings and the updatedCARRIER_PACKAGEcomment above..changeset/opencode-2-2-7.md:agentspatch, stating the new floor, the reason, and that the door is one-way.pnpm-lock.yaml: regenerated bypnpm install. Both importers resolve only@opencode/*@2.2.7, with no2.0.24left, plus the transitive moves that come with it (effect4.0.0-rc.112 → 4.1.0,@opentui/core0.5.14 → 0.8.1, new@opencode/pty0.4.0). No docs name the old peer range.Evidence
harness-opencode31/31 andworkerssrc/tests/models/opencode5/5. On 2.2.7 with the old provider code (and the new test config),harness-opencode17/31: 14 fail withNpm.add is unavailable in the workerd profile.harness-opencode31/31,workerssrc/tests/models/opencode(provider.test.ts,language-v3.test.ts) 5/5.pnpm run buildandpnpm run checkpass (sherif, exports check, oxfmt, oxlint, typecheck of all 133 projects), and the example'svite buildpasses.pnpm installraised nominimumReleaseAgeblock (@opencode/*and@opentui/*are excluded).Merge Danger
Door: one-way
Blast Radius: OpenCode harness users
Anyone on
@opencode/sdkor@opencode/pluginbelow 2.2.3 gets a peer-dependency warning and should upgrade both to 2.2.3 or later; otherwiseagents/models/opencodefails to initialize its model (on 2.2.1 and 2.2.2 it already fails today). The door is one-way because of OpenCode itself: once 2.2.0 or later has run on a Durable Object, file attachments and file tool results live in theblobtable, and once 2.2.4 or later has run, background job markers live in thejobtable. Pinning back below those releases leaves that data unreadable.Opened by Gardener's
opencode-upgradetask. Commits pushed by Gardener don't start CI: close and reopen this pull request, or push to it, to run it. Review comments are handled by Gardener'spr-review-fixtask.