Skip to content

fix(desktop): prompt immediate restart when respond-to gate changes - #3443

Open
surfingdev wants to merge 1 commit into
block:mainfrom
surfingdev:fix/managed-agent-respond-to-restart-prompt
Open

fix(desktop): prompt immediate restart when respond-to gate changes#3443
surfingdev wants to merge 1 commit into
block:mainfrom
surfingdev:fix/managed-agent-respond-to-restart-prompt

Conversation

@surfingdev

@surfingdev surfingdev commented Jul 29, 2026

Copy link
Copy Markdown

Problem

When you change "Who can talk to this agent" (respond_to) on an agent that's already running, Desktop writes the new setting to disk immediately and correctly — but it never restarts the running buzz-acp process. That process keeps enforcing the OLD permission in memory until it happens to restart on its own (an idle-based auto-restart policy, gated to 3+ minutes idle plus other conditions) or someone restarts it by hand. In the meantime, mentions from people who should now be allowed under the new setting are silently dropped, and vice versa. The only indication anything is stale is a passive "Restart required" badge — easy to miss, and especially risky for a setting whose entire point is access control (buzz#2501, buzz#2950).

What this changes

Adds an explicit "Restart now" action to the save toast whenever the save changed the respond_to gate and the backend confirms the running process is now out of sync with disk — mirroring the existing "saved while stopped → Start now" toast pattern already used elsewhere in AgentInstanceEditDialog. The predicate driving it (shouldOfferImmediateRespondToRestart) is a pure function, and the restart itself reuses only existing primitives: respawnManagedAgentWithRules, startManagedAgent/stopManagedAgent, clearActiveTurnsForAgentOnStop, and the backend's already-computed needsRestart drift signal. No Rust/backend changes, no new IPC, no schema changes — this is purely surfacing an existing signal more assertively.

Rebased onto main's #3352 (stateless file-size ratchet replacing the static override ledger). AgentInstanceEditDialog.tsx was already at the line cap and can't grow further under that rule, so the pre-existing "saved while stopped → Start now" toast was extracted alongside the new restart prompt into agentSaveOutcomePrompts.ts (renamed from respondToRestartPrompt.ts) — a net line reduction at the call site instead of a net addition. No behavior change to either toast.

Out of scope (tracked separately)

  • Propagating a persona/definition-level respond_to edit to already-linked instances — update_persona only propagates avatar/display_name today.
  • The Desktop mention-picker/autocomplete eligibility work — in flight on other open PRs (buzz#2987).

Test plan

  • node --import ./test-loader.mjs --experimental-strip-types --test "src/**/*.test.mjs" — 3770/3770 pass (full desktop suite, rebased onto main @ 58d2dfc)
  • npx tsc --noEmit — clean
  • npx biome check on touched files — clean
  • node desktop/scripts/check-file-sizes.mjs (base origin/main) — clean
  • Manual verification in Desktop: edit an existing agent's "Who can talk to this agent" to Anyone/allowlist while running, confirm the "Restart now" toast appears and a non-owner can then @mention it

🤖 Written by Claude, running as an agent inside Buzz (buzz-acp) — not the Claude Code CLI.

@surfingdev
surfingdev requested a review from a team as a code owner July 29, 2026 01:00
Editing "Who can talk to this agent" on a running managed agent instance
already persisted respond_to/respond_to_allowlist correctly, but the
harness process keeps the old gate baked into its env until restarted.
update_managed_agent never auto-restarts by design, and the only signal
was a passive "Restart required" badge — easy to miss, especially for an
agent that's continuously busy and never hits the idle-gated auto-restart
window (buzz#2501, buzz#2950).

Offer an immediate "Restart now" action in the save toast when the save
changed the gate and the backend confirms drift, reusing existing
respawn/restart primitives (respawnManagedAgentWithRules,
startManagedAgent/stopManagedAgent, clearActiveTurnsForAgentOnStop).

Rebased onto main's block#3352 (stateless file-size ratchet against the base
tree, replacing the static override ledger): AgentInstanceEditDialog.tsx
was already over the line cap and can no longer grow at all, so the
pre-existing "saved while stopped -> Start now" toast is extracted
alongside the new restart prompt into agentSaveOutcomePrompts.ts
(renamed from respondToRestartPrompt.ts), leaving the call site as a
net line reduction instead of a net addition. No behavior change to
either toast.

Signed-off-by: Ivan Itzcovich <surfingdevs@gmail.com>
@surfingdev
surfingdev force-pushed the fix/managed-agent-respond-to-restart-prompt branch from 6a0b633 to 58d2dfc Compare July 29, 2026 01:29
@surfingdev

Copy link
Copy Markdown
Author

Rebased onto main to resolve the merge conflict — main landed #3352 (stateless file-size ratchet against the base tree) while this was open, deleting the static override ledger this branch's diff touched. Under the new rule, AgentInstanceEditDialog.tsx (already over the 1000-line cap) can no longer grow at all, so I extracted the pre-existing "saved while stopped → Start now" toast alongside the new restart prompt into agentSaveOutcomePrompts.ts — same behavior, net line reduction instead of net addition.

Re-verified against the rebased tip (58d2dfc):

  • tsc --noEmit — clean
  • biome check on touched files — clean
  • node desktop/scripts/check-file-sizes.mjs (base origin/main) — clean
  • Full desktop suite: 3770/3770 pass

Still open: manual verification in Desktop (toast appears, non-owner can @mention post-restart).

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.

1 participant