Skip to content

fix(hub): the hub's last lines reach the pool, and a hung hub is logged - #506

Merged
7schmiede merged 1 commit into
mainfrom
fix/hub-exit-telemetry
Nov 10, 2026
Merged

7schmiede merged 1 commit into
mainfrom
fix/hub-exit-telemetry

Conversation

@7schmiede

Copy link
Copy Markdown
Member

What and why

Checking #398 against 30 days of pool telemetry found no hung hub since the watchdog came (0.34.0), but also showed that the telemetry could not have shown one:

  • The hub's last lines never left. It ended itself with std::process::exit right after its last line (hub_stop before an update, hub_stuck from the watchdog), before the minute's telemetry was sent. One member's hub_stop appears once in the pool against 66 times in its own hub.log. The hub now flushes first (exit::exit, as the daemon already does at daemon_stop), and a test keeps every exit of the hub on that path.
  • hub_hung went nowhere. It came from the start that ended the hung hub (ensure_running in the CLI or the MCP server), which keeps no log, so diag::warn dropped it. That start now leaves hub-hung.json, and the hub it starts logs hub_hung from it.
Point
Cause A line written just before the process ends, or in a process without a log, is dropped silently.
Bug class lost-last-words
Proof Both tests written first and red: the source test found lib.rs (shutdown) and watchdog.rs; the note test did not compile without note_hung/take_hung. Green after the fix.
Siblings Daemon: no process::exit, already flushes at daemon_stop. Node: its Windows restart ends the process without a line just before it, and on Unix it execs; left as is. Test helpers (stdio.rs fake server) are exempt.
Guard exit::tests::the_hub_ends_itself_only_through_exit

Not seen in the stack: a hung hub cannot be made on demand; after the release the pool's telemetry should show hub_stop beside each update.

Refs #398

🤖 Generated with Claude Code

The hub ended itself with `std::process::exit` right after its last line
(`hub_stop` before an update, `hub_stuck` from the watchdog), before the
minute's telemetry was sent: a member's hub_stop appeared once in 30 days
of pool telemetry against 66 in its own log. It now flushes first, through
`exit::exit`, and a test keeps every exit of the hub on that path.

The `hub_hung` line came from the start that ended the hung hub (the CLI,
the MCP server), which keeps no log, so it was dropped. That start now
leaves a note, and the hub it starts logs it.

Refs #398

Bug-Class: lost-last-words
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede merged commit 16ac96c into main Nov 10, 2026
@7schmiede
7schmiede deleted the fix/hub-exit-telemetry branch November 10, 2026 17:05
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