fix(observer,create): pid-robust observer stop (#45) + loud/strict create failures#47
Merged
Merged
Conversation
…ailures #45: observer stop/status trusted observer.pid exclusively, so a stale or wrong pid (spawn race / out-of-band daemon) made stop report 'not running' and orphan a live daemon. The _run-daemon loop now writes its own pid on startup, and stop/status fall back to discovering a live 'observer _run-daemon --root <root>' via the process table (parseDaemonPID, unit-tested). create: a failed worktree-add or post_create hook was logged but create still exited 0, so a half-built env looked fully successful. materializeRepositories + runPostCreateHooks now return the failures; create prints a prominent final WARNING (still emitting the worktree path for the cd contract) and --strict makes any failure a non-zero exit for CI.
This was referenced Jun 29, 2026
This was referenced Jul 16, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two dogfood-hardening fixes for the worktree/observer surfaces.
observer stop/statuspid robustness (#45). Both trusted<project>/observer.pidexclusively, so a stale or wrong pid (a spawn race, or a daemon launched out-of-band) madestopreport "not running" and orphan a live daemon that kept ticking. The_run-daemonloop now writes its OWN pid on startup (the authoritative record), andstop/statusfall back to discovering a liveobserver _run-daemon --root <root>process via the process table when the pid file is stale or missing. Found by dogfooding: a leftover daemon (pid 49920) survivedobserver stopbecause the pid file held a dead pid (85654).bough createsurfaces post-setup failures (and gains--strict). A failedgit worktree addfor one repo, or a failedpost_createhook (e.g. a migration), was logged mid-stream but create still exited 0 — so a WorktreeCreate hook looked fully successful when the environment was half-built. create now prints a prominent final WARNING summarising every failure (the worktree path is still emitted so Claude Code can cd in), and--strictturns any such failure into a non-zero exit for CI / scripted callers. Default stays best-effort to preserve the hook's cd contract.Closes #45
Test plan
go test ./internal/cli/...green — newinternal/cli/observer_daemon_test.go(TestParseDaemonPID: right-root match, skip-self, skip-dead, prefix-collision guard).golangci-lint run ./internal/cli/...→ 0 issues.--rootcommand-line fallback.