fix(desktop): allow restarting saved relay-mesh agents from the UI#956
Merged
Conversation
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>
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
Restarting a saved relay-mesh agent (Spawn/Respawn in the UI) fails with:
forcing users to delete and recreate the agent on every restart.
Root cause
The error comes from a frontend-only guard,
relayMeshAgentError()inmanagedAgentControlActions.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_recordre-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_agent→start_local_agent_with_preflightwithallow_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
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.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.Verification
pnpm test(desktop): 624/624 passpnpm typecheck,pnpm check: clean (1 pre-existing warning on main, untouched)playwright test tests/e2e/mesh-compute.spec.ts: 7/7 pass