Files
buzz/desktop
Matt Toohey 5189c468e1 fix(desktop): fence each mention wake by identity, not plan key
A cancelled wake could resurrect itself and start a local agent a full
second early. The preflight fenced its timer continuation with
activePlanKeyRef, a string, and expressed cancellation by nulling it. But
plan keys are deliberately reusable -- the same relay, signer, channel,
and agent set produce the same string, which is exactly what makes the
"same plan, don't re-arm" early return work. Reusing the key as a
lifetime fence conflated the same intent with the same window, so a key
that legitimately came back made a dead continuation look live.

The sequence: an arming's hold matures and its getManagedAgentsByPubkey
lookup suspends; the draft trims to a bare mention, so the
substantive-text gate lapses and cancellation nulls the key; the draft
regains substantive text and re-arms an identical key for a fresh second;
the lookup resolves, both post-await checks compare equal strings, and
the dead arming starts the agent roughly a second early. Mention
removal/re-add and channel navigation away and back are the same shape.
Both the documented guarantee on MENTION_WAKE_GATE_HOLD_MS and the
checked-in gate-lapse contract say this cannot happen.

Give each arming an object identity and fence on that. armedRef holds the
live ArmedWake; the continuation compares by reference, which cannot ABA
by construction. The two comparison styles against that ref are now
deliberate and commented: identity asks "is this arming still the live
one", value asks "is the live window already for this plan" -- the latter
must stay a key comparison, since it is what lets continued typing extend
the hold rather than restart it. The beforeLookup/beforeWake plan checks
stay too; they answer the separate question of whether the live draft
still satisfies the gates.

Three regression tests suspend the managed-agent lookup mid-flight and
cover each cancellation path back to an identical key: the substantive-
text gate, the "@"-free short-circuit, and channel navigation. Each
asserts zero starts on resolve and then one start after a fresh hold, so
they pin a fence rather than a mute. Mutating the identity check back to
key equality fails exactly those three and no others.

Behavior is otherwise unchanged: 12/12 unit tests and all 73 mentions E2E
specs pass, including the wake-before-send journey.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
2026-08-27 14:47:21 +10:00
..
…

Buzz

Desktop chat shell with:

  • Tauri + React + TypeScript + Vite
  • Tailwind CSS
  • shadcn/ui-ready shared components
  • Biome (lint/format/check)
  • Feature-driven frontend structure

Scripts

  • pnpm dev - run the web frontend
  • pnpm tauri dev - run the desktop app
  • pnpm build - typecheck and build frontend
  • pnpm typecheck - TypeScript checks
  • pnpm lint - Biome lint
  • pnpm format - Biome format (write)
  • pnpm check - Biome check

Structure

  • src/shared - reusable app-wide code (ui, lib, styles)
  • src/features - feature modules (vertical slices)
  • src/app - top-level app composition