Files
buzz/crates/buzz-test-client
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7andWill Pfleger ad3230b480 fix(desktop): resume-pass corrections — Option A Mesh, versioned ready, captured scope, lock-aware compensation
Eight corrections from the resumed loop (fresh 3-pass budget, Option A ruling):

1. Option A Mesh: delete pre-prepare drain_mesh_client_if_stale and rollback
   restore_mesh_sharing (compensated a drain that no longer happens). Replace
   with fail_if_client_mesh_active preflight in both apply_workspace and
   identity import. Journaled Mesh recipe deferred as tracked follow-up.

2. Versioned _ready: scope_is_ready now reads marker content and compares
   against READY_MARKER_VERSION ("v1"); old unversioned markers return false
   and force re-run through run_pre_ready_family. Delete log-only post-ready
   best-effort guards (backfill + retention migration) from apply_workspace.
   Add test: old marker -> pipeline re-runs -> version advances.

3. Snapshot outbound phases use captured scope relay: both
   confirm_agent_snapshot_import (Phase 3b profile) and
   confirm_team_snapshot_import (Phases 4/5 profile + memory) now use
   captured_scope.relay_url instead of relay_ws_url_with_override.
   Add test proving outbound relay is captured-scope, not live-state.

4. Generation checks atomic with writes: global_agent_config Phase 1 validates
   scope generation inside the store lock before writing config; Phase 2
   (restart_local_agent_on_config_change) validates under lock before stop.
   collect_restart_candidates renamed to collect_restart_candidates_at with
   definitions_dir parameter. Mesh recovery helpers (persist_mesh_last_error_at,
   clear_mesh_last_error_if_set_at) take captured_scope and validate generation
   inside the store lock.

5. Lock-aware compensation gate: AtomicBool
   managed_agent_drain_compensation_in_progress added to AppState.
   compensate_drain sets it true (Release) before restarting entries, false
   after. start_pair loads it (Acquire) before taking the transition lock and
   returns Err if set. Closes the drop-then-compensate interleave window
   without recursive locking. Add deterministic partial-drain test.

6. Pre-scope migrations deleted: migrate_agent_keys_to_dev_service (AppHandle
   variant) removed from storage.rs. Pre-scope calls removed from
   run_boot_migrations_inner. Scoped variants in run_pre_ready_family are
   authoritative.

7. Degradation wired to UI: workspace-degraded Tauri event listener added to
   useNestNotifications.ts (toast.error with payload as description). False
   comment about emit_workspace_degradation removed from event_sync.rs.
   backfill_persona_snapshots_at (dead lock-taking wrapper) deleted.

8. e2e test docs: test_two_workspace_relay_partition comment corrected --
   Direction 3 asserts len==1 (B's event), not zero. Explicit note added that
   this test does not cover desktop workspaces or substitute for the live probe.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-08-03 15:40:22 -04:00
..