Skip to content

[NOT READY FOR REVIEW] feat(dev): CodeZip dev runner and process lifecycle core - #1883

Open
tejaskash wants to merge 5 commits into
feat/project-foundationfrom
feat/dev-server-core
Open

[NOT READY FOR REVIEW] feat(dev): CodeZip dev runner and process lifecycle core#1883
tejaskash wants to merge 5 commits into
feat/project-foundationfrom
feat/dev-server-core

Conversation

@tejaskash

@tejaskash tejaskash commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add process lifecycle utilities for long-running local servers, including line-based logging, process-group cleanup, and SIGTERM to SIGKILL escalation
  • add CodeZipDevRunner support for Python projects using uv and uvicorn --reload
  • add CodeZipDevRunner support for TypeScript projects using npm and tsx watch
  • pass PORT, LOCAL_DEV, and caller-provided environment variables to the agent process
  • define the DevRunner interface alongside its future handler and inject process dependencies for isolated tests

Verification

  • added runner coverage for missing source directories, dependency setup, command construction, and environment injection
  • added process coverage for output streaming, stderr classification, shutdown, and missing executables
  • bun test (565 tests)
  • typecheck passes

@github-actions github-actions Bot added the size/l PR size: L label Jul 31, 2026
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jul 31, 2026
@codecov-commenter

codecov-commenter commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.24873% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.79%. Comparing base (2b84b78) to head (970d944).

Files with missing lines Patch % Lines
src/core/dev/run.ts 10.71% 25 Missing ⚠️
src/errors/errors.tsx 58.82% 7 Missing ⚠️
src/core/dev/process.ts 98.59% 1 Missing ⚠️
Additional details and impacted files
@@                     Coverage Diff                     @@
##           feat/project-foundation    #1883      +/-   ##
===========================================================
- Coverage                    96.04%   95.79%   -0.25%     
===========================================================
  Files                          211      214       +3     
  Lines                         9916    10113     +197     
===========================================================
+ Hits                          9524     9688     +164     
- Misses                         392      425      +33     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jul 31, 2026
@tejaskash tejaskash changed the title feat(dev): CodeZip dev runner and process lifecycle core [NOT READY FOR REVIEW] feat(dev): CodeZip dev runner and process lifecycle core Jul 31, 2026
@tejaskash
tejaskash force-pushed the feat/dev-server-core branch from f5e0f3a to ba41e68 Compare July 31, 2026 16:55
@tejaskash
tejaskash force-pushed the feat/dev-server-core branch 4 times, most recently from 750364c to fe79c87 Compare August 3, 2026 18:01
The first executable slice of agentcore project dev. CodeZipDevRunner
bootstraps a uv venv (or node_modules) on first run, then serves the
entrypoint with uvicorn --reload (or tsx watch). spawnServer owns process
lifecycle: line-streamed logs, SIGTERM->SIGKILL escalation on stop, and a
process-group reaper so a detached server can't outlive the CLI and hold
the port.

The DevRunner interface lives with its consumer (handlers/project/dev),
per the dependency-inversion convention. Command execution and server
spawning are injectable, so runner tests never start real uv or uvicorn;
process tests use real short-lived node processes because process
handling is the thing under test.

run.ts duplicates the CommandRunner shape from #1872 deliberately; fold
into src/io/exec.ts once that lands.
…to src/errors

All typed errors live in src/errors; the dev module was defining its own
inline.
@tejaskash
tejaskash force-pushed the feat/dev-server-core branch from fe79c87 to 356b555 Compare August 3, 2026 21:16
The exit event can fire before the shell-mode child's piped output is
drained on Windows, so tests saw exited resolve with zero log lines.
close waits for stdio to flush. The missing-binary test now asserts the
shared cross-platform contract: POSIX fails spawn outright while the
win32 shell exits non-zero with stderr output.
… once

Applies the full set of review findings on this PR:

- No shell: true. Windows argument boundaries were corrupted going
  through cmd.exe. Commands are now ProcessCommand records with
  extension-qualified executables (windowsExecutable), spawned directly.
- parseEntrypoint interprets an entrypoint exactly once. main.py:application
  was classified as TypeScript by the old endsWith check and launched
  under tsx watch.
- ProcessSupervisor owns all children with one CLI-exit reaper; Windows
  termination goes through taskkill /T for the whole tree.
- stop() is awaitable and exited resolves as a structured ProcessExit
  (exited/signaled/spawn-error) after stdio flushes.
- readline splits output lines, handling CRLF and chunk-split characters.
- Node installs detect pnpm/yarn/npm from the lockfile.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants