Skip to content

chore(deps): upgrade opencode to 2.2.0 - #2725

Closed
github-actions[bot] wants to merge 1 commit into
mainfrom
gardener/upstream/opencode-2.2.0
Closed

github-actions[bot] wants to merge 1 commit into
mainfrom
gardener/upstream/opencode-2.2.0

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Moves the dev and example pins for agents/harness/opencode and agents/models/opencode from opencode 2.0.24 to 2.2.0, and fixes the two test-time breaks that come with it.

Package From To
@opencode/sdk (dev pin, example) 2.0.24 2.2.0
@opencode/plugin (dev pin, example) 2.0.24 2.2.0
peer range ^2.0.24 ^2.0.24 (unchanged)

Since our pin opencode has released 2.0.25–2.0.32, 2.1.0–2.1.4 and 2.2.0 (published 2026-10-27). Our caret peer range already lets users install all of them. This PR runs our tests and the example on 2.2.0. It supersedes #2692 (2.1.4), which only github-actions[bot] committed to.

What changed upstream that affects us

  • high · breaking: "chore: upgrade Effect to rc.118" (1aae67e) and "chore: upgrade Effect to 4.0.1" (41b03de). Effect 4.0.1 ships the Scalar API-reference script at effect/dist/http-api/internal/httpApiScalar.js, not effect/dist/unstable/httpapi/.... Our stubs for that 3 MB script matched the old path (packages/agents/src/harness/opencode/tests/vitest.config.ts:16, examples/next/harnesses/opencode/vite.config.ts:16), so the script was loaded unstubbed. Same fix in both files (the stub's javascript export name is unchanged in 4.0.1):
    -        id.includes("/effect/dist/unstable/httpapi/internal/httpApiScalar.js")
    +        id.includes("/effect/dist/http-api/internal/httpApiScalar.js")
  • high · breaking (tests only): not a packages/sdk or packages/plugin commit: @opencode/core 2.2.0, which @opencode/sdk 2.2.0 depends on, inlines models.dev's catalog snapshot as one string literal, var snapshot_default = '…' under // src/models-dev/snapshot.txt, in dist/chunks/tool-8e0gbf5j.js (8,220,573 bytes; 2.0.24's chunk was 5,316,690). With the Scalar path fixed, harness-opencode still failed: workerd closed the module-runner socket with "WebSocket protocol error; statusCode = 1009; Message is too large". harness.test.ts and table-prefix.test.ts never ran, leaving 5/14 tests passing. A temporary size probe showed that chunk is the only transformed module over 1 MB. The test Workers set models: { fetch: false } and use only our Cloudflare provider (packages/agents/src/harness/opencode/tests/worker.ts:67-74), so the test config now swaps in an empty catalog (packages/agents/src/harness/opencode/tests/vitest.config.ts:20-35):
    +    {
    +      name: "empty-models-dev-snapshot",
    +      enforce: "pre",
    +      transform: (code, id) =>
    +        id.includes("/@opencode/core/dist/") &&
    +        code.includes("// src/models-dev/snapshot.txt")
    +          ? code.replace(
    +              /(\/\/ src\/models-dev\/snapshot\.txt\nvar snapshot_default = )'.*';/,
    +              "$1'{}';"
    +            )
    +          : null
    +    },
  • low · breaking (stored data, no code change): "refactor: v2.1 minor breaking changes" (acdcdb8). In the two packages reviewed, this renames the plugin type SessionCompactionResult.providerState to native (SessionMessage.Native). Neither models/opencode nor the harness implements compaction, and typecheck passes. events.ts:264-268 reads only reason and error.message from session.compaction.*. The same commit changes the stored session schema in @opencode/schema: chore(agents): test against opencode 2.1.4 #2692's review found that it renames state/providerState/resultState to native and drops recent from compaction messages. I did not re-verify that here. It only matters for rollback (see Merge Danger).
