Skip to content

fix(frontseat-runner): GH-151 kill the whole process tree on cancellation - #242

Open
jbadeau wants to merge 1 commit into
mainfrom
fix/151-process-group-cancellation
Open

fix(frontseat-runner): GH-151 kill the whole process tree on cancellation#242
jbadeau wants to merge 1 commit into
mainfrom
fix/151-process-group-cancellation

Conversation

@jbadeau

@jbadeau jbadeau commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Fixes #151: cancelling a build could leave Maven wrapper subprocesses (and their JVMs) reparented to PID 1 for 20–30s, still mutating workspace state. Every local exec site killed only the sh -c wrapper on context cancellation.

  • New frontseat-runner/procgroup package extracts the localgrid's proven process-group pattern (Setpgid + group SIGKILL), adds a graceful Interrupt (group SIGTERM), and a Windows path via taskkill /T (previously the localgrid's Windows fallback killed only the direct child).
  • Applied at all three leaky sites: local task execution (internal/build), ship actions (internal/ship), and persistent tasks — where the Cancel override also restores the intended SIGTERM→5s→kill grace period that CommandContext's default immediate Process.Kill had been silently defeating.
  • The localgrid now uses the shared package (its private copies deleted).
  • Regression test reproduces the orphan: a grandchild of the sh wrapper must be dead after cancellation.

Verified: full workspace build, vet, affected module tests, and a Windows cross-compile.

🤖 Generated with Claude Code

…tion

Cancelling a build/ship left grandchildren (e.g. a Maven JVM under its
wrapper) reparented to PID 1 and still mutating workspace state: every
local exec site killed only the sh -c wrapper. Extract the localgrid's
process-group handling into a shared procgroup package and use it at all
local exec sites — build task execution, ship actions, and persistent
tasks (which get SIGTERM-to-group first, preserving their grace period
that CommandContext's default hard-kill had been defeating). Windows
kills the tree via taskkill /T.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.

daemon: cancelled builds leave child wrapper processes running

1 participant