This repository was archived by the owner on Oct 16, 2026. It is now read-only.
Repository navigation
fix(dev): zero-downtime rebuilds, reliable watching, no orphans, real logs and errors - #63
Merged
Merged
Conversation
… logs and errors - Start the new workerd and swap only once it listens; drain the old one. Requests during a rebuild wait for it instead of getting a 503. - Watch with chokidar plus a stat poll over the bundle graph so replaced files (sed -i, cp, atomic saves) can never leave a stale bundle serving. - Detached sh reaper kills workerd and removes the work dir if the CLI dies; startup sweeps kody-dev-* dirs and orphaned workerd from dead CLIs. - Stream app console.* (workerd stdout) tagged by request. - Build errors carry file:line:col + code frame, drop the 'for local execute' wording, and are served as a 500 page until fixed. - Uncaught handler errors return a dev-only 500 with the stack mapped to .ts sources; native frames and workerd C++ addresses are stripped.
This was referenced Oct 15, 2026
Merged
kody-bot
marked this pull request as ready for review
October 15, 2026 05:58
Owner
Author
|
bugbot run |
…errors, watcher ready rejects Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Owner
Author
|
bugbot run |
Owner
Author
|
bugbot run |
…y rejection Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Owner
Author
|
bugbot run |
Owner
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 755198d. Configure here.
|
🎉 This PR is included in version 1.23.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Stack: #63 → #58 → #61 → #59 → #60
Intent
Fix the
kody devcorrectness and logging problems found by hands-on testing on@kentcdodds/asteroidswith--target mock(CLI 1.23.0,package-app-dev.js). First of five stacked PRs: correctness + logs → live reload → agent/JSON → ports/assets/speed → polish.Door:
two-wayCleanup:
noneSummary
fs.watchrecursive is replaced by chokidar v4, which re-arms when files are replaced (sed -i,cp, atomic saves). A 1s stat poll (ino:size:mtime) over the files in the current bundle graph backs it up.exitstop workerd and remove thekody-dev-*temp dir. A small detached/bin/shreaper, fed tracked pids over a pipe, kills them and removes the dir if the CLI is SIGKILLed. Each start sweeps dirs and orphaned workerd left by dead CLI runs (owner.json), including older CLI versions.console.*always streams, tagged by request ([GET /scores #12] saved 3 rows). The app entry wraps console under AsyncLocalStorage.warnanderrorgo to stderr.file:line:coland a code frame. The header says "Could not bundle …" instead of "for local execute". Until the next good build, every request gets a dev 500 page (HTML for browsers, text otherwise,x-kody-dev-error: build), so a stale worker no longer keeps answering 200..ts(@jridgewell/trace-mapping). Runtime wrapper frames and workerd C++ prefixes and addresses are stripped. Uncaught errors become a dev-only 500 page with the stack.src/dev/:workerd-process,process-reaper,dev-watcher,dev-bundler,stack-trace,error-page,dev-events,dev-protocol. New dependencies:chokidar,@jridgewell/trace-mapping.Testing
npm run validatepasses.test/dev-server.test.tscovers: no non-200 responses while three rebuilds swap workerd; build error page withapp/message.ts:1:24and code frame, then recovery; tagged logs; a source-mapped runtime error; stack mapping; stderr cleanup; watcher ignore rules; the reaper killing pids and removing its dir when the pipe closes; and the stale-dir sweep.sed -iand viacp+mvall recovered./boomshowedat Object.fetch (app/entry.ts:9:41).Note
Medium Risk
Large refactor of the local dev server (proxy, subprocess lifecycle, and workerd entry), but changes are confined to
kody devand not published runtime paths.Reviewed by Cursor Bugbot for commit 755198d. Bugbot is set up for automated code reviews on this repo. Configure here.