This repository was archived by the owner on Oct 16, 2026. It is now read-only.
Repository navigation
feat(dev): stable per-package ports, client bundle + /_assets, kody.dev.prebuild, faster rebuilds - #59
Merged
Conversation
This was referenced Oct 15, 2026
Merged
kody-bot
marked this pull request as ready for review
October 15, 2026 06:00
Owner
Author
|
bugbot run |
Owner
Author
|
bugbot run |
1 similar comment
Owner
Author
|
bugbot run |
Owner
Author
|
bugbot run |
cursor
Bot
force-pushed
the
cursor/kody-dev-ports-assets-speed-354f
branch
from
October 15, 2026 06:27
fd47e44 to
7b70202
Compare
cursor
Bot
force-pushed
the
cursor/kody-dev-agent-json-354f
branch
from
October 15, 2026 06:27
9b119c7 to
26c9bff
Compare
cursor
Bot
force-pushed
the
cursor/kody-dev-ports-assets-speed-354f
branch
3 times, most recently
from
October 15, 2026 06:46
38abb9c to
e813630
Compare
cursor
Bot
force-pushed
the
cursor/kody-dev-agent-json-354f
branch
from
October 15, 2026 06:48
57fe438 to
cf978e1
Compare
cursor
Bot
force-pushed
the
cursor/kody-dev-ports-assets-speed-354f
branch
from
October 15, 2026 06:48
e813630 to
03b005d
Compare
cursor
Bot
force-pushed
the
cursor/kody-dev-agent-json-354f
branch
from
October 15, 2026 06:50
cf978e1 to
4fdadfe
Compare
cursor
Bot
force-pushed
the
cursor/kody-dev-ports-assets-speed-354f
branch
from
October 15, 2026 06:50
03b005d to
7d9acfa
Compare
cursor
Bot
force-pushed
the
cursor/kody-dev-agent-json-354f
branch
from
October 15, 2026 06:51
4fdadfe to
3440bc9
Compare
cursor
Bot
force-pushed
the
cursor/kody-dev-ports-assets-speed-354f
branch
from
October 15, 2026 06:51
7d9acfa to
5aa3010
Compare
cursor
Bot
force-pushed
the
cursor/kody-dev-ports-assets-speed-354f
branch
from
October 15, 2026 07:05
5aa3010 to
758da87
Compare
cursor
Bot
force-pushed
the
cursor/kody-dev-ports-assets-speed-354f
branch
from
October 15, 2026 07:18
de17017 to
9a61a64
Compare
cursor
Bot
force-pushed
the
cursor/kody-dev-agent-json-354f
branch
from
October 15, 2026 07:18
cb20f60 to
d5bb07a
Compare
cursor
Bot
force-pushed
the
cursor/kody-dev-ports-assets-speed-354f
branch
from
October 15, 2026 07:19
9a61a64 to
f1dd581
Compare
cursor
Bot
force-pushed
the
cursor/kody-dev-ports-assets-speed-354f
branch
5 times, most recently
from
October 15, 2026 07:57
69a01dd to
e1d1de4
Compare
…ev.prebuild, faster rebuilds - Default port is derived from kody.id (4100-4999) and walks to the next free port; an explicit --port is exact and EADDRINUSE explains the fix. A second kody dev for the same package/target fails with the running URL. - Serve kody.app.client at /_assets/client.<hash>.js (packageContext. clientModuleUrl), kody.app.assets under /_assets/, and __version.json, matching published apps. Asset edits reload open pages. - kody.dev.prebuild runs before every build (KODY_DEV=1); failures are build errors; its own writes don't retrigger. kody.dev.ignore adds watcher ignore prefixes. - esbuild incremental contexts and a 30ms debounce: save-to-visible p50 ~148ms -> ~58ms on the demo app.
…he server A debounce timer that fired after close() created a fresh incremental context that was never disposed and kept Node alive.
… partial prebuild lines Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Bugbot: detached prebuild trees survived hard CLI death because the reaper only SIGKILLed the shell pid. trackGroup/untrackGroup tell the reaper to kill -pid so sh and its children die together. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Use /bin/kill -s KILL -- -pid for tracked groups, and wait for both the shell and grandchild to die in the regression test (CI flake). Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Prebuild rewrites generated inputs; absorbing those fingerprints before esbuild runs keeps track()'s mid-build detection from queuing an extra rebuild (gen-3) on every edit. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Bugbot: write the registry entry from onListening (before the first build) so a second kody dev during startup hits dev_already_running instead of claiming the next port and overwriting the registration. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
A failing kody.dev.prebuild still writes files; absorb them into the watcher baseline in runPrebuildStep's finally so the 1s poll cannot loop rebuilds off that output. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Rebase onto the ready-file shutdown fix left conflict markers; keep onListening early registration plus shutdown-on-ready-file-error. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Keep prebuild settle gating and fold mid-build watcher events into the active rebuild loop. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
cursor
Bot
force-pushed
the
cursor/kody-dev-ports-assets-speed-354f
branch
from
October 15, 2026 08:00
e1d1de4 to
fb400c0
Compare
Clear changedFiles/rebuildAgain and the debounce queue after rebaseline on prebuild failure so chokidar events from the failed run cannot restart the rebuild loop (CI: failed prebuild must not retrigger). Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Owner
Author
|
bugbot run |
… throws Explicit --port starts a second server and must not overwrite the primary attach registry. If onListening fails after the port is bound, close the HTTP listen handle so the process does not leak. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Owner
Author
|
bugbot run |
Resolve package-app-dev import conflict: keep client-asset helpers from ports and the gatewayFetchStream local runtime bridge from main. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
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 97addf7. Configure here.
|
🎉 This PR is included in version 1.26.0 🎉 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
Fourth of five stacked
kody devPRs (base: the agent mode PR). Adds stable ports, platform-parity assets (so packages like the slideshow no longer need their ownserve.mjs), a prebuild hook, and faster saves.Door:
two-way(kody.devis new, local-only manifest config; publish ignores it.)Cleanup:
noneSummary
kody.id(4100–4999), so URLs and OAuth redirect URIs survive restarts. If it is taken,kody devwalks to the next free port (up to 20).--portis exact. EADDRINUSE becomesdev_port_in_use, with anlsofcommand and alternatives.--port 0means any free port. Bad values are rejected (invalid_port).kody devfor the same package and target without--portfails withdev_already_running, naming the running URL and pid.kody.app.client(string, or{ entry, externals }) is bundled for the browser (esm, es2022, inline source map) and served at<appBasePath>/_assets/client.<16-char base64url sha256>.js.packageContext.clientModuleUrlpoints at the client bundle, and/_assets/__version.jsonreports{ clientModuleUrl, assetBasePath, publishedCommit: null }.kody.app.assetsare served under/_assets/with the platform's content types,no-store, and traversal protection.kody.dev.prebuildruns a shell command from the package root before every build, withKODY_DEV=1. Output is tagged[prebuild]. A non-zero exit shows as a build error with the output tail. Its own file writes do not retrigger a build.kody.dev.ignoreadds watcher ignore prefixes.context()/rebuild()for both bundles, and the debounce drops from 120ms to 30ms. workerd has no config reload, so blue/green restart stays.close()used to create an esbuild context that was never disposed, which kept Node alive. There is a regression test.Measurements
Demo app,
--target mock, 15 saves per run, same machine:Rebuild itself is ~23–27ms. Startup is roughly flat: workerd boot dominates, and the reaper and registry add a few ms.
Testing
npm run validatepasses.test/dev-ports-assets.test.tscovers:--portparsing;kody.devand client object-form manifest parsing;clientModuleUrl,__version.json, assets, a client edit changing the hash, and an asset edit;dev_already_runningrefusal.close()never starts a rebuild after close.Note
Medium Risk
Changes core
kody devlisten/bind, rebuild, and request routing; prebuild runs arbitrary shell commands from package.json (local dev only).Reviewed by Cursor Bugbot for commit 97addf7. Bugbot is set up for automated code reviews on this repo. Configure here.