Skip to content

feat(desktop): add disable_local_spawn flag to prevent duplicate agent spawns - #6484

Open
ScottyOfAus wants to merge 2 commits into
block:mainfrom
ScottyOfAus:feat/disable-local-spawn
Open

feat(desktop): add disable_local_spawn flag to prevent duplicate agent spawns#6484
ScottyOfAus wants to merge 2 commits into
block:mainfrom
ScottyOfAus:feat/disable-local-spawn

Conversation

@ScottyOfAus

Copy link
Copy Markdown

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_spawn boolean field to the managed agent record. When true, 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 path
  • fix(desktop): guard boot-time spawn paths against disable_local_spawn — ensures the flag is also respected on Desktop startup, not just reactive spawns

Testing

Verified manually on a self-hosted relay (Linux VPS) with Buzz Desktop open on macOS:

  • Without flag: Desktop spawns a second process within ~2 s of a channel mention; both processes reply.
  • With 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.

ScottyOfAus and others added 2 commits August 21, 2026 06:16
…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>
@ScottyOfAus
ScottyOfAus requested a review from a team as a code owner August 21, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ManagedAgentRecord: add disable_local_spawn flag to prevent Desktop from reactively spawning an agent whose runtime is externally managed

1 participant