No effect on us (63)
  • "release: v2.2.0" (1097e26) and 14 "sync release versions for v2.0.24 … v2.1.4" commits (bd55d48, 62e087f, 8059cdc, 03cb9b9, c5aabae, 34d8ded, f40dc43, 83c5abb, 4e95dac, d30e990, 133b1eb, 4b50f5c, e965774, 2a3e7c0): version numbers only.
  • 7 merge commits ("chore: merge dev into beta" / "merge beta into dev" / "Merge branch 'dev' into beta": be315b1, 4b83402, fd0efe3, bcd713e, 316a688, 15d4afd, 3a58a0c): their first-parent diffs only carry commits listed here (session list/instructions, native rename, DeepMutable, @opencode/ai/effect, OpenTUI peers, versions, typecheck scripts).
  • "feat(protocol): define experimental image and decision generation endpoints" (2a0639a): adds ctx.experimental.generate and deprecates ctx.generate (kept as text only). Our plugins don't call generate.
  • "feat(plugin): add OpenCode Desktop GUI plugins" (dae4077), "feat(plugin): add toasts, dialogs, notifications, UI, tabs and composer APIs to GUI plugins" (758cf5a), "feat(app): manage desktop plugins in Extensions › Plugins" (5792c3e), "fix(app): list What's new with About in settings" (19d87a7): new @opencode/plugin/gui* subpaths and optional electron/vite/vite-plugin-solid peers. We import only @opencode/plugin's root. Host.resolve now reads a local plugin's package.json, but we pass plugins as objects, not directories.
  • "feat(plugin): filter event subscriptions by type" (1434464): adds types to the plugin ctx.event.subscribe. The harness subscribes through the SDK host (opencode.events.subscribe) and still gets server.connected first, which the event-stream tests confirm.
  • "fix(server): stop form polling from booting idle locations" (c8cf3a5), "fix(app,server): stop subagent form polling from stalling sends" (946c331): add an internal live check to the SDK's instance map. No API change.
  • "refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect" (dad29a8): import paths inside the plugin's session types only.
  • "refactor(core): keep Go allowance out of messages and sessions" (de284dc) and "feat(core): record reported cost and Go allowance" (4cba1b7): TUI context only, and the two cancel out.
  • "fix(tui): identify config-defined providers" (cc4faf4) and its revert (cd15a6a): net zero.
  • "feat(plugin): expose session instruction entries to plugins" (6c74e11), "feat(plugin): expose session list" (bc5fa1c), "feat(plugin): let plugins assert permissions" (6a7cedc), "feat(plugin): expose credential.activate to server plugins" (d782675), "feat(integration): add declarative external connection method" (70c6c8c): new plugin APIs we don't use.
  • "fix(app): show untracked folders as one review row" (21ed6e4): optional VCS diff field, unused.
  • "refactor: remove redundant casts and duplicate helpers across sdk, plugin, codemode, and schema" (7a62a46): editor types use Effect's Types.DeepMutable. We don't name it, and Model.Info.default, Model.ID.make and Provider.ID.make (models/opencode/index.ts:118-124) are unchanged.
  • "feat(sdk): seed host plugins before recovery and harden workerd defaults" (55dde88): OpenCodeWorkerd.create({ plugins }) now registers plugins before resuming suspended sessions, so a turn resumed on boot sees ai.plugin. We had no workaround for the old order.
  • "fix(plugin): return Promise tool throws as tool failures" (1438073) and "fix(plugin): keep each Promise hook rejection on its own tool call" (7351718): the example's tools throw to report failure, which now reaches the model as a tool failure, as intended. models/opencode registers no tool hooks.
  • "fix(sdk): release completed embedded request signals" (9ee97d8): internal fetch bookkeeping.
  • "fix(core): route file overrides through Workspace.connect" (c50e39b): Effect-entry exports. We use the Promise @opencode/sdk/workerd API.
  • "fix(cli): give plugins the host's Effect" (c28e9ec): Bun-only runtime loader.
  • "chore: remove unused dependencies from V2 packages" (50ae4bd): we import neither zod nor @standard-schema/spec through the plugin.
  • "chore: upgrade opentui v0.7.0" (ab4d1f3), "chore: upgrade opentui v0.6.8" (c9c1dc0), "chore: OpenTUI 0.6.5" (c7ddff7), "chore(tui): revert OpenTUI 0.6 upgrade" (def5d94), "chore(tui): upgrade OpenTUI to 0.6.2" (65f8907), "chore: upgrade opentui v0.5.17" (da40b8f), "chore: upgrade opentui v0.5.16" (fcad131), "feat(tui): report pending session status to the terminal" (d0a2ce3): TUI only. The plugin's optional @opentui/* peer is now exactly 0.7.0, which the lockfile resolves.
  • "feat(app): add generative UI to the GUI" (f232362), "ci: separate release builds from signing and publishing" (6996bbc), "fix(release): add repository to ai, plugin and cli package.json" (fa5b4bd), "chore: use bun check for local typechecks and TypeScript 7.1 in CI" (84578e1), "chore: upgrade typecheck to TypeScript 7.0.2" (23359e9), "chore(ci): speed up and stabilize the test workflow" (17229d2): upstream build and release tooling.

