On hold for alchemy-run/alchemy#2754, which adds Effect 4.1 support upstream. Once a release ships it, bump alchemy and drop the effect/Crypto hunks from patches/alchemy@*.patch (keep the vite-plus/test Vitest hunk), then mark ready.
chore(deps): upgrade Effect to 4.1.2 and alchemy to beta.85#26833
Effect 4.1 is out (release notes). This PR moves every Effect package from 4.0.5 to 4.1.2 and alchemy from beta.84 to beta.85, and fixes everything 4.1 breaks. Two of those breaks are runtime regressions that the type checker does not catch.
Runtime regressions fixed
- TLS proxies.
HttpServerRequest.toURLno longer readsX-Forwarded-Proto. Behind Tailscale Serve or a tunnel, MCP OAuth metadata would advertisehttp://,https://resources would be refused (invalid_target), and DPoPhtuchecks would fail. A newrequestUrlhelper (apps/server/src/requestUrl.ts) keeps the 4.0 behavior, and every servertoURLcall goes through it. The existingMcpOAuthtests caught this. - PR cache growth.
Persistencenow stores keys as<storeId>:<key>, whichKeyValueStore.layerFileSystemwrites to disk aspr-v2%3A<hex>. ThePullRequestReadCachecleanup regex no longer matched those files, so the cache directory would have grown without bound. The regex now matches both formats, and a new regression test fails without the fix.
alchemy
alchemy beta.85 ships Effect 4.1 support (alchemy-run/alchemy#2754), so patches/alchemy@*.patch is gone. beta.85 moved alchemy/Test/Vitest into the new @alchemy.run/test package. The relay now imports it from there, and patches/@alchemy.run__test@2.0.0-beta.85.patch carries the vitest โ vite-plus/test swap that the old alchemy patch made. @distilled.cloud/* moves to rc.18 to match alchemy.
API migration
- Crypto.
effect/Cryptobecameeffect/crypto/SecureRandomandeffect/crypto/Digest. Neither can fail, so some deadorDie/mapErrorhandling is gone. Crypto is no longer part ofNodeServices.layer, so the server, CLI, desktop and scripts provideNodeCrypto.layerexplicitly. Web and relay use the WebCrypto layers. Mobile keeps an Expo-backed layer because Hermes has noSubtleCrypto. - MCP. Tool dependencies are now request-level
McpRequest<"Requires", S>markers.toolkitRegistrationdischarges the handler services with a localMcpServer.middleware.McpInvocationContextreaches the existing HTTP auth middleware throughlayerHttp({ registrations }), which removes the unsafe type assertion. Tests uselayerInProcessMcpServer, which is exported fromMcpHttpServer.tsbecause theno-raw-mcp-registrationlint rule keepsMcpServerout of testkits. - Smaller changes.
NodeSocket.NodeWSmoved to@effect/platform-node/NodeWS.SqlClient.makeneeds adriver("node:sqlite").ChildProcessargs arestring | Redacted.- Server request methods are typed
string;DeviceHubProxyreturns 405 for unknown ones. sql.inserttakes a non-empty array.Terminalneedssize.
An audit of the other 4.1 behavior changes found nothing else affected: ChildProcess shell-syntax rejection, stream chunkSize, FetchHttpClient stream bodies, mixed-version RPC framing and serialization, and sql.in([]). One thing worth knowing: on Windows, realPath now uses fs.realpath.native, so mapped drives resolve to UNC paths.
Verification
- Typecheck is clean in all 40 packages, including web and desktop.
- The relay passes all 303 of its tests on alchemy beta.85 with no alchemy patch, and the
alchemyCLI loads. vp run check:changed: format, lint, knip and graphql pass, and 4,795 of 4,801 tests in 207 files pass. The 6 failures come from macOS filesystem behavior, not this change:UsageService(2),ServerEnvironment(1) andGitVcsDriverCore's short-worktree-folder test (1) fail on the/varvs/private/varrealpath. The first three fail the same way on cleanmainon this Mac.- The 2
DesktopLinuxUrlHandlertheme-icon tests writecom.t3tools.T3Code.pngandcom.t3tools.t3code.pngside by side, which a case-insensitive APFS volume cannot hold. They cover Linux-only behavior.
Built with Claude Opus 5.5 in Claude Code (T3 Code).
๐ค Generated with Claude Code
Checks
On hold for alchemy-run/alchemy#2754, which adds Effect 4.1 support upstream. Once an alchemy release includes it, bump alchemy and drop the effect/Crypto hunks from patches/alchemy@*.patch (keep the vite-plus/test Vitest hunk), then mark ready.
Approvability
Verdict: Approved at c768a4c
Macroscope's review found this PR approvable โ This upgrades Effect and Alchemy and adapts crypto wiring, MCP registration, proxy URL handling, and cache cleanup. The changes preserve existing product behavior, with targeted verification and no evident material change to permissions, customer data, or infrastructure resources.
You can add or adjust custom eligibility rules. Learn more.
Thread transfer impact
โ Thread transfer remains within every enforced ceiling.
| Provider | Metric | Main baseline | This PR | Impact | PR ceiling | |
|---|---|---|---|---|---|---|
| Codex | Total thread wire | 5.0 KiB | 5.0 KiB | โ13 B (โ0.3%) | 6.8 KiB | โ |
| Codex | Thread snapshot wire | 3.8 KiB | 3.8 KiB | 0 B (0.0%) | 4.9 KiB | โ |
| Codex | Live turn WebSocket wire | 1.2 KiB | 1.2 KiB | โ13 B (โ1.0%) | 2.0 KiB | โ |
| Codex | Live turn WebSocket decoded | 21.6 KiB | 21.6 KiB | 0 B (0.0%) | 24.4 KiB | โ |
| Codex | Live turn messages | 2 | 2 | 0 (0.0%) | 8 | โ |
| Claude | Total thread wire | 5.0 KiB | 5.0 KiB | โ11 B (โ0.2%) | 6.8 KiB | โ |
| Claude | Thread snapshot wire | 3.8 KiB | 3.8 KiB | 0 B (0.0%) | 4.9 KiB | โ |
| Claude | Live turn WebSocket wire | 1.3 KiB | 1.2 KiB | โ11 B (โ0.9%) | 2.0 KiB | โ |
| Claude | Live turn WebSocket decoded | 21.9 KiB | 21.9 KiB | 0 B (0.0%) | 24.4 KiB | โ |
| Claude | Live turn messages | 2 | 2 | 0 (0.0%) | 8 | โ |
Baseline: 5b9731c ยท PR result: c768a4c ยท Source CI: failure
Scenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
Added 1 commit
- chore(deps): upgrade Effect to 4.1.2 and alchemy to beta.85c768a4c