Skip to content

v2.8.0 — Cold-Start Drain

Latest

Choose a tag to compare

@alexfrmn alexfrmn released this 08 Sep 16:03
87feb27

A message that arrived while nothing was listening is now delivered on the next session start.

The gap this closes

The per-session cursor shipped in 2.7.0 fixed a real defect: a shared cursor meant the first session to reach the Stop hook advanced it past the message, and every other live session — including the one actually holding the conversation — never saw it.

It also opened a new one. A brand-new session has no cursor, so the drain seeds its baseline at the current tip and stays quiet. Correct for a Stop hook, which must not replay history on every start — but it means anything delivered while no session was alive is skipped by that session and by every session after it. The message sits in the store, ACKed, and never surfaces.

Reported by @lichtpfad while running 2.7.0 on Windows, where the absence of any autostart makes that dark window routine rather than rare.

Added

--session cold-start drain for scripts/wake-drain-claude.mjs. A shared anchor — MURMUR_WAKE_ANCHOR, default ~/.murmur-wake-anchor — records how far the contour as a whole has been drained, deliberately not suffixed with the session key. --session reads it, reports what came in past it, and moves it forward:

{
  "hooks": {
    "SessionStart": [{ "hooks": [{ "type": "command", "command": "node --no-warnings /path/to/scripts/wake-drain-claude.mjs --session" }] }]
  }
}
  • Writes to stdout and exits 0 — a SessionStart hook feeds its stdout to the session as context, and exit 2 there means block, not wake.
  • No anchor on disk (fresh install, or an upgrade from a build without one) → adopt the tip and stay silent, rather than replaying the whole store.
  • Output capped at MURMUR_WAKE_SESSION_MAX (default 20); older messages are counted, not printed.
  • The anchor only ever moves forward, so a stale writer cannot make a delivered message look undelivered.
  • poll and --once advance it too, so a message a live session already saw is not replayed at the next cold start.
  • Node port only; wake-drain-claude.sh keeps poll and --once.

Upgrading

Nothing to do beyond registering the hook. The first --session run on a host without an anchor is silent by design and establishes the baseline; drains after that report the real backlog.

Verification

247/247 in a clean clone, build included. Five new cases cover the mode, including the regression itself — a fresh session with its own cursor still sees a message delivered while nothing was listening.

One defect in this release was found by hand, not by the suite: after a green run the hook was executed manually and reported 3667 backlogged messages on a host where no anchor should have existed. The pre-existing test helper isolated MURMUR_DB, the cursor and the lock, but could not know about an anchor that did not exist when it was written — so a full run had been writing the developer's real ~/.murmur-wake-anchor with rowids from a throwaway fixture. Fixed, and the suite now leaves $HOME untouched.