Decisions

  • Peer range stays ^2.0.24. No published source changed. The caret already admits 2.2.x, and our code compiles and passes on both 2.0.24 (before) and 2.2.0 (after). Raising the floor would push users off 2.0.x with no code reason.
  • No changeset. The published agents package changes only in devDependencies. The other edits are a test config and the example.
  • The empty-catalog stub is test-only. The tests disable catalog fetches and name only Cloudflare models, so the catalog's content doesn't matter there. I left the example's vite.config.ts without it: vite build bundles the chunk fine (Worker index.js 12.8 MB raw, 1.29 MB gzipped), and stubbing it there would change what the deployed example ships. See Needs a maintainer for vite dev.
  • Scalar stub matches only Effect 4.0.1's path. 2.2.0's tree resolves only effect@4.0.1, so the old unstable/httpapi path would match nothing.
  • Supersede chore(agents): test against opencode 2.1.4 #2692. Its only committer is github-actions[bot]. This PR includes its fixes (the same Scalar path change) and moves to the newer release.

Needs a maintainer

  • Whether the example's vite dev hits the same 8 MB module limit. I couldn't run it here: its remote AI binding needs CLOUDFLARE_API_TOKEN. @cloudflare/vite-plugin also loads modules into workerd through a module runner, so it may fail the same way the tests did. Options: add the same empty-models-dev-snapshot plugin to the example with apply: "serve" (dev only, since the example also sets models: { fetch: false }), or leave it. Recommendation: run pnpm start in examples/next/harnesses/opencode once. If it fails with "Message is too large", add the dev-only stub.
  • Whether to warn users that sessions written by opencode 2.1+ can't be read by 2.0.x. This PR doesn't change what users can install. Options: a note in the harness docs, or nothing. Recommendation: nothing here. It's upstream's storage change, and users opt in by moving their own pin.

Affected open PRs

