Skip to content

Report unreachable daemon discovery errors - #74

Merged
wesm merged 4 commits into
mainfrom
t3code/improve-sandbox-daemon-handling
Aug 24, 2026
Merged

Report unreachable daemon discovery errors#74
wesm merged 4 commits into
mainfrom
t3code/improve-sandbox-daemon-handling

Conversation

@mariusvniekerk

Copy link
Copy Markdown
Contributor

A sandboxed client can read a live daemon's runtime record while still being unable to reach its endpoint. Discovery previously collapsed that probe failure into absence, so Manager.Ensure could start a competing daemon against the same state.

PID-aware discovery now skips definite process-identity mismatches, keeps scanning after a failed probe, and returns a typed UnreachableError with the record, endpoint, and underlying probe failure when no later record succeeds. The manager already stops on discovery errors, so this prevents an unsafe start without adding restart policy to the shared package.

The repository hooks had a stale whole-repo lint, NilAway, Testify-helper, and Git-fixture baseline that blocked the daemon change. Most of the resulting test churn is mechanical helper conversion. The fixture changes isolate global and system Git config and strip repository-local variables inherited by hooks, which makes the shuffled suite deterministic under the real commit environment.

Sources of inspiration:

@roborev-ci

roborev-ci Bot commented Aug 22, 2026

Copy link
Copy Markdown

roborev: Combined Review (ad2da20)

Changes need revision: a probe race can incorrectly prevent daemon replacement.

Medium

  • daemon/probe.go:200 — Liveness is checked only before probing. If the recorded process exits during the probe, the failure remains classified as ErrDaemonUnreachable, causing Manager.Ensure to refuse to start a replacement even though the daemon is definitively absent. Recheck the PID and process identity after a probe failure; skip the record if the process exited or its identity no longer matches.

Reviewers: 2 done | Synthesis: codex, 10s | Total: 7m13s

@roborev-ci

roborev-ci Bot commented Aug 22, 2026

Copy link
Copy Markdown

roborev: Combined Review (3d27ab2)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 9m55s

mariusvniekerk and others added 3 commits August 22, 2026 10:35
A sandbox can read a live daemon's runtime record while denying access to its endpoint. Treating that failed probe as absence lets an ensure operation start a competing daemon against the same state.

Keep scanning for another reachable record, but return the first live-record probe failure when none succeeds. Callers can now distinguish definite absence from indeterminate endpoint access and avoid unsafe restart behavior.

The repository hooks also had a stale analyzer and test-helper baseline that blocked this change. Bring the existing Go code and Git fixtures under the current lint, NilAway, isolation, and shuffled-test rules so the hooks can enforce those rules on later changes.

Generated with OpenAI Codex
Co-authored-by: OpenAI Codex <noreply@openai.com>
PID-aware discovery uses one broad error for any live candidate it cannot safely select, not only socket permission failures. State the opt-in boundary and wrapped-cause contract so callers do not promise default protection or show the wrong recovery guidance.

Pin the two compatibility edges that carry the most risk: a definite process-identity mismatch must never reach the recorded endpoint, while callers that leave PID checks disabled retain the earlier absence behavior.

Generated with OpenAI Codex
Co-authored-by: OpenAI Codex <noreply@openai.com>
Git exports repository-local variables to pre-commit hooks, and developer configuration can add hooks of its own. Fixtures that inherit either source can test the caller's repository instead of the temporary repository they create.

Strip repository bindings and give fixture commands empty global, system, and XDG configuration sources. Tests that need specific Git configuration now add it on top of that isolated base.

Generated with OpenAI Codex
Co-authored-by: OpenAI Codex <noreply@openai.com>
@mariusvniekerk
mariusvniekerk force-pushed the t3code/improve-sandbox-daemon-handling branch from 3d27ab2 to 5e15444 Compare August 22, 2026 14:48
@roborev-ci

roborev-ci Bot commented Aug 22, 2026

Copy link
Copy Markdown

roborev: Combined Review (5e15444)

Code review passed: no Medium, High, or Critical findings.


Reviewers: 2 done | Synthesis: codex, 5s | Total: 6m1s

@wesm wesm self-assigned this Aug 24, 2026
Three merge-request import tests set NullGlobalConfig=false and put
their own GIT_CONFIG_GLOBAL into the runner environment. gitcmd.New()
also sets StripEnv, which removes every GIT_* variable from that
environment, so the override never reached git. Git then read the
developer's real ~/.gitconfig. On a machine whose global config
defines hook.* entries, the untrusted-import hook scan saw them and
the tests failed; in CI they passed, but the rollback test's
fsmonitor and filter configuration never loaded, so its assertions
could not fail.

Disable StripEnv at those three sites. Their environments already
come from isolatedLifecycleBaseEnv, so the override now reaches git
and the suite passes under a real developer Git configuration.

Generated with Claude Code (claude-fable-5)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@roborev-ci

roborev-ci Bot commented Aug 24, 2026

Copy link
Copy Markdown

roborev: Combined Review (fd3d42a)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 5m47s

@wesm
wesm merged commit f2a2c93 into main Aug 24, 2026
10 checks passed
@wesm
wesm deleted the t3code/improve-sandbox-daemon-handling branch August 24, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants