From c611630d4734ba4cd006912c2aee245ee3fbe2f6 Mon Sep 17 00:00:00 2001 From: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 Date: Fri, 31 Jul 2026 10:45:32 -0400 Subject: [PATCH] feat(desktop): show config diff on restart-required badge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a running managed agent's config drifts from what it was spawned with, the UI now surfaces the specific before/after diff — field names, old values, new values — rather than a bare "Restart required" badge. Rust (desktop/src-tauri): - New spawn_snapshot module: captures the effective config at spawn time as a structured snapshot (command, args, env, relay URL, system prompt, team instructions, session title, parallelism). The same structure feeds both the hash comparison (no behaviour change) and a field-level diff for the UI. - spawn_snapshot/diff.rs: produces RestartDiffEntry vec from two snapshots. Policy-driven masking: env keys on is_safe_to_reveal() allowlist (BUZZ_AGENT_THINKING_EFFORT, BUZZ_AGENT_PROVIDER, BUZZ_AGENT_MODEL, DATABRICKS_HOST/MODEL) render plain; all other env keys are masked (key name visible, value shows last-4 chars). Big values (system prompt, team instructions) are summarised as char counts. Secrets are never leaked. - Hoist is_safe_to_reveal() from commands/agent_config.rs to managed_agents/env_vars.rs as pub(crate) — single allowlist authority for both baked-env display and the diff masking policy. - ManagedAgentSummary gains restart_diff: Vec (empty when no drift or no stamp). Adopted PID-only agents have no stamp and always produce an empty diff — same invariant as the existing hash behaviour. - Adapter-availability drift (codex) continues to set needs_restart; diff vec stays empty for that case. - Tests: snapshot round-trips, diff field coverage, allowlisted / non-allowlisted masking, case-insensitivity, empty-key / dotted-key fail-closed, unstamped-agent invariant. TypeScript / UI: - New RestartDiffEntry / RestartChange / JsonValue types in restartDiff.ts; re-exported from tauri.ts and types.ts. - fromRawManagedAgent maps restart_diff → restartDiff (omission → []). - RestartDiffBadge: hover tooltip capped at 6 entries + "and N more"; asChild span trigger — never nested inside a