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 — chore: upgrade Effect to 4.0.1 by kitlangton · Pull Request #54198 · anomalyco/opencode

Conversation

@kitlangton

@kitlangton kitlangton commented Oct 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Why

OpenCode V2 is pinned to Effect 4.0.0-rc.118. Moving to stable 4.0.1 breaks two things:

  • Effect 4.0.0 (opentui: fatal: undefined is not an object (evaluating 'local.agent.current().name') #8628) made Schema.brand type-only. Our client generator reads schemas at runtime, so it can no longer see that a field is a SessionID and writes string instead. Our own code then stops compiling wherever a client value flows into Core.
  • Effect 4.0.1's Effect.cached crashes with Fiber.runLoop: Not a valid effect when the cached effect is re-entered synchronously from another fiber. Location shutdown does exactly that: rpc.close wakes a borrower whose scope release calls shutdown again.

What Changes

  • Updates effect and every @effect/* package to 4.0.1. Version 4.0.2 is newer than the repo's three-day release-age window. The client's optional Effect peer and http-recorder's platform dependency now use catalog:.
  • Branded IDs carry a standard Effect identifier. Each branded schema that appears in the client API keeps Schema.brand(...) and adds Schema.annotate({ identifier: ... }). The generator already imports named schemas by name, so Session.ID stays Session.ID without any brand-specific code. The generator's old brand handling is removed.
  • The generated client can no longer silently be wider than the API. preserveEffect and preserveStream now require the generated output type and the real HttpApiClient type to be mutually assignable. If a brand, or anything else, is lost, typecheck fails at that endpoint.
  • Location shutdown no longer uses Effect.cached. The first caller marks the location closed and runs the cleanup. Later callers wait for the same cleanup. The whole operation stays uninterruptible, and isClosed() becomes true as soon as shutdown starts. The upstream crash is reported separately in fix(effect): handle synchronous re-entrancy in Effect.cached* Effect-TS/effect#8977; this change does not depend on it.
  • Recommends "effect": "^4.0.0" for plugin peer dependencies.
Surface Change
Effect client (@opencode/client/effect) Types identical. Inline string & Brand.Brand<"Workspace.ID"> becomes Workspace.ID
OpenAPI 22 branded schemas become named #/components/schemas/<Name> entries referenced with $ref. Request and response bodies are unchanged
Promise client types 26 new type aliases such as export type SessionID = string referenced by existing types. All 649 existing exports remain mutually assignable with origin/v2
Validation errors A value of the wrong kind reports Expected Session.ID instead of Expected string. Messages for malformed strings are unchanged
Tool schemas sent to models, Code Mode signatures, CLI config schema Unchanged
Promise types.ts order 100 declarations move because SchemaRepresentation.toCodeDocument sorts types topologically after the new ID aliases they reference (plus Effect #8630)

Scope

This upgrades V2 to Effect 4.0.1. Runtime validation, the generated client types, and location shutdown behave as before. The OpenAPI document names its branded IDs, which is visible to tools that generate code from it.

Verification

Run on Linux x64 with Bun 1.4.2, comparing this branch with origin/v2:

bun run check
bun run lint:changed origin/v2
(cd packages/protocol && bun run generate)
(cd packages/client && bun run generate)
(cd services/www && bun run generate)
(cd packages/cli && bun script/schema.ts ../../services/www/public/cli.json --check)
(cd packages/<each package below> && bun run test) # bun test in schema and protocol
  • Regeneration leaves the tree clean.
  • Every exported type in the Effect client API is mutually assignable with origin/v2 (433/433).
  • Widening a generated output, such as Money.USD to number, fails typecheck with __generatedOutputWiderThanContract.
  • Built-in tool definitions and request bodies for OpenAI Chat, OpenAI Responses, Anthropic, Gemini, and Bedrock are byte-identical. So are Code Mode signatures and the CLI config schema.
  • Decoding 36 valid and invalid inputs for each of 39 branded schemas gives identical results. Only the wrong-type message names the schema.
  • Reverting the shutdown change reproduces the crash in packages/core/test/browser-idle.test.ts.
Suite This branch origin/v2
core 6,602 pass, 33 skip 6,605 pass, 33 skip (3 tests from a later V2 merge)
tui 1,463 pass, 2 skip same
ai 1,793 pass, 28 skip same
codemode 1,398 pass same
cli 320 pass, 9 skip same
desktop 130 pass, 1 skip same
server 82 pass, 1 skip same
schema / protocol / util / plugin / http-recorder 68 / 9 / 95 / 9 / 53 pass same
httpapi-codegen 98 pass 97 pass
client 220 pass, 4 fail same 4 failures

GitHub Actions passed on a178639f35: typecheck, Linux and Windows unit and e2e jobs, Nix evaluation, and PR standards checks.

Not exercised: native macOS builds, the desktop app, and live provider calls.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot added the contributor label Oct 9, 2026
opencode-agent[bot]
opencode-agent Bot reviewed Oct 9, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This works as described. I checked it on Effect 4.0.1 in two ways:

  • Client codegen: with the base httpapi-codegen, bun run generate in packages/client fails with Conflicting Effect type reference: string. With this PR, check:generated passes. The only generated change from base is the type reordering in types.ts (+43/−43), and api.ts keeps all 62 Brand.Brand<…> occurrences.
  • LocationLifecycle shutdown: with the base version, the core suite reproduces Fiber.runLoop: Not a valid effect, and browser-idle.test.ts fails. With this PR, it passes.

The httpapi-codegen tests (98 pass) and the core location/session tests (33 pass, 2 skip) pass, and typecheck is clean for both packages.

Public API: @opencode/client changes its effect peerDependency from 4.0.0-rc.118 to 4.0.1 (exact pin), so consumers still on the rc need to upgrade. The plugin docs now recommend "effect": "^4.0.0". The HTTP API, OpenAPI spec and CLI config schema are unchanged.

One non-blocking note is inline: the new brand recovery in the codegen depends on Effect internals.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/httpapi-codegen/src/index.ts Outdated

const brandAstCache = new WeakMap<object, SchemaAST.AST>()

function brandAst(schema: Schema.Top): SchemaAST.AST {

@opencode-agent opencode-agent Bot Oct 9, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Not blocking, but worth a look. brandAst gets brands back by reading internal fields off schema objects (identifier + schema, fields, members, to/from, records, rest, …). None of those is a public contract. If Effect renames or reshapes any of them in a patch release, brands will silently drop from the generated client types. check:generated would catch that in CI, but only as a diff. A related risk: syncBrandStructure falls back to matching property signatures by index when the names differ (around line 2332), which could put a brand on the wrong property. If possible, keep this traversal small, and ideally drop it once Effect exposes brand metadata again. Otherwise, a short note on which Effect shapes it relies on would help whoever upgrades next.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
rekram1-node and others added 4 commits October 9, 2026 16:10
@rekram1-node
fix(ai): drop stale Vertex location fallback argument
2826c2d
@kitlangton
chore: upgrade Effect to 4.0.1
7127657
@kitlangton
fix(httpapi-codegen): preserve branded Effect types on 4.0.1
e98dc25
@kitlangton
fix(core): allow re-entrant location shutdown during scope release
6103a3b
@kitlangton
kitlangton force-pushed the effect-stable branch from 802baa0 to 6103a3b Compare October 9, 2026 21:13
kitlangton added 3 commits October 9, 2026 22:20
@kitlangton
chore: merge latest v2
f857470
@kitlangton
fix: simplify Effect upgrade compatibility
8ce147a
@kitlangton
chore: merge latest v2
7256808
@github-actions github-actions Bot mentioned this pull request Oct 10, 2026
📊 AI CLI 工具社区动态日报 2026-10-10 litang9/big_model_radar#526
Open
kitlangton added 2 commits October 10, 2026 00:20
@kitlangton
refactor(schema,codegen): name branded schemas via identifier and gua…
7fd6726
…rd client outputs
@kitlangton
refactor(schema,codegen): drop unused brand identifiers and dead code
a178639
@github-actions github-actions Bot mentioned this pull request Oct 10, 2026
📊 AI CLI 工具社区动态日报 2026-10-10 96loveslife/big_model_radar#616
Open
@kitlangton
kitlangton merged commit 41b03de into v2 Oct 10, 2026
13 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@kitlangton
kitlangton deleted the effect-stable branch October 10, 2026 07:55
@Te-River Te-River mentioned this pull request Oct 10, 2026
fix(app): contain timeline rows to cut scroll layout work #54293
Closed
4 of 6 tasks
@EcksDy EcksDy mentioned this pull request Oct 12, 2026
Fails to load on OpenCode 2.0.27: effect/unstable/http not provided (Effect 4.0.1 moved it to effect/http) PanAchy/jevvy#37
Closed
@patrickzxk patrickzxk mentioned this pull request Oct 13, 2026
V2 plugin using @opencode-ai/plugin/rpc fails to load on 2.0.28 — TypeError: Schema.isStartsWith is not a function #55154
Closed
This was referenced Oct 26, 2026
fix: migrate V2 plugin to stable @opencode/plugin API (Schema.isStartsWith is not a function) ephraimduncan/opencode-cursor#42
Open
V2 /server plugin fails on stable hosts: TypeError: Schema.isStartsWith is not a function (host Effect 4.0.1 rename; beta @opencode-ai/* packages) ephraimduncan/opencode-cursor#43
Open
@Tarquinen Tarquinen mentioned this pull request Oct 26, 2026
chore: upgrade Effect to 4.0 stable #52621
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencode-agent opencode-agent[bot] opencode-agent[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@kitlangton @rekram1-node
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.
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.