Files
buzz/desktop
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 cf23ad6943 fix(managed-agents): close apply_workspace Unready window and add RAII panic recovery
apply_workspace previously called mark_unready() then relied on
spawn_event_sync's inner claim_in_progress() CAS to reclaim InProgress
before migration and reconcile ran. The flush loop (alive since process
start) could win that CAS in the window between mark_unready() and the
spawn, certifying readiness against pre-migration, pre-reconcile DB state.
Two consequences: reconcile silently dropped (spawn_event_sync returns
early on failed CAS), and legacy migration rows published unarbitrated.

Fixes:

PRIMARY: apply_workspace now calls force_claim_in_progress() atomically
BEFORE migrate_legacy_retention_into. The claim (an RAII ReadinessClaim
guard) is held across the entire sequence: legacy migration -> reconcile
-> barrier -> mark_ready/Unready. spawn_event_sync_with_held_claim takes
the held claim instead of racing its own CAS. flush loop sees InProgress
throughout and cannot interleave.

SECONDARY: ReadinessClaim RAII guard replaces the manual mark_unready/
mark_ready calls at barrier entry/exit sites. On success, claim.resolve()
prevents the drop from resetting to Unready; on error or panic, the drop
resets to Unready automatically. A panic inside run_boot_barrier_for_scope
no longer leaves the latch permanently wedged at InProgress.

API changes:
- claim_in_progress() returns Option<ReadinessClaim> (was bool)
- force_claim_in_progress() added: preempting, any-state -> InProgress
- ReadinessClaim: RAII guard with resolve() explicit success path
- run_boot_barrier_after_claim() takes ReadinessClaim (transfers ownership)
- spawn_event_sync removed (dead code); spawn_event_sync_with_held_claim
  is now the sole spawn entry point

New test (f): apply_workspace window -- force_claim preempts any state;
flush claim between invalidation and reconcile is rejected; migrated and
reconciled rows gated by post-reconcile barrier cannot publish.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-08-01 14:09:31 -04: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