Skip to content

fix(desktop): make local agents always use the workspace relay#1131

Draft
wpfleger96 wants to merge 1 commit into
mainfrom
duncan/local-agent-relay-invariant
Draft

fix(desktop): make local agents always use the workspace relay#1131
wpfleger96 wants to merge 1 commit into
mainfrom
duncan/local-agent-relay-invariant

Conversation

@wpfleger96

Copy link
Copy Markdown
Collaborator

Local managed agents are an invariant-workspace-relay class, but several relay operations read each record's frozen per-record relay_url instead of the session's workspace relay. A record minted under an old build froze at ws://localhost:3000, so the boot reconcile loop hit a dead relay and printed a relay unreachable line on every just staging run.

Approach

Fix it at read time, with no on-disk migration. goose is a valid runtime (migrating it would corrupt working records), and rewriting relay_url would ping-pong the cross-worktree-symlinked managed-agents.json between worktrees with different relay overrides. Instead, a LOCAL agent always resolves the workspace relay at every point it touches a relay; a stale stored value becomes inert rather than load-bearing.

Changes

  • relay::effective_agent_relay_url — a small pure helper centralizing the local-vs-remote decision: local agents use the workspace relay, remote (Provider) agents keep their per-record relay.
  • Reconcile (reconcile_agent_profile) — both the profile read and the write-back route through the effective relay. ProfileReconcileData gains a backend_is_local flag set at both build sites (UI-start and boot).
  • Spawn (spawn_agent_child) — BUZZ_RELAY_URL and the git-credential-helper URL both use the effective relay, so the child connects and authenticates on the workspace relay, not a frozen per-record value.
  • Rename re-sync (update_managed_agent) — re-publishes a renamed local agent's profile to the workspace relay rather than a possibly-stale per-record relay.
  • Create lockdown (create_managed_agent) — local agents always use the workspace relay and ignore any user-supplied relay_url, so the invariant holds at birth. The Provider arm is unchanged.
  • Picker default (CreateAgentDialog.tsx) — new agents default to buzz-agent instead of goose at both the initial-state and reset sites.

Remote (Provider) agents are byte-for-byte unchanged across all four relay readers. Existing goose records are untouched — no command migration, no relay migration, nothing written to managed-agents.json to "correct" records.

The doc comments on reconcile_agent_profile and query_agent_profile that previously stated per-record targeting was intentional are updated to record the new local-vs-remote contract.

Note

desktop/scripts/check-file-sizes.mjs bumps the existing TEMP runtime.rs override (1940 to 1953); the file was at 1938 with two lines of slack, and the spawn fix is load-bearing. The file remains queued to be split.

Local managed agents are an invariant-workspace-relay class, but several
relay operations read each record's frozen per-record relay_url instead of
the session's workspace relay. A record minted under an old build froze at
ws://localhost:3000, so #933's boot reconcile loop hit a dead relay and
printed a "relay unreachable" line on every just staging run.

Fix it at read time, with no on-disk migration (goose is a valid runtime
and rewriting relay_url would ping-pong the #1121-symlinked shared file
across worktrees). A new effective_agent_relay_url helper centralizes the
local-vs-remote decision; reconcile, spawn (BUZZ_RELAY_URL + git-credential
URL), and the rename re-sync all route local agents to the workspace relay
while remote (Provider) agents keep their per-record relay. The create path
forces the workspace relay for local agents so the invariant holds at birth,
and the picker defaults new agents to buzz-agent.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
@wpfleger96 wpfleger96 marked this pull request as draft June 19, 2026 02:38
@wpfleger96 wpfleger96 force-pushed the duncan/local-agent-relay-invariant branch from 972ad1d to 89c9a22 Compare June 19, 2026 02:45
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