Skip to content

Keep the spacedock launcher resident — spawn the host instead of exec'ing away#442

Merged
clkao merged 2 commits into
mainfrom
spacedock-ensign/launcher-resident-process
Jun 30, 2026
Merged

Keep the spacedock launcher resident — spawn the host instead of exec'ing away#442
clkao merged 2 commits into
mainfrom
spacedock-ensign/launcher-resident-process

Conversation

@clkao

@clkao clkao commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

The launcher now stays resident as the host's parent instead of exec'ing away — keeping spacedock <host> legible in process listings and enabling future sidecars.

What changed

  • Replace syscall.Exec with a resident-parent spawn-wait sharing the terminal's foreground process group.
  • Forward externally-targeted signals (SIGTERM/SIGHUP); let terminal signals (Ctrl-C, resize) reach the host directly.
  • Return the host's exit code via a (int, error) Launch signature, threaded through all three hosts.
  • Scope the signal model to unix; keep Windows compiling (no behavior claim).

Evidence

  • AC suite green: resident-parent 2/2, exit-code propagation 6/6 (incl. signal-death), PTY terminal-signals 3/3; GOOS=windows build+vet pass.
  • Detached adversarial signal-matrix audit: 3 mutation-confirmed probes, no code defect.

vv

execHost.Launch now spawns the host as a child (exec.Command+Wait), inherits
the terminal, and propagates the host's exit code, so spacedock stays the host's
parent in the process tree (legible session managers; future sidecar supervision)
instead of replacing itself via syscall.Exec.

Shared-foreground-group model (no Setpgid): the host owns the controlling TTY and
the kernel delivers terminal signals to it directly. The launcher absorbs
SIGINT/SIGQUIT (stays resident; the host got its own copy from the foreground
group), forwards pid-targeted SIGTERM/SIGHUP, and leaves SIGTSTP/SIGCONT/SIGWINCH
at default. Exit code is ProcessState.ExitCode() refined to 128+signum on unix
signal death. hostOps/piRuntimeOps Launch changes error -> (int, error) at every
implementor and call site (including the fakePiRuntimeOps test fake). The signal
model + exit mapping live in a //go:build unix helper with a //go:build !unix
no-op so GOOS=windows still builds (unix launch lane only; no Windows claim).

AC tests (re-exec helper-process harness): AC-1 resident parent vs the
syscall.Exec baseline, AC-2 exit-code propagation incl. genuine signal death, and
AC-3 PTY-backed terminal-signal delivery via github.com/creack/pty (test-only).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
clkao added a commit that referenced this pull request Jun 30, 2026
The SIGWINCH resize subtest timed out on the Linux CI runner while passing on
macOS: it grepped the stub log for "SIGNAL window size changes", but
syscall.Signal.String() renders SIGWINCH as "window changed" on Linux (and
"window size changes" only on darwin/BSD). The signal WAS delivered — the matcher
was platform-specific, not a timing race.

Stop matching on syscall.Signal.String(): the stub now logs a fixed token per
signal (SIGNAL SIGINT/SIGTERM/SIGHUP/SIGWINCH), and SIGWINCH re-reads and logs the
new window size so the assertion pins the resize-triggered signal (40x120), not an
incidental one. All three PTY subtests hardened consistently. waitForLog budget
raised to 10s (well under the stub's 30s self-exit) for loaded-CI headroom. The
launcher signal model is untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@clkao
clkao temporarily deployed to CI-E2E-CODEX June 30, 2026 01:09 — with GitHub Actions Inactive
@clkao
clkao merged commit 55039e7 into main Jun 30, 2026
12 of 13 checks passed
gcko added a commit that referenced this pull request Jun 30, 2026
Brings the seam PR up to latest main (0.23.0): the skill<->binary contract
bump 1->2 (#443), the resident launcher (#442), the signal-forward pump fix
(#444), and the entity end-value gate (#441).

Conflict: .claude-plugin/plugin.json — kept this branch's `hooks` key and
adopted main's `version: 0.23.0` + `requires-contract: >=2,<3` (CONTRACT_VERSION
is now 2). shared-core.md auto-merged (disjoint regions).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Jared Scott <jared.scott@infuseai.io>
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.

1 participant