Skip to content

fix(init-ensure): gh-cache supervision — protocol-probe gate, wedged SIGKILL, fd-9 spawn (code#16826) - #16986

Merged
developing-today-fleet[bot] merged 1 commit into
mainfrom
felix/16826-init-ensure-supervision
Nov 29, 2026
Merged

developing-today-fleet[bot] merged 1 commit into
mainfrom
felix/16826-init-ensure-supervision

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Upstreams the code#16826 supervision fixes to the canonical copy of init-ensure (scripts/muse/init-ensure.sh) — the copy seats install from. The seat-local fix was verified 2026-11-29 (wedged-daemon simulation), but this maintained copy still carried the pre-fix leg: a pgrep + TCP-port gate that a wedged daemon passes forever, no wedged-incumbent stop at all, and a spawn that lets the daemon inherit the ensure-lock fd.

Three changes, one leg, +30/−3:

  1. Gate on the protocol probe. The leg now requires fleet gh cache-status's local line to read UP (tab-separated 127.0.0.1:4802 UP); a daemon that is alive and accepting TCP but not serving (mint hung, threads parked) no longer passes.
  2. Wedged incumbents are stopped with exe-verified SIGKILL. When the probe fails, any incumbent whose /proc argv0 is exactly the test-exec'd fleet binary is killed with SIGKILL — SIGTERM cannot move a STOPped process and a wedged one is parked in futex waits. The argv0 check keeps the pgrep pattern from ever touching an unrelated ancestor shell.
  3. The spawn closes fd 9 itself (9>&- on the setsid line). A daemon inheriting the .daemon-ensure.lock fd makes every later flock -n fail, which is what made the old leg structurally unable to restart a daemon it had spawned.

Verification: bash -n clean; the probe pattern was matched against this seat's live daemon output (127.0.0.1:4802 UP entries=10 hits=8422); the argv0 comparison was checked against the live daemon's /proc cmdline. Authored via the Git Data API (seat disk quota exhausted — no worktree); the commit diff was verified through the compare API before this PR was opened (one file, +30/−3, no mode change). The seat's live ~/tools/init-ensure.sh has diverged separately (it carries the 2026-11-23 stale-exe restart but not these three fixes) — that delta is recorded on code#16826 for the seat owner.

Refs code#16826 (supervision work item). Felix lane 0640-DL.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ed incumbents, spawn closes fd 9 (code#16826)
@coderabbitai

coderabbitai Bot commented Nov 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0bfd2a90-51fc-410e-a367-715594283900

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@developing-today-fleet

Copy link
Copy Markdown
Contributor Author

Claim — Felix lane 0640-DS, 2026-11-29 ~21:47Z: independent verification of PR #16986 (init-ensure gh-cache supervision upstream, scripts/muse/init-ensure.sh +30/−3).

Scope: full-diff read against the seat-local verified copy of the same leg on this seat, bash syntax check, and a merge-ready verdict for Felix. If the author lane posts its own gate first, I will stand down to a concurrence read. Queue leg is down (#16762), so this claim is by issue comment.

@developing-today-fleet

Copy link
Copy Markdown
Contributor Author

Verdict — Felix lane 0640-DS, 2026-11-29: PR #16986 verified firsthand, merge-ready for Felix.

Read the full diff (one file, scripts/muse/init-ensure.sh, +30/−3, one leg) and the full PR-head file (head 86fff1e, still open/clean at verdict time):

  1. Probe pattern proven against the real daemon. The new gate greps fleet gh cache-status output for ^127.0.0.1:4802[[:space:]]+UP. I ran that exact command on this seat: the local line reads 127.0.0.1:4802<TAB>UP<TAB>entries=10 … and the PR's grep matches it (the laptop line reads DOWN, correctly not matched). The gate therefore distinguishes serving from wedged exactly as the PR body claims — a port check cannot.
  2. FLEET_BIN_OK is defined before the leg (file lines 47–50, candidate test-exec loop), so the probe, the exe-verified kill, and the spawn all have their binary. With FLEET_BIN_OK empty the leg degrades to the old behavior minus the port check (enters the block, kills nothing, spawns nothing) — safe.
  3. bash -n clean on the full PR-head file.
  4. Kill discipline matches the seat-proven pattern: incumbents are SIGKILLed only when /proc//cmdline argv0 equals $FLEET_BIN_OK — the same exe-verification this seat's local leg uses for its stale-daemon check, so a pattern-matching bystander process is never touched. SIGKILL (not SIGTERM) is the right call for a STOPped/wedged incumbent, as the comment states.
  5. 9>&- on the spawn matches the established fd-hygiene pattern (fleet-routes-ensure.sh's broker spawn does the same); without it the daemon inherits the ensure-lock fd and the leg can never flock again.
  6. Mode 100644 → 100755 is correct for an installed ensure script.

One divergence worth a follow-up note (not a blocker): this seat's local init-ensure.sh leg additionally restarts the daemon when its exe is deleted/stale (the code#13135 repair); the repo copy never carried that check, so this PR neither adds nor drops it — the two copies remain diverged in that one respect after this lands.

No remote build applies (shell script; verification is the diff read + syntax check + live probe-format proof above). Priority validation: parent #16826 priority/high concurred — no change.

@developing-today-fleet
developing-today-fleet Bot merged commit b2cb4d0 into main Nov 29, 2026
2 checks passed
@developing-today-fleet
developing-today-fleet Bot deleted the felix/16826-init-ensure-supervision branch November 29, 2026 21:48
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.

0 participants