Skip to content

Technical

My agents migrated all of Kody to Effect in one day, then closed the PR

Kent C. Dodds · · Updated · 51 min read

I first published this post on November 24, after seven rounds of trials on slices of the codebase. I rewrote it on November 30, after my agents migrated the whole Kody server to Effect, and later that day I added the full method (the rubric, the planted bugs, the answer key, and every brief) in an appendix.

TL;DR: I wanted Effect to win, so after seven smaller trials my agents migrated all of Kody's server to Effect in one PR in one day (my agent's plan said twelve weeks) and scored it against main on a rubric frozen before any code changed. Effect lost (at most 42.4 out of 100, against at least 57.7 for main), mostly because my agents made more silent mistakes writing Effect and caught fewer reading it. Maybe that's a "skills issue," as I put it that night, but agents write Kody's code now, and agents do better without Effect, so we closed the PR.

I wanted Effect to win

I'm not writing Kody's code by hand anymore. My agents are. So picking a library because I like how it reads would be kind of silly. I'd be picking it for someone else.

And I had a preference going in. Early in the first trial I told my agent, "I mean to use effect." I also said that something that "catches bugs increases the pit of success and that counts for a great deal." I meant both of those. I set the bar like this: nothing merges until an agent recommends Effect and it's truly the right long-term call.

That preference matters for how you read the rest of this. More than once, when the evidence went against Effect, I was the one who wanted another round. After round 4, I said finding bugs still felt like a good reason to use Effect, so we kept going. After round 5, I asked whether XState would do the same job, so we tested that too. After the November 24 version of this post went up, I challenged the reasons Effect lost, and that challenge is what led to migrating the whole codebase. If anything, I was trying pretty hard to find a way for Effect to be right.

Why I said no in 2024

In April 2024, I quote posted Matt Pocock sharing an Effect snippet. I compared it to RxJS and said I'd never use it. I later deleted that post because it was spicier than I like to be. Replying to Sebastian Lorenz from the Effect team in that same thread, I wrote: "I'm not talking about overlap. I'm talking about perception. And the size of your API. It's enormous. And it feels like writing a completely different language. Which is why I'm not planning on using it."

Sebastian kindly said he was "respectfully placing a counter bet" on my take. I always appreciated how gracious he was about it. If my agents had picked Effect, I'd have happily called it a win for Sebastian, even though technically I still wouldn't be the one writing it. 😄

My 2024 reasons were about me: the API is huge, and learning a whole new way to write TypeScript wasn't worth it to me. Those reasons mostly don't apply anymore. If my agents can write Effect well, then "it feels like a different language to me" isn't a good reason to skip it. I think of libraries and frameworks as tools for my agents now, and I want the ones they do their best work with. That's the same reason we moved Kody from Remix 3 to TanStack Start.

What I wanted Effect to do for us

The goal is a pit of success: the easy way to write server code should also be the correct way. A contributor or agent in a hurry shouldn't be able to forget an await, make an outbound call with no timeout, add a new failure that surfaces as a 500, or skip a cleanup step, without something stopping them before review.

Effect is a serious contender for that. It's a TypeScript library for typed errors, dependency injection, resource safety, and structured concurrency. In Effect, the errors a function can fail with are part of its type, so "you forgot to handle this" can be a compile error. That's a big deal to me, and it's the main reason I wanted Effect to win.

Seven rounds on slices

Before the full migration, my agents ran seven rounds of trials, each on one slice of the codebase. Every trial PR was a draft marked do not merge, and none of the trial code merged. The details are in the PRs and in the appendix, so here's the short version:

