Files
buzz/desktop/src-tauri
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7andWill Pfleger 00a3381902 feat(desktop): implement Phase 3 runtime ownership + Mesh scope rules
Phase 3 of workspace-scoped agent store:

3a: reconcile_managed_agent_runtimes loses its `communities` parameter.
    The backend derives the sole target relay from the captured active scope;
    cross-scope fan-out is no longer representable at the API level.
    - runtime_commands.rs: capture active scope relay; remove communities Vec
    - runtime_types.rs: remove ManagedAgentCommunityTarget struct
    - tauriManagedAgents.ts: reconcileManagedAgentRuntimes() takes no args
    - managedAgentRuntimeHooks.ts: bootstrapManagedAgentRuntimePairs calls
      parameterless reconcile; drop communities list construction
    - useManagedAgentRuntimeReconciliation.ts: rewritten to track a single
      activeCommunityKey instead of per-relay state; simplified retry logic
    - AppShell.tsx: pass `${activeCommunity?.id}-${reinitKey}` as the key

3b: Mesh relay-match reuse rule + fail-closed serve preflight + watchdog.
    - mesh_llm.rs: ensure_relay_mesh_for_record captures scope relay at entry;
      a live runtime is only reused when its relay matches the scope relay;
      serve-mode mismatch fails closed with a precise 'Share Compute is
      currently pinned to <relay>' error; client-mode mismatch falls through
      to re-arm; drain_mesh_client_if_stale drains a client whose relay
      differs from the incoming workspace relay (Layer-1 async, non-fatal).
    - recovery.rs: rearm_relay_mesh_for_running_agents captures one scope per
      pass; Live early-return only taken on relay match; serve-mode Live
      mismatch skips the pass (machine-level pinning).
    - personas.rs: add scoped load_personas_at / save_personas_at variants.

3c: Drain journal + compensation + apply_workspace rewrite.
    - runtime_commands.rs: DrainJournalEntry struct, drain_scope_runtimes
      (snapshot journal + stop all live runtimes, returns stopped/remaining/
      first_error), compensate_drain (restart exactly the stopped entries).
    - workspace.rs: apply_workspace return type changed from () to
      WorkspaceApplyResult. Layer-1 async drains the Mesh client before
      spawn_blocking. Drain stage acquires managed_agent_runtime_transition,
      calls drain_scope_runtimes; on failure calls compensate_drain and
      returns applied:false. Per-transition restore replaces the launch-only
      managed_agent_restore_pending one-shot. Post-commit failures (event
      sync, restore) surface as degraded entries on WorkspaceApplyResult.

3d: Scope-tagged runtime map entries.
    - runtime_types.rs: ManagedAgentPairRuntime gains scope_id: Option<String>
    - starting() constructor takes scope_id; captured from active scope at
      spawn time in runtime_commands.rs, restore.rs, and runtime.rs.
Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-08-03 00:05:02 -04:00
..