Files
buzz/desktop/src-tauri
Duncan 6184291e41 fix(desktop): address Thufir r2 — fail-closed tiers, GC lock, dev marker, cleanup gate
F1 CRITICAL: Remove all eager old-generation deletion from secret_seam.rs and
global_config/mod.rs. Old-gen retirement moves entirely to two-cycle GC.
Add 5 deterministic JSON-write-failure tests proving old generation still
hydrates after a failed atomic write (instance env/auth/provider, definition
env, global env).

F5b (collect_live_refs validates): Reject malformed/duplicate coordinates and
inline+ref conflicts — any such condition makes the sweep a no-op. Add 12
validation tests.

F5a (GC exclusion, not just time): Wrap extraction + global save + GC under
managed_agents_store_lock so final JSON read and remove_batch are indivisible
against a concurrent save. Add 3 synchronized interleaving tests.

F3 (fail-closed global + definition tiers):
- Global: load_global_agent_config() returns Err on missing/corrupt ref;
  callers in runtime.rs/runtime_commands.rs now surface global_unavailable
  flag instead of unwrap_or_default(); spawn_agent_child uses ? to abort.
- Definition: AgentDefinition gains secrets_unavailable field (#[serde(skip)]);
  hydrate_all_secrets_for_records sets it on definition records; spawn gate in
  runtime.rs refuses linked instances when definition is unavailable;
  status_for_with checks definition_unavailable tier; agents_deploy.rs checks
  it too. Add definition_tier_tests.rs with 3 tests.

F4 (dev migration marker only on clean completion): Extract pure decision core
plan_dev_secrets_migration(); marker withheld when conflict_count > 0; partial
progress (non-conflicting keys) still written for next boot; log emitted.

F2 (cleanup authorization + legacy live file): Replace bare
agent_secret_store_pub().is_some() gate with extraction_verified() that reloads
both stores and checks no secrets_unavailable flags set after hydration.
Add scrub_legacy_live_file() to explicitly scrub/delete legacy managed-agents.json
after verified extraction. Add 4 tests.

AgentDefinition derives Default to support test helper construction.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-08-10 17:53:20 -04:00
..