RoundWhat we triedHow it came out
1One agent converts the newsletter slice to Effect 4 and judges its own work (#5450)It recommended against Effect. The three bugs it found were each a five-line fix in plain TypeScript
2, 3Clean-room redos with guidance from Effect practitioners (#5461, #5477)The properties were real, but runtime startup went from 85.3 ms to 159.1 ms
4Blind builders, Effect against careful Promises, with planted bugs and hidden follow-ups (#5487, #5484)Promises won. They caught 4 of 5 planted bugs, Effect caught 3
5Widen Effect to more code, with a blind bug hunter on main as a controlEffect's rules found 2 bugs the hunter missed. The hunter found more overall
6Four arms (Effect, plain Promises, Promises plus lint and helpers, XState) on a weighted rubricPromises plus lint 7.67, XState 6.28, plain Promises 6.08, Effect 5.63
7Effect against Promises plus lint on a real request path, then Durable Objects and queues (#5522, #5524)Promises plus lint won 7.32 to 5.76 on the request path and 72.4 to 62.4 on Durable Objects and queues

A few of those rounds changed where this went.

Rounds 2 and 3 happened because Effect folks replied on #5450 that our Effect wasn't idiomatic Effect 4, and they were right. Thank you to @mj-meyer and @joelhooks for that, and to @KrishRVH and @mikearnaldi, whose feedback on #5461 shaped rounds 3 and 4 (one ManagedRuntime per isolate, convert shared helpers once, Schema at the boundaries, measure a tree-shaken bundle, and compare against a Promise baseline with the same telemetry and typed errors). I asked my agent to thank them, apply all of it in a clean room where the builder couldn't see earlier attempts, and keep the brief positive.

Round 4 was the first fair fight. Until then we'd compared Effect against main, and rewriting any code carefully tends to improve it. Mike's ask for a baseline with the same telemetry and explicit errors became round 4's Promise arm: two builders rebuilt the same background jobs, one in Effect and one in plain Promises held to the same production bar, and neither knew the other existed. Other agents planted bugs and made follow-up changes, and a judge that built none of it scored everything. Promises won, and that's when I pushed back: finding bugs still felt like a good reason to use Effect.

Round 5 was the first real evidence for Effect, and I was excited about it. Two of Effect's rules (handle every error, give every outbound call a deadline) found two real bugs that a careful blind hunt missed. But the hunter found more bugs overall, and all the fixes shipped as small Promise changes (#5501, #5502, #5503).

In round 6 I wanted to know if we could get those rules without Effect. Kody already uses XState, so I asked whether it would catch the same bugs, and it got its own arm. I also asked for a written rubric and a clear decision, and told the judge the numbers don't decide this on their own: every score comes with a written assessment, plus a section of things that get no points. My agent proposed the weights and I approved them. That round is also when I set a rule I've kept since: I'm not writing the code, so I want agents to make technical-direction calls like this after their own rigorous investigation instead of leaning on my taste. My job is to set the bar, push back when something smells off, and read what comes back.

Round 7 took it to the code we actually ship. Effect's checks caught 4 of 9 planted bugs outright, plus half credit for three caught only by accident (unused imports and the like), for 5.5. The Promise lint rules caught the same four, plus two by accident, for 5. All of those were static checks. Effect's schema decoding found two real bugs on main, and we kept that lesson by putting zod decoding at every edge where input arrives (#5542). Effect also added about 168 KB gzip per Worker that loads it at startup, against 1.7 KB for the Promise helpers.

That's where the November 24 version of this post ended.

I wasn't satisfied

The more I thought about it, the less I liked the reasons Effect lost. On the morning of November 29, I went through them with my agent:

  • Bundle size and startup cost. The real user impact looked small to me. It's a cold start cost, and most requests don't pay it.
  • Our limits are made up. I thought Cloudflare's limits were 10 MB compressed and about 1 second of startup CPU, and we were nowhere near those. The bundle caps in our repo are ones we set for ourselves. (The real size limit turned out to be even bigger. More on that below.)
  • The slow checker. effect:check and the patched TypeScript it needs could run off the deploy path, as a PR-only job. Then they cost nothing on merge-to-live.
  • Readability. Agents read Effect fine. So readability isn't a reason, and this time it wouldn't be scored at all.

And there was a bigger problem with everything we'd done so far: every trial compared slices. A slice can't show you the benefits Effect only delivers once the whole codebase speaks it, where typed errors flow end to end and every service is a layer. If that's where Effect shines, seven rounds of slices would never see it.

So I said let's migrate the whole codebase to Effect, for real, and let the evidence decide.

Twelve weeks, or one day

My agent came back at 9:38 AM with a thoughtful plan. Small PRs to main, a bridge so unconverted code could call converted code, a lint rule to keep converted directories in Effect, and checkpoints so stopping early would be cheap. It estimated 120 to 200 PRs over 8 to 12 weeks, with 6 to 10 sessions running in parallel.

I said no to that at 9:53. In my experience, agents overestimate this kind of work because they copy human workflows. A human team needs twelve weeks because people can't work in thirty places at once, but agents can. So I asked for one PR with the full migration, done in about a day, with child sessions converting in parallel and folding back into that one PR. Verify it on the preview deploy. Merge it if it passes. Otherwise close it with the evidence.

My agent revised the plan and kept the method: baseline on main first, the checker as a PR-only job, a comparison of what plain tsc catches versus Effect's language service, hard stops measured against Cloudflare's limits instead of ours, and a blinded evaluation against main.

At 9:56 AM I said: "go"

How we kept it honest

I care about this part more than the result, because a rewrite this big is really easy to fool yourself with. Here's the short version. The full rubric, the answer key, the briefs, and how every number was computed are in the appendix.

By 10:05 AM, before a single line was converted, the scoring rubric was frozen, and so was a private answer key of planted bugs. Nothing got decided after the fact. The weights were my agent's proposal, and they were on the plan I said "go" to:

SectionWeight
Bug prevention35
Correctness under change20
Operational quality15
User-facing runtime cost15
Ongoing cost (checks, CI)15

Readability wasn't on the list. I'd already conceded that one.

We measured main first. Over the previous five days, merge-to-live had a median of 349 seconds (p90 1,190 s), PR validation a median of 945 seconds (p90 4,010 s), and Sentry had 36 issue classes in the last week. Bundle size and startup CPU were measured for every Worker the same way they'd be measured on the branch.

Then the planted bugs. Fourteen of them, each planted in the same place in both trees (main and the Effect branch) and written the natural way for each tree, so both trees carried the same 14 semantic bugs. For each one we recorded what caught it: plain tsc, Effect's language service, lint and other checks, tests, or the blind hunter.

Each tree got its own bug hunter that knew nothing about the trial. The trees were labeled X and Y everywhere, but that only hid the labels. Anyone reading the code could tell which tree was Effect.

Fresh agents also implemented the same three new features in each tree: a KV batch delete, password lockout backoff, and webhook dead-letter handling with backoff. The judge (an agent that built none of the code) had acceptance tests the authors never saw, and every new defect cost a quarter point.

And the decision rule was one I couldn't wiggle out of: merge if it passes, close with the evidence if it doesn't.

The day of the migration

Devin ran the migration, and it spawned 64 child sessions over the day: converters, fixers, a baseline runner, hunters, follow-up writers, and the judge. All times are Mountain Time.

"All of Kody" meant all the server code: the main worker, the start server, shared packages, background jobs, the push queue, and the small Workers. That's about 650,000 lines, 307 capabilities, 17 Durable Objects, and 12 queue consumers. We left out the code that gets bundled into users' Dynamic Workers, because Effect there would add to a cold start users feel on every execute. We also left out the React client, the CLI, the mock servers, and the desktop app. zod stayed at the edges where input comes in and output goes out, with Effect Schema inside.

10:26 AM. The foundation went in, with effect:check as a PR-only job: exact effect@4.1.7 and @effect/language-service 0.87.5, shared helpers for outbound calls with named deadlines, one function (runEdge) as the only place Effect turns back into a Promise, and a temporary legacy() bridge for code that wasn't converted yet. The bridge count had to reach zero. The foundation alone added 14 bytes to the platform Worker. Then 30 child sessions started converting slices of 15,000 to 30,000 lines each, in parallel. That's more than the 12 to 16 in the plan, to keep every slice small enough to finish in a day. There was already one warning sign, though: the language-service check took 228 seconds before anything was even converted.

10:59 AM. Turns out our own measurements were off. Wrangler's dry run said main's compressed upload for the origin Worker was already 13.0 MB (Wrangler reports MB), past the 10 MiB compressed limit we were using as a hard stop, and platform and runtime were at 87% and 82% of it. But origin deploys fine, so my agent switched the hard stop to the per-Worker change from main: fail if any Worker under 10 MiB on main went over it.

11:49 AM. All 30 slices converted and pushed, and the first real problem showed up. Slices that called each other's newly converted functions with await compiled just fine, and then skipped the call entirely. In one case that skipped a credential grant check. 😱

12:24 PM. All 30 slices merged into one branch. It didn't build. Like, at all. About 5,900 type errors (most of them in tests), about 4,400 places where an Effect was awaited or left unused and would silently never run, and 431 bridges still in place. Fifteen fix sessions started in parallel, each owning a group of files and their tests.

1:28 PM. An hour later it was down to roughly 30 type errors. That surprised me.

1:44 PM. Draft PR #5702 opened. It still had about 290 type errors, 109 awaited or unused Effects, and 108 bridges to work through.

4:00 PM. Typecheck, lint, format, and the awaited-Effect scan were all clean, with zero bridges left. But 266 Node tests and 12 Workers tests still failed, and 27 Workers tests crashed because Effect tried to hash Durable Object handles. That one would have broken package apps, email, and community flows in production. The first full effect:check took 784 seconds, and the language service alone reported 6,133 findings. The converters had never been asked to run it, and those findings were never worked through.

4:14 PM. Six test-fix sessions finished. Along the way they found and fixed about a dozen real bugs that the conversion had introduced and typecheck had missed. effect:check took 524 seconds on a quiet machine and still crashed partway through. The build failed too, because an OG image WASM import got pulled in where it shouldn't have.

5:08 PM. The agents fixed both. effect:check got down to 176 seconds on 4 cores by running its projects in parallel. The build failure turned out to be converted server code leaking about 1,500 Worker modules into the browser bundle, and with that fixed, per-page client JS was 17 KiB gzip over main. The last 4 test failures got fixed, and three of them were real bugs, including a request-context leak I'll come back to.

Evening. My agent told me the PR had merge conflicts with main. I said: "Let's handle conflicts when necessary, not before." Main takes about 90 PRs a week, so resolving conflicts on a branch that might never merge would have been wasted work.

9:39 PM. Bundle and startup numbers came in on the near-final tree. Every Worker stayed inside Cloudflare's limits, but our own startup budget (160 ms) and size caps failed. My agent raised those on the branch only, so CI wouldn't block the preview.

10:55 PM. The judge's scores came in, and #5702 closed unmerged by the decision rule. It touched 3,380 files in about 236 commits. The branch is kept as evidence, linked from #5702.

From "go" to a closed PR took 13 hours, for a migration the plan said would take twelve weeks. That's kind of wild, and it might be the most useful thing I learned from all of this, Effect or not.

The bugs typecheck missed

Here's a simplified version of the most common bug, with made-up names. One slice converted a function to Effect:

// before
export async function checkGrant(user: User, credential: Credential) {
	// throws if the user can't use this credential
}

// after
export const checkGrant = Effect.fn('checkGrant')(function* (
	user: User,
	credential: Credential,
) {
	// fails if the user can't use this credential
})

Another slice, converted at the same time by a different agent, still called it the old way:

await checkGrant(user, credential)
// TypeScript is happy. Nothing ran. The check never happened.

You can await any value in TypeScript. Awaiting an Effect just hands you the Effect back without running it. There were about 4,400 of those. The agent had to write its own scan to find them, and that scan became a required gate before anything could ship.

And that wasn't the only kind of bug the conversion introduced:

  • An Effect got used as a true/false value. An Effect object is always truthy, so the 30-day account-restore window check never ran.
  • tokenGet returned an Effect that never ran instead of the token.
  • Some typed errors turned into crashes and lost their mapped error codes.
  • Effect tried to hash Durable Object handles, which crashed.
  • Values cached with Effect.cached or a Deferred were shared across requests, so a continuation could resume inside a different request's context. That's a Workers-specific hazard, and it's the kind of thing that leaks data between users.

Every one of these was caught before merge. The scan, the tests, and the fix sessions did their jobs. But plain tsc didn't catch any of them. Effect's language service might have caught some, but the converters never ran it, and nobody worked through its findings.

The scores

Here's how it scored on the rubric:

Section (weight)Main (Promise + lint)Effect
1. Bug prevention (35)14.5012.88
2. Correctness under change (20)13.1810.51
3. Operational quality (15)not run (≥ 0)not run (≤ 15)
4. User-facing runtime cost (15)150
5. Ongoing cost (15)15≤ 4
Total≥ 57.7≤ 42.4

Even if Effect got every one of the 15 operational-quality points, it couldn't catch main. So the rest of the checks (the real-flow matrix on the preview, an interleaved latency run against a control preview of main (#5699), the operational judge pass, and the final full validate) were skipped. None of them could change the outcome. The math behind every cell is in the appendix.

Planted bugs

Same 14 bugs in each tree:

MainEffect
Caught by automated layers (tsc, language service, lint, tests)66
Caught only by Effect's language servicen/a1 (an unawaited KV delete)
Caught by plain tsc00
Found by the blind hunter118
Found by anything119

The automated layers tied. Plain tsc caught nothing in either tree, so the type system on its own didn't buy anything here. The one catch unique to Effect came from its language service, which needs the patched TypeScript.

The big difference was the hunters. The one reading the Effect tree found 8 and the one reading main found 11. Four bugs that the main hunter found slipped past the Effect hunter: a cross-org cache-key leak, a password-reset comparison that breaks when two events land in the same millisecond, a check-then-act race on usage, and an RPC for "last used" tracking that blocked the request. To be fair to the Effect hunter, it found one the main hunter missed: a quota-read failure that surfaced as a raw error. The hunters reported 32 and 25 findings in total. The ones that matched no planted bug would have fed the skipped operational-quality section, so nobody verified them, and they don't count for either side.

Hidden follow-up specs

Hidden acceptance tests, minus a quarter point per new defect:

SpecMainEffect
KV batch delete10/10, 0 defects10/10, 0 defects
Password lockout backoff8/11, 2 defects10/11, 2 defects
Webhook dead-letter/backoff12/12, 1 defect11/12, 3 defects

Effect did better on the lockout spec. Main did better on the webhook spec, with fewer new defects.

Runtime cost

Median of three Wrangler startup-CPU runs against main:

WorkerCompressed sizeStartup CPU
origin+2.5%96 to 114 ms
platform+3.2%225 to 338 ms
runtime+3.2%133 to 219 ms
jobs+28%16 to 32 ms
push-queue6 to 30 KiB0 to 25 ms

That's about 1.1 MB more gzip across 11 Workers. Every small Worker picks up a floor of about 22 to 35 KiB just for having Effect in it. Platform startup went up 50% and runtime went up 64%.

Ongoing cost and partial adoption

effect:check took 176 seconds on 4 CPUs after parallelizing. The first version took 524 to 784 seconds and crashed.

We looked at partial adoption too. Most of the cost is a per-Worker floor plus startup time, and Effect brought no bug-prevention advantage to offset it. So "just the Durable Objects" or "just the jobs Worker" pays most of the cost for none of the benefit we hoped for.

A "skills issue"?

The night we closed the PR, right after I read the results, I said this to my agent:

I think one interesting insight here is that the agent made mistakes with Effect. That may be a 'skills issue' but the priority should be what agents are good at and unless I'm misreading this, this test demonstrates that agents are better when not using effect because it kept adding silent bugs.

The evidence backs that up. My agents made a LOT of mistakes with Effect. We had thousands of Effects that never ran, a restore check that silently passed, and request state bleeding between requests 😬. And the hunter reading Effect code found three fewer planted bugs than the hunter reading Promise code.

And yeah, maybe it's a skills issue. If you gave this codebase to a team of people who've written Effect for years, I'd bet a lot of those mistakes never happen. I believe that.

But Kody's priority is what agents are good at, because agents write Kody's code. This test says that today, agents write and review plain async/await better than they write and review Effect. The whole argument for Effect was that it would make mistakes harder. For my agents, it made a new class of mistakes easier, and plain TypeScript didn't see them.

Here's the big caveat: this measured agents writing Effect in November 2026. It doesn't tell you what Effect is capable of in the hands of expert humans. If your code is written by people who know Effect deeply, this post isn't evidence against you using it.

What #5702 didn't do

After this post went up, Mike Arnaldi and Moishi Netzer pointed out on X a few things the migration PR didn't do. They're right about all of them, so here they are:

  • It never wired up tracing. The branch has no tracer exporter (no Tracer, OpenTelemetry, or withSpan code) and no per-isolate ManagedRuntime. The only runtime code is runEdge, which calls Effect.runPromiseExit on every invocation.
  • It was mostly a 1:1 conversion. env, db, and ctx stayed explicit parameters threaded through every call instead of becoming services and layers.
  • The converter brief didn't carry the expert setup from the earlier rounds. Its rules went the other way: "Do not construct a Layer or Runtime at module scope," and runEdge was "the only sanctioned Effect-to-Promise boundary." Krish's one-runtime-per-isolate suggestion never made it to the converters.
  • Effect's language service never ran in the agents' edit loop. Their done criteria were a pattern scan, plain tsc, tests, format, and lint. The language service only ran in the PR-only effect:check, and the run ended with its roughly 6,133 findings unfixed.
  • The operational-quality section (15 points) was skipped.

So what #5702 really measured was agents doing a fast, mostly mechanical migration with none of the expert setup. That's a real gap, and it's one more reason for the caveat above. These gaps mostly bear on the bug-prevention and operational sections. I don't know how much they'd have changed the outcome, but they're exactly where Effect is supposed to shine. The earlier rounds that applied most of the experts' advice (rounds 2 to 7) still came out against Effect overall, even though round 5 found two bugs only Effect's rules caught.

Thank you, Mike and Moishi. This is exactly the kind of pushback I want.

Where my challenge was right

My November 29 pushback wasn't wrong across the board. Some of it held up:

  • Effect fit inside Cloudflare's limits. After the run we learned that Cloudflare doesn't have a compressed size limit anymore, which is why origin deployed fine. The current limit is 64 MiB uncompressed, on every plan (Cloudflare's docs). Thanks to CodeRabbit, the code review bot, for pointing that out. Measured the right way, main's origin Worker is about 48 MiB, or 75% of the limit, and Effect's was about 50 MiB. So it fit, but origin is the Worker to watch. Every startup stayed well under 1 second.
  • The checker really can run off the deploy path. It ran as a PR-only workflow, and it didn't touch merge-to-live.
  • The bundle caps really were self-imposed. Effect blew through them and still stayed inside the platform's limits.

And some of it didn't. The cold start cost got a lot bigger once the whole codebase was in Effect (+50% startup CPU on platform and +64% on runtime). And the benefit I was hoping a full migration would finally reveal, better bug prevention, didn't show up. It went the other way.

What Effect did well

Effect did a lot of things well, and I don't want that to get lost.

Its rules are good rules. In round 5, "handle every error" and "every outbound call gets a deadline" found two real bugs that a careful hunt missed. In round 7, schema decoding at the edge found two real bugs on main. Both of those lessons are in Kody now, written with zod, a deadline helper, and lint rules. Effect taught us those, and I'm grateful.

In the full migration, when the bug planter ran effect:check, Effect's language service caught a planted bug that nothing else caught in the Effect tree (an unawaited KV delete), and the Effect tree did better on the password lockout spec. Once you know Effect, the code reads fine. And the earlier trials credited it with more consistent failure handling and better test coverage than the Promise builds.

And the Effect community made this trial far better than it would have been. @mj-meyer, @joelhooks, @KrishRVH, and @mikearnaldi took the time to tell us our early Effect wasn't idiomatic and how to fix it. Every round after that was fairer because of them. Thank you.

What we fixed in Kody because of this

A trial that only produces a "no" isn't worth much to me. The slice trials already gave us zod decoding at the edges, the deadline helper, and the request-path lint rules (#5542), plus the round 5 bug fixes (#5501, #5502, #5503). The full migration taught us a few more things about our own platform, and those fixes are merged now. Devin, which ran the migration, found or wrote up all five. CodeRabbit caught the size limit and tightened the new lint rule, and the planted-bug round is where the new regression tests came from:

  • #5710 adds a decision record to Kody's contributing docs: Promise plus required helpers plus lint, not Effect. It has the scores, the conversion hazards we hit (the ones above, plus Effect<Effect> values and server code leaking into the client bundle), and what would make us revisit. Without it, the next agent would happily propose Effect again. 😅
  • #5711 fixes our weekly latency bench. It used to go green while measuring nothing when its token wasn't configured, which is why we had no production latency baseline the morning of the migration. Now it warns on scheduled runs and fails on manual ones. (Setting the token still needs a human, so that one's on us.)
  • #5712 updates our startup budget docs with Cloudflare's real Worker size limit (64 MiB uncompressed), which Wrangler number to read, and how much headroom we have today.
  • #5714 adds regression tests for five of the planted bug classes: cross-org MCP auth cache isolation, a permanent push 4xx that's sent once instead of retried, the publish in-flight count restored when something throws, org transfer rolled back atomically, and exactly one success when concurrent meter consumes hit the limit. Each test passes on main and fails when its planted bug is put back.
  • #5715 makes no-floating-promise a lint error across all deployed server code. It fixed about 309 floating promises, and 201 fire-and-forget audit writes now stay alive after the response through waitUntil. Ten disable comments remain, each with a reason. The test-fix sessions and the awaited-Effect scan showed how easy this kind of bug is to miss.

If you skipped to the end

Here's the whole thing. If you want every rule, the answer key, and the briefs, they're in the appendix.

The question

Should Kody's server code use Effect, so the easy way to write it is also the correct way? I wanted the answer to be yes.

The slice trials (November 19 to 24)

Seven rounds on slices, the later ones blinded with planted bugs and an independent judge. Effect lost every one, and from round 4 on, careful Promise code (usually with lint rules) beat it. We kept Effect's best ideas in plain TypeScript.

The challenge (November 29)

I didn't buy the reasons Effect lost. The size and startup costs were far from Cloudflare's limits, the checker could run off the deploy path, and readability shouldn't count against Effect when agents read it fine. And slices can't show whole-codebase benefits. So we migrated everything.

The migration (November 29, one day)

My agent proposed 120 to 200 PRs over 8 to 12 weeks. I asked for one PR in one day. The rubric and a private answer key of planted bugs were frozen at 10:05 AM, before any code changed. Thirty agents converted about 650,000 lines in parallel. Fifteen more fixed about 5,900 type errors and about 4,400 Effects that silently never ran. The fold-in scan and the tests caught real bugs typecheck missed, including a skipped credential grant check, a skipped restore window check, and request context leaking between requests. PR #5702 touched 3,380 files.

The result

Main scored at least 57.7 and Effect at most 42.4, so the PR closed by the rule we set that morning. Automated checks caught 6 of 14 planted bugs in each tree, and plain tsc caught none in either. The blind hunter on main found 11, and the one on the Effect tree found 8. Platform startup CPU went from 225 to 338 ms, runtime from 133 to 219 ms, and total gzip grew about 1.1 MB. Cloudflare's limits still passed.

Why we decided

The numbers made it clear, but the reason I'm comfortable with it is the bugs. Agents made more mistakes writing Effect and found fewer mistakes reading it, and the mistakes they made were invisible to plain TypeScript. #5702 didn't use the expert setup, but the earlier rounds that applied most of the experts' advice still came out against Effect overall. That says nothing about Effect's ceiling with expert humans.

What I'd tell you

If you're making a call like this for a codebase agents write, here's what I learned:

  • Test with the agents who'll write the code. Your taste (and mine) is a poor proxy for what they do well.
  • Freeze the rubric and the answer key before you start, and write down what happens if it fails. That's what let me close a PR I'd spent a day on without arguing with myself.
  • Blind everything you can. Builders, hunters, and the judge should know as little as possible about what you hope happens.
  • Plant bugs. Bugs that agents happen to report are a much weaker signal than bugs you know are there.
  • Don't trust a slice to tell you about the whole. And don't trust a twelve-week plan from an agent either. Ask what it would take to do it in a day.
  • Give the agents the tool's own feedback loop. Effect's language service never ran in our converters' loop, and that's a fair hole in #5702.
  • Steal the good ideas. Most of what I wanted from Effect turned out to be a few patterns we could keep without switching runtimes.

I went into this hoping Effect would win, and I gave it about every chance I could think of. It didn't, and I'm at peace with that. Kody's server stays on async/await with required helpers, lint rules, and zod at the edges.

Thanks to everyone who gave feedback along the way. This got a lot better because of you. Good luck!

Appendix: how we ran it

This is the long version, for anyone who wants to check our work or run something like it. Everything here comes from the experiment's saved files: the rubric, the private answer key, the briefs, and the measurement logs. The rubric file and the answer key were kept with the experiment's working files rather than committed to the repo, so this appendix is the published copy. Times are Mountain Time.

A quick cast list. Devin's lead session ran the full migration: it wrote the plan, the rubric, and the answer key, and every converter, fixer, planter, hunter, follow-up writer, and the judge was a fresh child session of it. I talked to it through my own assistant agent, which relayed my messages and didn't write any of the migration code or the rubric. In the main post, "my agent" means one of those two: the plan and the weights came from Devin's lead session. In the earlier rounds, each builder, hunter, and judge was its own fresh session too.

The frozen rubric, word for word

The lead Devin session wrote the rubric at 10:01 AM on November 29, five minutes after I said "go" and before any conversion code existed, and froze it there. I didn't edit it, and neither did my assistant agent. The weights came from the plan I'd said "go" to, which the lead session proposed. "SHA0" means main at 18d54158f, the baseline commit.

Frozen 2026-11-29 before any conversion code. Readability is NOT scored. Trees
are labeled X and Y (random assignment, private key); judges/hunters never learn
which is Effect beyond what the code shows, and never see Kent's preference or
earlier trial conclusions.

Weighted total out of 100:

1. Bug prevention (35): planted-bug round. Each of ~15 planted sites (same
   semantic bug in both trees) scores per detection layer: caught by plain
   `tsc` (1.0), by tsc+Effect language service (0.85), by lint/check scripts
   (0.7), by existing tests (0.6), by blind hunter (0.4), missed (0).
   Score = 35 * mean(site score). Each catch also recorded per layer so the
   LS-dependent share is visible.

2. Correctness under change (20): 3 hidden follow-up specs, each implemented by
   a fresh agent on both trees; judged by hidden acceptance tests + judge
   review for new defects. 20 * mean(pass fraction adjusted -0.25 per new
   defect found by judge, floor 0).

3. Operational quality (15): blind residual hunt over the same ~20 modules per
   tree: confirmed real defects (judge-verified, deduped) in: unhandled/untyped
   failure, missing deadline, swallowed error, leak, retry misuse,
   interruption/disconnect handling. Fewer is better:
   15 * (1 - own/(X+Y)) when X+Y>0, else 7.5 each.

4. User-facing runtime cost (15): from measured numbers. Start 15; -3 per
   Worker whose startup CPU regresses >10% vs SHA0; -3 per latency-bench path
   whose warm p95 regresses >5%; -2 if cold execute-noop regresses >10%;
   floor 0. Hard stops override (see plan).

5. Ongoing cost (15): Start 15; -1 per +10% PR validate wall time; -2 if
   merge-to-live median regresses >5%; -1 per +100 KB gzip total across all
   Workers; -2 if effect:check >3 min; floor 0.

Decision: Effect PR merges only if it clears all hard stops, full validation,
all preview flows, and its weighted total >= Promise + lint main's. Otherwise
close with evidence.

The hard stops were Cloudflare's size and startup limits and a 5-minute ceiling on effect:check. (The size stop used Cloudflare's old limit. See How runtime cost was measured.)

How each rubric rule was applied

Main is the baseline, so it scores the full 15 on sections 4 and 5 by definition.

Section 1, bug prevention. Each planted site takes the weight of the best layer that caught it, and the section score is 35 times the mean over the 14 sites:

Best layer that caught the siteWeightMain sitesEffect sites
L1 plain tsc1.0nonenone
L2 Effect language service0.85n/aP03
L3 lint and check scripts0.7P01, P14P01
L4 existing tests0.6P03, P05, P09, P15P05, P09, P14, P15
Blind hunter only0.4P07, P08, P10, P12, P13P04, P07, P10
Missed0P02, P04, P06P02, P06, P08, P12, P13
  • Main: 2 × 0.7 + 4 × 0.6 + 5 × 0.4 = 5.8, and 35 × 5.8 / 14 = 14.50.
  • Effect: 0.85 + 0.7 + 4 × 0.6 + 3 × 0.4 = 5.15, and 35 × 5.15 / 14 = 12.88.

Section 2, correctness under change. Each spec scores its pass fraction minus 0.25 per new defect, with a floor of 0, and the section is 20 times the mean:

SpecMainEffect
KV batch delete10/10, 0 defects = 1.010/10, 0 defects = 1.0
Password lockout backoff8/11 - 0.5 = 0.22710/11 - 0.5 = 0.409
Webhook dead-letter/backoff12/12 - 0.25 = 0.7511/12 - 0.75 = 0.167
Mean, × 200.659 × 20 = 13.180.525 × 20 = 10.51

Section 3, operational quality. Not run. Effect's best possible total was 12.88 + 10.51 + 15 + 0 + 4 = 42.4, and main's worst possible total was 14.50 + 13.18 + 0 + 15 + 15 = 57.7. Nothing in section 3 could close that gap, so we didn't spend the judge time on it.

Section 4, user-facing runtime cost. Startup CPU regressed more than 10% on five Workers. That's 5 × -3 = -15, which hits the floor of 0. The latency-bench paths and the cold execute-noop weren't measured, and there was nothing left to deduct anyway.

WorkerMain startupEffect startupChange
origin96 ms114 ms+18.9%
platform225 ms338 ms+50.3%
runtime133 ms219 ms+64.2%
jobs16 ms32 ms+97.5%
push-queue0 ms24.6 msfrom 0

Section 5, ongoing cost. Total Wrangler gzip across the 11 Workers grew 1,099.84 KiB, about 1,126 KB. That's 11 full 100 KB steps, so -11, which leaves 4. The final effect:check time was 176 seconds, under 3 minutes, so there was no -2 for that. PR validate time and merge-to-live were never measured for the Effect branch, which is why Effect's score is "at most 4."

Totals. Main: 14.50 + 13.18 + (at least 0) + 15 + 15, so at least 57.7. Effect: 12.88 + 10.51 + (at most 15) + 0 + (at most 4), so at most 42.4.

How the bugs were planted

The lead session wrote the private answer key before any conversion: 15 sites, one or two for each bug class the rubric names, plus ordering, isolation, expired-ticket, and partial-write classes. Every site sat in a module of the roughly 20-module hunt set.

Before planting, it adapted 5 sites to match main's real code:

  • P03 became "per-key delete not awaited inside mapWithConcurrency."
  • P08 became "mcpAuthCacheEntryMatches drops the boundOrgId comparison."
  • P09 became "<= becomes < in isIssuedAtInvalidatedByPasswordChange."
  • P13 became "the DO touch RPC is awaited on the MCP path without a deadline."
  • P15 became "the alarm reschedules at Date.now()+0 on failure."

One separate child session planted both trees from one brief: the same semantic bug, written idiomatically for each tree (Promise style in main at 18d54158f, Effect style in the Effect tree at 3b542b811). The placement rule from the brief:

plausible, minimal and compile-intent-neutral: don't add casts or ts-ignore to dodge checks. If a tree's type system forces a different shape, use the most natural code a developer would write.

Each tree got one "wip" commit with all its plants: main 7575da27e and Effect 482c1b1f5. They were pushed with --no-verify, because the repo's hooks rejected the planted code (which is sort of the point).

P11 (an abort not propagated in execute-health-probe) was dropped. Neither tree passed a caller abort signal there, so there was nothing equivalent to remove. That left 14 sites.

The planter departed from the brief in four places:

  • P05 went in email-raw-mime-store.ts instead of mailbox-do.ts.
  • P06 used the in-flight publish guard, since there's no lease object there.
  • P07 went in repo-push-queue.ts, which retries a permanent 4xx once, immediately.
  • P13 made mcp-auth.ts await the touch call.

Then the planter ran four automated layers on each tree and recorded the first one that caught each site:

LayerWhat ran
L1Plain tsc (npm run typecheck)
L2Effect's language service (npm run effect:check, Effect tree only)
L3Lint plus the repo's check scripts (plus the effect:check safety scan in the Effect tree)
L4The full Node and Workers test suites

A catch was an error or a failing test whose location or message pointed at the planted site.

The answer key

The hunters' trees were labeled X and Y. X was main and Y was Effect.

SiteModulePlanted bug (class)First automated layer, mainFirst automated layer, EffectMain hunterEffect hunter
P01webhooks/dispatch-queueAck before the delivery write (ordering)L3L3foundfound
P02oauth-refresh-familyRevoke-family write not awaited (missing await)nonenonemissedmissed
P03kv-deletePer-key delete dropped (missing await)L4L2foundfound
P04storage-runnerQuota-read failure surfaces as a raw Error (unmapped failure)nonenonemissedfound
P05email-raw-mime-storeCatch-all returns success (swallowed error)L4L4foundfound
P06repo-session-doPublish guard released only on success (resource leak)nonenonemissedmissed
P07repo-push-queuePermanent 4xx retried (wrong retry)nonenonefoundfound
P08mcp-auth-cacheboundOrgId comparison dropped (isolation leak)nonenonefoundmissed
P09password-change-lockout<= becomes <, so a same-ms credential survives (expired ticket)L4L4foundmissed
P10org-transfer/applyBatched writes split (partial write)nonenonefoundfound
P12user-meter-doIncrement after a suspension (check-then-act race)nonenonefoundmissed
P13mcp-authLast-used RPC awaited without a deadline (missing deadline)nonenonefoundmissed (borderline)
P14jobs-worker/watchdogReschedule failure ignored (swallowed error)L3L4foundfound
P15stripe-plan-refresh-doReschedule at now, no backoff (wrong retry)L4L4foundfound

Here's how each summary number in the post was counted:

  • Automated, 6 vs 6. Sites caught by any of L1 to L4. Main: P01 and P14 at L3, and P03, P05, P09, and P15 at L4. Effect: P03 at L2, P01 at L3, and P05, P09, P14, and P15 at L4.
  • Plain tsc, 0 vs 0. L1 caught nothing in either tree.
  • Language service only, 1. P03 in the Effect tree. Only the language service flagged the dropped KV delete there. In main, a test caught the same bug.
  • Hunter, 11 vs 8. Sites where a hunter finding matched the key.
  • Found by anything, 11 vs 9. The union of automated and hunter catches. Every automated catch in main was also found by main's hunter, so main stays at 11. The Effect tree adds P09, which tests caught but its hunter missed, so it's 9.

The lead session matched each hunter finding to the key by hand, with three tests: same file, a line inside or next to the planted hunk, and a scenario that describes the planted failure. A finding at the planted file and line with a different failure didn't count. For example, the main hunter reported storage-runner:1849 as a concurrent-usage race, so P04 was a miss for main.

One call was borderline. The Effect hunter reported inbound-mcp-connection-last-used.ts:64 as "a stalled UserMeter timestamp RPC prevents an otherwise authenticated MCP request from reaching its handler." That describes P13's consequence, but at the callee, not the planted caller in mcp-auth.ts:650. It was scored as a miss. Scoring it as a hit would raise Effect's section 1 from 12.88 to 13.88, and main would still lead on every count.

How the hunters worked

Each tree got one fresh Devin child session, with the same brief except for the tree letter. Each one got a tar.gz bundle of its planted tree: the hunt modules plus their same-directory tests. The Effect bundle also had the branch's shared Effect helpers and its Effect conversion rules. There were no comments marking bugs and no git history.

The hunters didn't see the answer key, which tree was Effect (beyond what the code shows), my preference, the earlier trials, or the other tree. Here's the brief, word for word:

You are auditing source code from a TypeScript Cloudflare Workers codebase.
Codebase <X|Y>'s source is the attached tar.gz; extract it and work only from
it. Don't clone repos, browse GitHub, or open PRs. Review ONLY these modules
(and what they call within the bundle as needed): webhooks/dispatch-queue.ts,
jobs-worker/src/watchdog.ts, entitlements/user-meter-do.ts,
billing/stripe-plan-refresh-do.ts, repo/repo-session-do.ts,
email/mailbox-do.ts (and email/email-raw-mime-store.ts),
oauth-refresh-family.ts, oauth-grant-prune.ts, storage-runner.ts,
rate-limit.ts, search-rate-limit.ts, queue-handler.ts, oauth-purge.ts,
deferred-work.ts, kv-delete.ts, execute-health-probe.ts,
password-change-lockout.ts, inbound-mcp-connection-last-used.ts, mcp-auth.ts,
push-queue-worker/src (incl. repo-push-queue.ts), mcp-auth-cache.ts,
org-transfer/apply.ts. Find real defects of these kinds: unhandled or untyped
failure; missing deadline/timeout on an outbound call; swallowed error;
resource leak (lock/lease/guard/stream not released); retry misuse (retrying
permanent failures, unbounded retry, no backoff); interruption/disconnect
handling; ordering bugs (ack/commit before write, check-then-act across a
suspension); isolation leak (data shared across users/orgs);
expired-token/ticket acceptance; partial writes. For each defect give
file:line, kind, a one-sentence failure scenario, and a confidence from 0 to 1.
Don't report style or readability. Don't change code. Final message: a JSON
list, inline and minified on one line, of the form
[{"loc":"path:line","kind":"","scenario":"","confidence":0.0}].

They had the standard tools of a Devin VM (a shell and an editor) and no time limit. Both started in parallel at 10:49 PM, and each answered in about 3 to 3.5 minutes. The main hunter reported 32 findings and the Effect hunter reported 25.

Findings were matched to the answer key with the rules above. Findings that matched no planted site would have fed section 3 after the judge verified them. Section 3 wasn't run, so those weren't verified, and I'm not counting them for either side.

The coin flip, the follow-ups, and the judge

The X and Y labels came from a coin flip recorded in the private key at 9:45 PM on November 29, before any follow-up or judge session started: X was main and Y was Effect. Every branch and report after that used only x and y. That blinded the labels and nothing else. Anyone reading the code could tell which tree was Effect.

The lead session wrote the three follow-up specs up front in a private prompts file. Each spec ran in a fresh child for each tree, so six children in all, starting at 9:46 PM from that tree's base commit on a throwaway branch. Each child was told:

Implement it in the codebase's existing style and conventions, with tests. Run the typecheck, lint, and the relevant tests. Don't touch unrelated files. Work alone and don't consult other sessions.

None of them was told about Effect, the experiment, or the other tree. The specs:

F1 (KV batch delete): add deleteKvKeys(kv, keys) ... deletes up to 100 keys with concurrency 4, each under the codebase's KV outbound deadline/timeout convention (add a reasonable one if none exists), and returns {deleted: string[], failed: {key, reason}[]}. One key failing must not stop the others. More than 100 keys is rejected with the codebase's caller-error type.

F2 (password lockout backoff): lockout duration doubles per consecutive failure (base 1 min, cap 24 h); reset on success; an expired lockout must not block.

F3 (webhook dead-letter/backoff), in webhooks/dispatch-queue.ts: Permanent delivery failures (HTTP 4xx except 408 and 429) ack the message and record it through the codebase's existing dead-letter path. Transient failures (5xx, 408, 429, network errors, timeouts) retry with exponential backoff via the message retry delay, base 30 s, capped at 1 hour. Never retry beyond the queue's configured max_retries. On the last attempt, dead-letter instead of retrying. Keep existing behavior that already satisfies this.

F3 got amended twice, and both times the same new text went to both trees. The first version targeted a push-queue Queue consumer, which didn't fit, because push-queue is an HTTP gateway to a Durable Object. The second targeted the Durable Object's retry path, but push credentials live in memory there, so a delayed retry isn't possible. The third version is the one above.

The judge was one more fresh child. It saw both bases (X at 18d54158f, Y at 3b542b811), the six follow-up branches, and the specs. It didn't see the answer key or the rest of the rubric. Its brief, in short:

  • Judge correctness only, not readability or style.
  • Write hidden acceptance tests from the spec, "NOT from the implementation's own tests," against each branch's public API, 8 to 12 cases per spec, with the same case list for X and Y.
  • Cover the boundaries: 100 vs 101 keys, a lockout expiring exactly now, the 24 h cap, 408 and 429 vs 404, the last retry, concurrency of at most 4, a hung delete hitting its deadline, partial failure, reset on success, and a failed dead-letter write.
  • Include a case proving the behavior is reachable in production.
  • Report the pass fraction, then list verified new defects as file:line plus a one-sentence scenario.
  • Push the tests to judge branches, and "don't speculate about which variant is better."

Here's what it found:

SpecMain (X)Effect (Y)
F110/10, no defects10/10, no defects
F28/11. 2 defects: the password-change and sign-in paths don't enforce the lockout10/11. 2 defects: sign-in doesn't enforce the lockout, and a failed lockout-row delete fails the password change
F312/12. 1 defect: an Activity write failure on a permanent error still gets acked11/12. 3 defects: two attempt-count undercounts after an owner-cap deferral, plus the same Activity defect

Section 1 didn't come from the judge. It came from the planted round above.

How runtime cost was measured

Baseline and final ran on the same Devin VM (8 vCPU, Node v26.13.1) with the same script. The baseline was main at 18d54158f, measured at 10:42 AM on November 29. The final was the near-final Effect tree at 804e61486, measured at 9:24 PM.

  • Size. wrangler deploy --dry-run --outdir <tmp> for each of the 11 Workers' production configs, reading the "Total Upload: X KiB / gzip: Y KiB" line. Origin was measured after the Vite build, from dist/server with --env production. Platform and runtime went through wrangler-env.ts. The gzip figure is what we used for the deltas and for the old 10 MiB hard stop.
  • Startup CPU, origin, platform, and runtime. The median of three samples from node tools/check-worker-startup-time.ts, which profiles wrangler check startup. Origin profiles the Vite-built slim entry that deploy uploads.
  • Startup CPU, jobs and push-queue. wrangler check startup --config wrangler.jsonc --env production, three runs each, median.
  • effect:check time. Timed under taskset -c 0-3, as a stand-in for a 4-vCPU CI runner.

The size hard stop used Cloudflare's old 10 MiB compressed limit. The real limit is 64 MiB uncompressed (Wrangler's Total Upload), with no compressed limit at all (#5712), and nothing about the hard-stop results changes with the right number.

Every round, from the first slice to #5702

Round 1: the newsletter slice

On November 19 at 7:19 PM, I asked for a scoped trial of Effect in Kody: one real slice and an honest written verdict. One builder, one arm (Effect), no control. The builder picked the newsletter slice (public sign-up with a honeypot, IP and per-address rate limits, Turnstile, a D1 upsert, a confirmation email and audit, single-use confirm with consent, and a consent outbox), 9 files, effect@4.1.4. Nothing was blind. The builder chose the slice, built it, and judged its own work (#5450).

Source grew from 664 to 1,172 lines (+76%) for the same behavior plus three fixes, each about 5 lines of plain TypeScript: the Turnstile siteverify fetch had no timeout, audit writes were void logAuditEvent(...) with no waitUntil, and a failed queue.send waited for a later sweep instead of retrying. dist/server grew 33,040 bytes gzip, and about 100 KB of Effect runtime landed on the Worker startup graph. The builder said don't adopt Effect.

@mj-meyer and @joelhooks replied on the PR that this wasn't idiomatic Effect 4, and pointed at what it should have used: Schema, the language service as the agents' feedback loop, tracer wiring, abort signals, and TestClock. They were right, and that became round 2.

Round 2: idiomatic Effect in a clean room

Same slice, rebuilt from scratch with the practitioners' guidance: the Effect language service with diagnostics as errors, @effect/vitest, Effect at the outer boundary only, Schema at every boundary, abortable timeouts, Schedule retries, Clock and TestClock, Effect.fn spans wired to real observability, and a hill-climb loop. The builder couldn't open the round 1 PR, branch, comments, or session, so round 1's choices couldn't anchor it. Base main at 202a80f2f (#5461).

The code was about 2.4 times the size (664 to 1,607 lines). The platform and runtime startup bundles each grew 492 KB raw, 161 KB gzip. Startup CPU showed no difference above noise, because every Effect import was behind a dynamic import(), which also defeats tree-shaking. effect:check took 7 minutes 10 seconds. The builder recommended against adopting Effect broadly and suggested porting the boundary wins to Promise code.

@KrishRVH replied on #5461 with a list: one ManagedRuntime per isolate, convert shared helpers once instead of wrapping them, use a stable Turnstile idempotency key, scope effect:check, measure a tree-shaken bundle, and judge on properties instead of line counts. @mikearnaldi asked a question on #5461 that changed the whole design:

is it actually the same behaviour? the Effect code is fully observable with granular telemetry at every function, it is type safe over the boundaries and it makes errors explicit, the fair comparison would be to a baseline of kody which has those features

On November 20 at 9:26 AM, I asked for a third clean-room run that used all of that feedback, with a positive brief.

Round 3: the experts' setup, judged on properties

Same slice, clean room again, with Krish's feedback applied. The PR compared properties side by side against main: bounded and abortable outbound calls, background work registered in the type, schema-checked boundaries, explicit errors, and telemetry that surfaces (#5477).

Effect got every listed property, with "abortable" only for siteverify, since D1, the mailer, queues, and dispatch take no AbortSignal. Runtime startup CPU went from 85.3 to 159.1 ms, about 1 ms under our 160 ms budget, and platform from 154.3 to 185.9 ms. Most of that came from converting shared helpers once, because the rate-limit and form-protection helpers are imported statically across both Workers. Each Wrangler (esbuild) bundle grew 478 KB minified (157 KB gzip), against about 133 KB minified (44 KB gzip) when tree-shaken with rolldown.

The builder also hit some traps. A shared Layer memo map cross-wired D1 bindings between runtimes (tests caught it). @effect/vitest pulled in Vitest 5, which crashed 119 of 157 workers-pool test files, so Vitest stayed on 4 with a pinned override. The language service's diagnostics CLI crashed on TypeScript 6.0.3, which is why effect:check patches a private copy of TypeScript. Verdict: don't adopt broadly yet, since most of the property wins can land in Promise code for a fraction of the cost.

Rounds 1 to 3 all had one builder grading its own work against main, which isn't a fair fight. Round 4 is where we fixed that.

Round 4: Effect against an equally careful Promise build

Mike's question became the design. On November 20 at 11:31 AM, two builders started from main on the scheduled retention and purge lanes, each knowing only its own arm:

  • Arm A, Effect: a clean break, Effect all the way down, with references to the Effect monorepo, alchemy, and executor, plus a hill-climb loop (#5487).
  • Arm B, Promise: the same production bar in plain TypeScript, with spans on every function, typed failures mapped exhaustively, schema validation, timeouts and abort signals, a shared retry helper, an injectable clock, and deliberate claim release (#5484).

The pass criteria were fixed before either build started and hidden from every builder. Effect would be recommended only if all five held: follow-up cost and residual bugs equal or better, seeded-bug detection at least as good, observability at least as good, inside the 160 ms startup budget and the bundle budgets (or a believable path there), and learning curve and initial line count don't count against Effect.

Fresh sessions, each seeing one build, made the same three follow-up changes to both: a purge webhook step with a new failure mode, transient D1 retry with a per-item backoff budget, and new claim, lease, and fence semantics (A: #5488, #5494, #5490; B: #5495, #5492, #5493). Separate sessions planted the same 5 bugs one at a time in each build. A judge that built nothing reviewed everything from 4:58 to 5:19 PM.

Promise won. Effect failed three of the five criteria, and observability was a wash. Seeded bugs: Effect caught 3 of 5, Promise 4 of 5. The difference was an unmapped new error: in B it broke three exhaustive switches at compile time, while A's inferred error union never got switch-checked. The judge said a fairer placement for that seed could tie it 3 to 3 without changing the answer. Residual bugs after the follow-ups were 7 each, but A had more after the first two. Effect's runtime Worker started in 177.9 ms (best of 6) against 131.3 ms, with 170 KB more gzip against 4 KB. Every A follow-up was pushed with --no-verify over a typecheck failure that already existed on A's base. This is where I said finding bugs still felt like a good reason to use Effect.

Round 5: does Effect find bugs as it spreads?

On November 21, arm A widened Effect to the next ring of cleanup lanes in #5487, next to the untouched Promise code and behind a switch that wasn't in any deploy config. Every bug it surfaced needed a failing test and a tag for how it surfaced (type error, language service, exhaustive mapping, scope release, schema decode, timeout requirement, ported test, or plain reading).

This time we had a control: a blind bug hunter on main at 43a10d26, same scope, never told about Effect or the trial, using static review, property tests, fault injection, and clock manipulation. The matching rules were fixed in advance: the same root cause in the same function counts once, only a repro or verified proof counts, and Effect gets credit only for bugs its machinery surfaced, not for plain reading during the migration.

Effect confirmed 3 bugs on main: an org audit outbox that deleted a row before emitting its event (exhaustive error mapping), an inbound reconcile that double counted an owner (plain reading), and a repo session cleanup RPC with no deadline (the timeout requirement). The hunter confirmed 7. That's 9 distinct bugs, with 1 flagged by both. The two that Effect's machinery surfaced were exactly the two the hunter missed, and the hunter found everything else, including a bug in a file Effect had converted. All the fixes shipped as small Promise changes (#5501, #5502, #5503).

Round 6: four arms and a weighted rubric

On November 22 at 8:07 AM, I asked for a clear decision on how Kody gets pit-of-success bug prevention. Four arms ran on the same cleanup lanes:

  • A, Effect: #5487, reused.
  • B, plain Promises: #5484, reused.
  • C, Promises plus lint and required helpers: a deadline-required wrapper for every outbound call, oxlint rules for missing deadlines, floating promises, and swallowed errors, and a small typed-failure mapper. No new dependencies.
  • D, XState: the stateful lanes as machines on the repo's xstate 6.0.0-beta.1, with plain promises elsewhere and deliberately none of C's helpers, so XState's own contribution could be measured.

C and D started from main at 43a10d26. Only two in-scope files differed from A's and B's bases, and the judge accounted for them. Builders knew only their own arm, and hunters knew nothing about the trial. The judge planted 9 seeds itself with one placement on all four arms (round 4's five, three for round 5's bug classes, and one in brand-new code), so the deciding seed couldn't turn on placement again. Every arm got a blind hunt and the same three follow-ups.

The rubric weights were my agent's proposal, and I approved them: bug prevention 30, correctness under change 20, runtime 20, readability 15, and adoption cost and reversibility 15. At 8:10 AM, I added a section of qualitative factors that get no points, and asked the judge to explain how it weighed the two. Promises plus lint scored 7.67, XState 6.28, plain Promises 6.08, and Effect 5.63. Effect's static checks caught 0 of 9 seeds, and it added about 30 ms of startup and about 177 KB gzip.

Round 7: request paths, Durable Objects, and queues

Round 7 asked whether round 6 held on code we actually ship, with effect 4.1.5. My agent wrote the rubric before any code was built, and no builder, follow-up author, or hunter ever saw it. Two blind builders rebuilt Kody's publish offload (start a build, upload content-addressed chunks with a per-build ticket, seal it, commit it):

  • Arm A was Effect 4 all the way down inside that path, with Promise edges at the boundaries (#5522).
  • Arm C was async/await plus required helpers (a deadline helper every outbound call goes through, and a typed-failure union with one exhaustive mapper per edge) and three custom oxlint rules: no outbound call without a deadline, no floating promises, and no swallowed errors (#5524).

Both kept asking what a contributor in a hurry would still get wrong, and fixed it, until a pass found nothing meaningful. A blind hunter reviewed each arm and wrote failing repro tests. Fresh agents made three follow-up changes on each arm: a chunk scan step with two new failure modes, bounded retry with a per-request budget, and a sliding upload lease with an abandon route (#5525 to #5530). A judge planted nine seeds in both arms, verified every hunt finding and builder claim, measured startup and bundles, and scored it all.

The weights were the same as round 6, and bug prevention split three ways: seeded bugs (60% of it), residual hunt bugs (25%), and bugs on main the approach's own machinery surfaced (15%).

CriterionEffect (A)Promises + lint (C)
1a Seeded bugs6.115.56
1b Residual hunt bugs0.00.0
1c Bugs on main via machinery10.00.0
Bug prevention5.173.33
Correctness under change10.010.0
Runtime cost5.049.97
Readability4.07.5
Adoption cost4.08.0
Weighted total5.767.32
SeedEffectPromises + lint
1 Unawaited R2 writecaughtcaught
2 Seal recorded before the document storedmissedmissed
3 New failure with no HTTP statuscaughtcaught
4 Storage failure treated as rejectionincidentalmissed
5 Timeout removed from an outbound callcaughtcaught
6 New webhook with no deadlinecaughtcaught
7 Unstarted build not discardedincidentalincidental
8 Expired ticket acceptedmissedmissed
9 Partial write reported as successincidentalincidental

The incidental catches for seeds 7 and 9 were unused-import or unused-variable errors, and nothing caught them once the dead code was gone. Both hunters found six real bugs each, all from main. All six follow-up PRs had zero issues. Effect's machinery score came from schema decoding finding two real bugs on main, which the Promise builder also found by plain reading. Effect added about 168 KB gzip per Worker that loads it at startup, against about 1.7 KB, and its effect:check took 52.4 s against 4.7 s for oxlint.

The same two arms then ran on Durable Objects and queues (webhook dispatch and the jobs-worker watchdog), and I asked to count that as part of round 7. Promises plus lint won 72.4 to 62.4. Effect caught one more planted bug there (a queue send with no timeout, which the lint rule missed because it only knew the call sites on its allowlist), both arms took the hidden follow-up in about 180 lines with no new bugs, and Effect added 18% gzip on origin and 57% on jobs.

The full migration (#5702)

Everything above this section describes it: the rubric, the planted bugs, the hunters, the judge, and the measurements. The Effect tree used exact effect@4.1.7 and @effect/language-service 0.87.5. It didn't carry the expert setup the earlier rounds used (see What #5702 didn't do).

Where to inspect it

Everything public is on GitHub:

P.S. If you just want the two PRs that matter most, start with #5702 (the closing evidence is in its last comment) and #5542, which is what we adopted from the slice trials.

Give your assistant a home of its own. Create a free account and start saving packages.

Create a free account