Skip to content

humd: autoupdate outlives the humd it restarts, and the thrum probe stops saying hello - #111

Merged
adiled merged 2 commits into
mainfrom
autoupdate-outlives-humd
Nov 22, 2026
Merged

adiled merged 2 commits into
mainfrom
autoupdate-outlives-humd

Conversation

@adiled

@adiled adiled commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Two bugs that leave a humd looking down when it isn't, or down when it should be up.

Autoupdate left humd stopped. When autoupdate_check_once found a newer release, it ran the installer as humd's own child, in humd's process group. The installer's launchctl bootout gui/$uid/humd kills the job's whole process group, so it killed the installer too, before the installer reached launchctl bootstrap. humd stayed down until someone reinstalled by hand, every bee lost its kernel, and hum doctor showed the thrum socket refusing connections. The installer now leads its own process group (installer_outliving_humd, process_group(0)), so the bootout spares it.

  • On Linux, systemd stops the unit's whole cgroup whatever the process group. But systemctl --user restart is one job that systemd finishes even after the installer is killed, so humd already came back there. Only the installer's last log lines are lost.

The thrum probe logged a false ERROR. hum doctor (probe_thrum) and humctl health sent {"chi":"hello","sid":…} with no protoVersion. humd refused it and logged thrum.hello.proto-missing at ERROR on every run, and the probe still printed ✓ live. Adding protoVersion would not fix it:

  • humd would then refuse the hello at the hive check, which also logs at ERROR (thrum.hello.hive-unrecognised).
  • A hello that passed every check would nestle the probe as a bee and announce it to the ensemble.

humd breathes to every connection before any hello (thrumd/conn.rs), and that breath was the reply the probe was already reading. So the probe now connects, sends nothing, and waits up to 1s for the breath. humd is unchanged.

  • The socket test a_connection_is_heard_only_once_its_hello_is_admitted already requires that breath, which is the contract the probe now leans on.

Verified.

  • the_installer_leads_its_own_process_group_so_a_bootout_of_humd_spares_it runs the installer's command and checks that its pid is its own pgid.
  • The humd socket tests pass (3 of 3), and tools/speech.py passes.
  • On a live humd v0.35.2, the new hum doctor and humctl health both said ✓ live. humd logged only thrum.connected and thrum.disconnected for each, with no hello and no ERROR.
  • A real autoupdate was not run end to end.

humd ran the installer as its own child, in its own process group. The installer's `launchctl bootout gui/$uid/humd` killed that whole group, installer included, so it never reached `launchctl bootstrap` and humd stayed down until someone reinstalled by hand. The installer now leads its own process group, so the bootout spares it. On Linux, systemd stops the unit's whole cgroup either way, but `systemctl --user restart` is a single job, so humd came back there already.
…aying hello

`hum doctor` and `humctl health` sent a bare hello, which humd refused and logged at ERROR (`thrum.hello.proto-missing`). Adding protoVersion would only move the refusal to the hive check, which also logs at ERROR, and a hello that passed every check would nestle the probe as a bee. humd already breathes to every connection before any hello, and that breath was the reply the probe read. The probe now connects and waits for it, sending nothing.
@adiled
adiled merged commit 7364bc2 into main Nov 22, 2026
7 checks passed
@adiled
adiled deleted the autoupdate-outlives-humd branch November 22, 2026 08:07
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