Skip to content

fix(hub,guard): eliminate GET / hostname spawns, sleep hangs, and unreaped children - #1619

Merged
i2cjak merged 1 commit into
mainfrom
fix/1607-hub-hang-reap
Nov 22, 2026
Merged

i2cjak merged 1 commit into
mainfrom
fix/1607-hub-hang-reap

Conversation

@i2cjak

@i2cjak i2cjak commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1607

  • Replace per-request hostname subprocess spawning in net::botnet::name() (hit on every GET / and GET /pair) with in-process plat::hub::hostname() using libc::gethostname on Unix and GetComputerNameExW on Windows.
  • Provide a suspend-excluding awake_s() clock on both Unix (Instant) and Windows (QueryUnbiasedInterruptTime), and switch native/host/src/guard.rs (mono_s()) and native/guard/src/{plan,run,sys}.rs (SleepClock, SLEEP_JUMP_S, WAKE_GRACE_S, startup stall and boot deadlines) to use it so standby/sleep wakeups never mark writer, model, agents, or hub boot as hung.
  • Require a healthy (well) health probe in plan::proven() before marking a build stable or promoting an update off probation, preventing a failing build from being promoted during wake grace.
  • Harden proc.rs's non_test_code scanner against forward #[cfg(test)] mod ...; declarations, #[cfg(not(test))] / #[cfg(all(not(test), ...))] blocks, intervening attributes, and next-line braces; route agents/mod.rs remake_folder git spawn through proc::tokio_cmd(Kind::Local, "git") with !crate::copy::on(); kill and reap push/apns.rs pipe_and_wait children on stdin write failure; bounded-wait on child.wait() after start_kill() across all accounts_io.rs claude_read exit paths; add .kill_on_drop(true) to timed-out probe commands (net/{botnet,listener,tailnet}.rs, commands/clone/mod.rs, settings/tools_install.rs); and name/RAII-reap the --agent-reaper waiter thread (agent-reaper-wait).
  • Add and strengthen regression tests in guard.rs (WATCHED timestamp assertion), net/botnet.rs, wire/tests.rs (concurrent 20-probe burst), proc.rs, push/apns.rs, tests/inherited_signals.rs, and native/guard/src/plan.rs.
  • Migrate two pre-existing std::env::temp_dir().join(...) test directories in native/host/src/data/ext.rs and native/host/src/plan/mod.rs to crate::plat::tmp::dir(...) so native/guard's drop-guard check is green.

…eaped children

Fixes #1607

- Replace per-request `hostname` subprocess spawning in `net::botnet::name()` (hit on every `GET /` and `GET /pair`) with in-process `plat::hub::hostname()` using `libc::gethostname` on Unix and `GetComputerNameExW` on Windows.
- Provide a suspend-excluding `awake_s()` clock on both Unix (`Instant`) and Windows (`QueryUnbiasedInterruptTime`), and switch `native/host/src/guard.rs` (`mono_s()`) and `native/guard/src/{plan,run,sys}.rs` (`SleepClock`, `SLEEP_JUMP_S`, `WAKE_GRACE_S`, startup stall and boot deadlines) to use it so standby/sleep wakeups never mark `writer`, `model`, `agents`, or hub boot as hung.
- Require a healthy (`well`) health probe in `plan::proven()` before marking a build stable or promoting an update off probation, preventing a failing build from being promoted during wake grace.
- Harden `proc.rs`'s `non_test_code` scanner against forward `#[cfg(test)] mod ...;` declarations, `#[cfg(not(test))]` / `#[cfg(all(not(test), ...))]` blocks, intervening attributes, and next-line braces; route `agents/mod.rs` `remake_folder` git spawn through `proc::tokio_cmd(Kind::Local, "git")` with `!crate::copy::on()`; kill and reap `push/apns.rs` `pipe_and_wait` children on stdin write failure; bounded-wait on `child.wait()` after `start_kill()` across all `accounts_io.rs` `claude_read` exit paths; add `.kill_on_drop(true)` to timed-out probe commands (`net/{botnet,listener,tailnet}.rs`, `commands/clone/mod.rs`, `settings/tools_install.rs`); and name/RAII-reap the `--agent-reaper` waiter thread (`agent-reaper-wait`).
- Add and strengthen regression tests in `guard.rs` (`WATCHED` timestamp assertion), `net/botnet.rs`, `wire/tests.rs` (concurrent 20-probe burst), `proc.rs`, `push/apns.rs`, `tests/inherited_signals.rs`, and `native/guard/src/plan.rs`.
- Migrate two pre-existing `std::env::temp_dir().join(...)` test directories in `native/host/src/data/ext.rs` and `native/host/src/plan/mod.rs` to `crate::plat::tmp::dir(...)` so `native/guard`'s drop-guard check is green.
@i2cjak
i2cjak merged commit 47c492c into main Nov 22, 2026
3 checks passed
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.

macOS v0.16.4: hub stops answering (16 of 20 probes time out), guard reports writer/model/agents hung, unreaped children accumulate

1 participant