feat(desktop): add disable_local_spawn flag to prevent duplicate agent spawns - #6484
Open
ScottyOfAus wants to merge 2 commits into
Open
feat(desktop): add disable_local_spawn flag to prevent duplicate agent spawns#6484ScottyOfAus wants to merge 2 commits into
ScottyOfAus wants to merge 2 commits into
Conversation
…ss spawn Adds a new `disable_local_spawn: bool` field to `ManagedAgentRecord` that prevents Desktop from spawning a local process for an agent — neither at boot-time reconciliation nor on reactive triggers (channel open, @mention). Designed for agents whose canonical runtime lives on an external host (e.g. a VPS systemd unit) while keeping the persona and keys in the Desktop store so the toggle is instantly reversible. Changes: - `types.rs`: new field in `ManagedAgentRecord` (`#[serde(default)]` for backward-compatible JSON round-trips) and matching field in `ManagedAgentSummary` - `runtime_commands.rs`: spawn guard in `start_pair()` — returns a descriptive error instead of launching a process when the flag is set - `runtime.rs`: propagates the field through `build_managed_agent_summary` - `agent_settings.rs` + `lib.rs`: new `set_managed_agent_disable_local_spawn` Tauri command, following the `set_managed_agent_start_on_app_launch` pattern - TypeScript API layer (`tauri.ts`, `types.ts`, `tauriManagedAgents.ts`): raw type, camelCase public type, and `setManagedAgentDisableLocalSpawn` wrapper - `hooks.ts`: `useSetManagedAgentDisableLocalSpawnMutation` React Query hook - `UserProfileAgentActions.tsx`: "Remote runtime only" dropdown item with Switch - `UserProfilePanel.tsx`: wires mutation into the profile panel - `ManagedAgentRow.tsx`: shows "Remote runtime" label when flag is set - All Rust struct literals updated with `disable_local_spawn: false`; serde-json fixture construction already handled by `#[serde(default)]` Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Scott Feeney <scott.feeney@hotmail.com>
The initial commit only guarded the reactive lazy-spawn path (start_pair). Add the same flag check to the two boot-time paths that build their own candidate lists without going through start_pair: - reconcile_managed_agent_runtimes: proactive fan-out on app launch - restore_managed_agents_on_launch: post-crash / post-update restore sweep Agents with disable_local_spawn=true were not spawned reactively, but could still be started at boot if start_on_app_launch was set. Both paths now respect the flag. Signed-off-by: Scott Feeney <scott.feeney@hotmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a managed agent is deployed headlessly (VPS or CI) and the owner also has Buzz Desktop open, Desktop detects the agent key on the keychain and spawns a second process. Both processes subscribe to the same channel events and reply to every message, causing duplicate responses and conflicting tool calls.
This is a real blocker for self-hosted relay + remote agent deployments: the Desktop must stay open for other work, but that continuously triggers ghost spawns of every agent whose key is visible to the keychain.
Fixes #6468.
Solution
Add a
disable_local_spawnboolean field to the managed agent record. Whentrue, Desktop skips the reactive spawn path for that agent on channel-mention events and also on boot-time discovery. The remote/VPS process is already running and does not need a local counterpart.This is intentionally a per-agent flag rather than a global setting — the natural migration path is a mixed fleet where some agents run locally and some run remotely.
Changes
feat(desktop): add disable_local_spawn flag to suppress Desktop process spawn— adds the field to the agent schema and plumbs it through the channel-mention code pathfix(desktop): guard boot-time spawn paths against disable_local_spawn— ensures the flag is also respected on Desktop startup, not just reactive spawnsTesting
Verified manually on a self-hosted relay (Linux VPS) with Buzz Desktop open on macOS:
disable_local_spawn: true: Desktop receives the mention event, checks the flag, and does not spawn. Only the VPS process replies.Boot-time path also confirmed: Desktop restart with the flag set does not launch the agent process locally.