gunk-dev/the-valley
the-valley:ida-14d2a61ideagraduated

Controllers wake on the refs they read, not on timers

State
done
Created
2026-10-27 by contributor
Graduated into
qn-53c2cd3

Body

Operator direction, 2026-10-27: the growing number of timers and polling loops is not where the system should end up.

The host polls in several places:
- the integrator: a poll loop, every 15 seconds by default (`integrator.interval`);
- the check worker: a timer, one minute after each pass ends, plus its failure waits;
- the identity compiler: a timer, every 5 minutes;
- the web publisher: a timer, 5 minutes after each pass ends;
- the restacker (in review, oc-fb88d3a): its own poll loop.

The nightly backup is calendar work and belongs on a timer.

The event pieces exist. Post-receive projects each ref update onto the bus as `ref-updated`, and each publish queue's drain is a path unit that inotify wakes when post-receive or the integrator queues a move. Nothing consumes the bus, because it is unauthenticated (bd-d853d9c), so the controllers poll.

Direction: a controller is woken by updates to the refs it reads. It stays level-triggered over durable refs, so a wakeup carries no authority and a lost one costs only what one slow resync, or a restart, recovers. On one host, post-receive can wake units locally, as it wakes the drain, with no bus authentication. Across machines, an authenticated bus subscription wakes them. A retry after a real failure also waits for an event, such as a new head, new policy or a new tree, instead of a clock.

Open questions:
- Is any periodic resync kept, and how slow can it be?
- Which refs wake which controller?
- How is a check worker on another machine woken?

Comments

  1. contributor2026-11-08 22:30 UTC
    Graduated into qn-53c2cd3, which develops it; the worker and integrator wake on the refs they read (oc-29d5091, oc-9daa661).
  2. contributor2026-11-16 02:04 UTC
    A use for an authoritative event log, from the approvals gate (2026-11-16): ordering events across repositories. The gate must not land a change on a key list older than the registry, but "a landing after a key change" has no defined order when the landing is in one repository and the registry change in another; today the gate compares commits as late as it can and accepts the instant in between. One total order of landings across an instance's repositories would close it without cross-repository locks.