Other changes

  • packages/agents/package.json:54-55: dev pins @opencode/plugin and @opencode/sdk 2.0.24 → 2.2.0.
  • examples/next/harnesses/opencode/package.json:17-18: the same two pins 2.0.24 → 2.2.0.
  • pnpm-lock.yaml: regenerated with pnpm install. Every @opencode/* package resolves to 2.2.0, with no 2.0.24 left. Transitive changes come from opencode's own dependency tree:
    • version moves: effect 4.0.0-rc.112 → 4.0.1 (plus @effect/opentelemetry/platform-node* 4.0.1), @opentui/core 0.5.14 → 0.7.0, @opencode-ai/pty 0.2.0 → 0.3.1, bun-pty 0.4.9 → 0.4.11, gitlab-ai-provider 6.19.0 → 6.23.1, openai 6.45.0 → 7.19.0 (in opencode's tree).
    • new: ws@8.22.0, proper-lockfile, retry.
    • dropped: msgpackr, msgpackr-extract, fast-check, pure-rand, @modelcontextprotocol/client@2.0.0/core@2.0.0, mime@4.1.0, http-cache-semantics, isomorphic-ws, undici@8.10.2, strip-ansi@7.1.2, node-gyp-build-optional-packages.
    • peer-suffix changes only: @openai/agents*, @cloudflare/sandbox, @earendil-works/pi-*, @tanstack/ai-openai/openai-base, drizzle-orm.
    • the opencode packages now also carry the workspace's existing vite 8.1.6/8.3.5 as an optional peer.

Evidence

  • Before: on 2.0.24, harness-opencode 31/31 and workers src/tests/models/opencode 5/5. On 2.2.0 with only the pins moved, harness-opencode ran 5/14 (events.test.ts only). The worker exited with "Message is too large", both with the old Scalar path and after fixing it, until the catalog stub was added.
  • After: harness-opencode 31/31 and workers src/tests/models/opencode 5/5. pnpm run build passes for 22 projects, including the OpenCode example's vite build. pnpm run check passes: sherif, exports check, oxfmt, oxlint, and typecheck of all 133 projects.

Merge Danger

Door: two-way for this PR, since it moves only dev, test and example pins. The example is the exception: deploying examples/next/harnesses/opencode from this commit puts its Durable Objects on opencode 2.2, and per acdcdb8 sessions that compact under 2.1+ may not decode on 2.0.x. Treat that deployment as one-way.

Blast Radius: none for published packages: dev dependencies, a test config and the example only.

No one gets a new peer-dependency warning: the agents peer range is unchanged.


Opened by Gardener's opencode-upgrade task. 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's pr-review-fix task.


Devin Review

Move the @opencode/sdk and @opencode/plugin dev and example pins from
2.0.24 to 2.2.0 and regenerate pnpm-lock.yaml.

opencode 2.1+ is built on Effect 4.0.1, which ships its Scalar UI at
effect/dist/http-api/internal/httpApiScalar.js, so the Vite stubs in the
harness-opencode test config and the OpenCode example now match that
path. @opencode/core 2.2.0 also inlines an 8 MB models.dev catalog in one
module, too large to load into the vitest-pool-workers runtime; the
harness-opencode test config replaces it with an empty catalog (the
tests set models.fetch: false and use only the Cloudflare provider).

The peer range (^2.0.24) is unchanged: no published source changed and
it already admits 2.2.x.

Gardener-Operation: op_9ade73330c5f07fc9d86a625cfa385da9ee226bd44baeffd3b83f4500e0fe876:9e620ecc4ce65c146cb311c2165f594bb915db0225ce74d69edfb63d06e34b94
@github-actions github-actions Bot added the dependencies Pull requests that update a dependency file label Oct 27, 2026
@changeset-bot

changeset-bot Bot commented Oct 27, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f22ce57

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@agent-think

agent-think Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

🔴 agents import sizes: 1 entry point over threshold

Entry point Exports Largest gzip change Size now
🔴 agents/models/opencode 2 resized up to +7.8 KiB (+7.53%) 112 KiB
Changed exports (2)
Import Gzip change Size now
🔴 agents/models/opencode#CLOUDFLARE_PROVIDER_ID +7.8 KiB (+7.53%) 112 KiB
🔴 agents/models/opencode#createAI +7.8 KiB (+6.18%) 134.3 KiB
How this works

Each runtime export is bundled on its own, minified, and gzipped. Changes smaller than 100 B, or smaller than 1% and 1 KiB, are ignored. Growth over 10% or 5 KiB is marked 🔴. This report is informational and does not fail CI. The workflow artifact contains every measurement.

Compared 85867443 → f22ce571 · workflow run · reported by agent-think[bot]

@pkg-pr-new

pkg-pr-new Bot commented Oct 27, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@2725

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@2725

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@2725

hono-agents

npm i https://pkg.pr.new/hono-agents@2725

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@2725

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@2725

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@2725

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@2725

commit: f22ce57

github-actions Bot added a commit that referenced this pull request Oct 29, 2026
Move the @opencode/sdk and @opencode/plugin dev and example pins from
2.0.24 to 2.2.1 and regenerate pnpm-lock.yaml.

@opencode/core 2.2.1 no longer bundles @ai-sdk/vercel, the package
agents/models/opencode named so OpenCode loads it in-process; every turn
failed with provider.no-route. The provider now names gitlab-ai-provider,
which OpenCode 2.0.24 to 2.2.1 all load in-process. Peer range unchanged.

The Effect 4.0.1 Scalar stub path moves in the test config and example,
and the test config swaps OpenCode's 8 MB models.dev catalog for an
empty one so the test runtime can load it.

Supersedes #2725.

Gardener-Operation: op_01cd0a42d8cacef705791a2563f399f6f2ecfd9e224ab4bd67b0ca9942cc803e:90fbc03809c64d97ed870f4c44c25e8147b472a47fb479caa9877d85e9ebfa36
@github-actions

Copy link
Copy Markdown
Contributor Author

Superseded by #2767, which moves to opencode 2.2.1. It keeps this PR's Scalar-path and models.dev catalog test fixes. It also fixes agents/models/opencode, which fails every run on 2.2.1 because @opencode/core no longer bundles @ai-sdk/vercel.

@github-actions github-actions Bot closed this Oct 29, 2026
mattzcarey pushed a commit that referenced this pull request Oct 29, 2026
* fix(agents): upgrade opencode to 2.2.1

Move the @opencode/sdk and @opencode/plugin dev and example pins from
2.0.24 to 2.2.1 and regenerate pnpm-lock.yaml.

@opencode/core 2.2.1 no longer bundles @ai-sdk/vercel, the package
agents/models/opencode named so OpenCode loads it in-process; every turn
failed with provider.no-route. The provider now names gitlab-ai-provider,
which OpenCode 2.0.24 to 2.2.1 all load in-process. Peer range unchanged.

The Effect 4.0.1 Scalar stub path moves in the test config and example,
and the test config swaps OpenCode's 8 MB models.dev catalog for an
empty one so the test runtime can load it.

Supersedes #2725.

Gardener-Operation: op_01cd0a42d8cacef705791a2563f399f6f2ecfd9e224ab4bd67b0ca9942cc803e:90fbc03809c64d97ed870f4c44c25e8147b472a47fb479caa9877d85e9ebfa36

* docs(changeset): link the OpenCode example README from the carrier changeset

Gardener-Operation: op_1437d3ebe8d4d6923fc425988e7a04f125ee356ea2fef9384556708b30267bee:0f48d6f725a39c5bec490ab674abd418b4e3df574a103736d9e1c5b30863386a

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants