Files
buzz/desktop/src-tauri
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 a64110ece7 feat(managed-agents): B8 owner MCP inheritance + per-entry provenance + ratchet fixes
Implements B8 (owner user-scope MCP server inheritance) per the frozen contract
and Thufir's two hard invariants:

1. Lifecycle serialization: merge executes inside apply_claude_spawn_policy, which
   is called from spawn_agent_child while managed_agent_runtime_transition mutex is
   held. Every Buzz path that can spawn an agent (start_pair, restart, restore sweep)
   holds this mutex; stop acquires it and calls terminate_process + child.wait()
   before releasing — no live Claude process writes to the agent root when B8 runs.

2. Collision invariant: proactive case-insensitive filter at merge time. Inherited
   entries whose name matches the ACP server name are omitted + warned before write.
   Buzz wins by construction; no reliance on SDK object-merge order.

Three distinct failure-state warnings (Thufir normative):
- Owner unreadable: prior inherited set preserved (warn + return early)
- Invalid agent file: state replaced (warn, proceed with empty base)
- Write failure: servers may be stale (warn + continue; spawn never blocked)

Per-entry provenance: ExtensionEntry gains an optional source field.
Entries read from an isolated agent root (agent_mcp_path) are tagged
source=owner_user_scope and rendered as inherited from owner user scope
in McpServersSection.

Panel re-anchor (#3493): read_config_surface accepts agent_mcp_path; for
isolated local claude agents the panel reads MCP from the agent-root .claude.json.

B8 tests (10 new in claude_config/tests.rs): merge writes servers, preserves
non-mcpServers keys, owner-read-failure preserves prior set, empty owner clears
inherited set, invalid agent replaced, collision filter (exact + case variant),
empty ACP name disables filter, missing owner writes empty set, concurrent writes
produce valid JSON, path location contract.

Ratchet fixes: agent_discovery.rs, runtime.rs, AgentDefinitionDialog.tsx,
AgentInstanceEditDialog.tsx, types.ts — all five ratchet checks pass.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-08-03 16:12:21 -04:00
..