Skip to content

fix(desktop): allow restarting saved relay-mesh agents from the UI#956

Merged
tlongwell-block merged 1 commit into
mainfrom
eva/mesh-restart-unblock
Jun 10, 2026
Merged

fix(desktop): allow restarting saved relay-mesh agents from the UI#956
tlongwell-block merged 1 commit into
mainfrom
eva/mesh-restart-unblock

Conversation

@tlongwell-block

Copy link
Copy Markdown
Collaborator

Problem

Restarting a saved relay-mesh agent (Spawn/Respawn in the UI) fails with:

Relay-mesh agents need a fresh serve target before start. Create a new agent with Run on relay mesh selected.

forcing users to delete and recreate the agent on every restart.

Root cause

The error comes from a frontend-only guard, relayMeshAgentError() in managedAgentControlActions.ts, which predates #879. It was correct back when the serve target's dial pointer was only captured at creation time and never persisted — a saved start genuinely couldn't work.

#879 moved that responsibility into the Rust start preflight: ensure_relay_mesh_for_record re-resolves a live bootstrap target from the relay's gossiped serve targets, brings up the local client node, and publishes the paired kind:24621 connect-request so the peer dials back. Every UI start path (start_managed_agentstart_local_agent_with_preflight with allow_fresh_create_start=false) already runs this — the app-relaunch restore path uses it today and restarts mesh agents fine. The stale TS guard just rejected the UI start before the backend ever saw it.

Fix

  • Remove the guard from startManagedAgentWithRules / respawnManagedAgentWithRules; the backend preflight decides, and its actionable errors ('no live serve target for this model' vs 'could not refresh targets') surface through the existing error-toast path. No Rust changes needed.
  • Update the e2e mock bridge (handleStartManagedAgent) to model the real preflight: start succeeds when a live serve target exists for the agent's model, fails with the backend's actual error copy when none does.
  • Rewrite the e2e test to cover both outcomes (restart succeeds with a live target; actionable failure + agent stays stopped without one) and the unit test to verify delegation + error propagation.

Verification

  • pnpm test (desktop): 624/624 pass
  • pnpm typecheck, pnpm check: clean (1 pre-existing warning on main, untouched)
  • playwright test tests/e2e/mesh-compute.spec.ts: 7/7 pass

The frontend relayMeshAgentError guard blocked Spawn/Respawn for any
relay-mesh agent with 'Relay-mesh agents need a fresh serve target
before start', forcing users to recreate the agent. That guard predates
PR #879, which moved serve-target resolution into the Rust start
preflight: ensure_relay_mesh_for_record re-resolves a live bootstrap
target from the relay, brings up the local client node, and publishes
the paired connect-request so the peer dials back. The backend fully
supports restarting saved relay-mesh agents and returns actionable
errors when it cannot, but the stale UI guard rejected the start before
the backend ever saw it.

Remove the guard from start/respawn and let the backend preflight
decide; its error already surfaces through the existing toast path.
Update the e2e mock bridge to model the preflight (start succeeds when
a live serve target exists for the model, fails actionably when none
does) and rewrite the e2e + unit tests to cover both outcomes.

Co-authored-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@sprout-oss.stage.blox.sqprod.co>
@tlongwell-block tlongwell-block requested a review from a team as a code owner June 10, 2026 20:44
@tlongwell-block tlongwell-block merged commit 510009c into main Jun 10, 2026
13 checks passed
@tlongwell-block tlongwell-block deleted the eva/mesh-restart-unblock branch June 10, 2026 20:56
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