This repository was archived by the owner on Oct 16, 2026. It is now read-only.
Repository navigation
feat(dev): agent mode — --json NDJSON events, /__kody/dev/status, --ready-file, attach - #61
Merged
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 |
Owner
Author
|
bugbot run |
Owner
Author
|
bugbot run |
cursor
Bot
force-pushed
the
cursor/kody-dev-live-reload-354f
branch
from
October 15, 2026 06:25
69a26a8 to
98621b7
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-agent-json-354f
branch
from
October 15, 2026 06:48
57fe438 to
cf978e1
Compare
cursor
Bot
force-pushed
the
cursor/kody-dev-live-reload-354f
branch
from
October 15, 2026 06:50
8362887 to
98621b7
Compare
cursor
Bot
force-pushed
the
cursor/kody-dev-agent-json-354f
branch
from
October 15, 2026 06:50
cf978e1 to
4fdadfe
Compare
…eady-file, attach
- kody dev --json prints ready / rebuild_start / rebuild_ok / build_error /
runtime_error / log events as NDJSON on stdout.
- GET /__kody/dev/status returns state, build id, and the last build or
runtime error.
- --ready-file writes { url, port, basePath, pid, statusUrl } once the first
build settles and removes it on exit.
- kody dev fetch attaches to a running kody dev for the same package and
target (registry in the user cache dir, confirmed via status); --no-attach
forces a one-shot server.
- Live reload only injects into requests that accept text/html, so agent
fetches see the app's bytes.
- The watcher's stat poll re-baselines after each build (no echo rebuilds).
- Dev server tests reuse the cached workerd instead of re-downloading it.
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Re-baseline after each build still suppresses echo rebuilds, but paths that changed since the previous baseline and were not the rebuild trigger fire onChange (mid-build edit). A track generation makes in-flight polls abandon so they cannot pair old fingerprints with the new map. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Poll retains the map it started with so a concurrent track() swap cannot pair old fingerprints with the new baseline. Mid-build edits returned from track() are queued onto changedFiles/rebuildAgain directly instead of onChange, so a debounced chokidar delivery of the same paths cannot schedule a second rebuild. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Prebuild (and similar) rewrite tracked inputs before esbuild runs. rebaseline() absorbs those fingerprints so track()'s mid-build comparison only reports edits that land during the bundle itself. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
cursor
Bot
force-pushed
the
cursor/kody-dev-agent-json-354f
branch
from
October 15, 2026 06:51
4fdadfe to
3440bc9
Compare
Owner
Author
|
bugbot run |
Bugbot on #61: registry files are per root+target; remove only when the pid still matches (leave unreadable successor files alone); watcher debounce reports building and gates proxy fetches until the rebuild starts. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Owner
Author
|
bugbot run |
1 similar comment
Owner
Author
|
bugbot run |
Owner
Author
|
bugbot run |
cursor
Bot
force-pushed
the
cursor/kody-dev-agent-json-354f
branch
from
October 15, 2026 07:18
cb20f60 to
d5bb07a
Compare
Owner
Author
|
bugbot run |
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Owner
Author
|
bugbot run |
Bugbot: wrap post-listen ready-file/registration in shutdown-on-error so a bad --ready-file cannot leave listen handles hanging; poll also checks trackGeneration so an in-flight poll cannot echo rebuilds mid-track. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Owner
Author
|
bugbot run |
…lete Bugbot: no-op same-bundle rebuilds still update lastRebuild.at for agents polling status; findRunningDevServer re-reads before deleting a dead-pid entry so a successor registration is not wiped. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Owner
Author
|
bugbot run |
Detach the tracked fingerprint map at the start of track/rebaseline so an in-flight poll cannot compare post-build bytes to the pre-build baseline. Fold mid-build watcher events into the active loop, ignore echoes of the files already building, and skip buildOnce when every path still matches the baseline. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
…dits Fingerprint equality is not a reliable content check on coarse mtime filesystems, so skipping buildOnce when paths still matched the baseline could ignore real saves (e.g. v0→v1). Poll-map detach and mid-build chokidar folding remain the echo guards. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0667555. Configure here.
Ignoring onChange for paths in buildingFiles meant a second save (or format-on-save) during an in-progress rebuild was discarded, and track()'s ignoreChanges could not recover it — kody dev kept serving the earlier bundle. Fold every mid-build watcher event into rebuildAgain instead. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
|
🎉 This PR is included in version 1.25.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
Third of five stacked
kody devPRs (base: the live reload PR). Lets agents drivekody devwithout scraping human output.Door:
two-wayCleanup:
noneSummary
kody dev --jsonprints one JSON object per line on stdout, each withtypeandts:ready {url, port, basePath, pid, statusUrl, buildId}rebuild_start {files}rebuild_ok {ms, buildId, restarted}build_error {file, line, col, message, diagnostics}runtime_error {message, stack, request}log {source, level, message, request}Status lines stay on stderr.
GET /__kody/dev/statusreturns{ ok, state, buildId, url, port, basePath, target, package, pid, lastRebuild, lastError }.--ready-file <path>writes{ url, port, basePath, pid, statusUrl }once the first build settles and removes the file on exit.kody dev fetchattaches to a runningkody devfor the same package and--target. It finds the server through a registry file in the user cache dir, confirms it via the status endpoint, and waits for any in-progress rebuild.--no-attachforces a one-shot server. Attached fetches get no live-reload script.The stat poll is re-baselined after each build, so it no longer causes a duplicate no-op rebuild.
Testing
npm run validatepasses.test/dev-agent.test.tscovers: status through ready, runtime error, and build error states;--jsonevent order withts; the ready file and registry existing atreadyand removed on shutdown; attached fetch seeing a fresh build, and not attaching across targets; and stale registrations being dropped.kody dev fetch(132ms) all worked.Note
Medium Risk
Touches dev-server request gating, file watching/rebuild scheduling, and cross-process registry files; mistakes could cause stale builds, duplicate rebuilds, or wrong attach targets, but scope is local dev tooling with tests.
Reviewed by Cursor Bugbot for commit 5d1349f. Bugbot is set up for automated code reviews on this repo. Configure here.