Skip to content

Manage idle localhost servers and their process trees - #200

Open
yxlyx wants to merge 1 commit into
mainfrom
feat/199-idle-localhost-lifecycle
Open

Manage idle localhost servers and their process trees#200
yxlyx wants to merge 1 commit into
mainfrom
feat/199-idle-localhost-lifecycle

Conversation

@yxlyx

@yxlyx yxlyx commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • automatically move simple recognized localhost/dev-server commands (npm run dev, pnpm preview, next start, vite, python -m http.server, etc.) into supervised background jobs
  • pause managed servers after 30 minutes of inactivity and stop them after 2 hours, with global environment overrides and a per-job keep_alive pin
  • add bash_resume plus managed/paused/pinned/idle-stopped visibility in /jobs
  • launch shell tools in their own POSIX process groups, so cancellation, timeout, bash_kill, idle stop, and session exit terminate npm/node/XCTest-style descendant trees rather than only /bin/sh
  • document the lifecycle and configuration

Idle activity is deliberately local to the managed job: new stdout/stderr or an explicit bash_output/bash_resume call. Codegraff does not scan or interfere with unrelated localhost listeners.

Defaults can be configured with:

GRAFF_SERVER_PAUSE_MINUTES=15 GRAFF_SERVER_STOP_MINUTES=60 graff
GRAFF_SERVER_IDLE=off graff

Tests

  • zig fmt --check on all changed Zig files
  • zig build test (includes command-recognition/lifecycle tests and a process-group cleanup integration test)
  • zig build -Doptimize=ReleaseFast
  • cross-build: zig build -Dtarget=x86_64-linux -Doptimize=ReleaseFast
  • cross-build: zig build -Dtarget=x86_64-windows -Doptimize=ReleaseFast
  • generated graff --schema parses as JSON and includes bash_resume

Closes #199.
Related to #198.

Automatically supervise recognized development servers, pause and stop them after configurable inactivity, expose resume and keep-alive controls, and terminate POSIX process trees instead of leaving descendants behind.

Closes #199
Related to #198

Co-Authored-By: Codegraff <blackfloofie@codegraff.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-pause and stop Codegraff-started localhost servers after inactivity

1 participant