fix(desktop): spawn managed agents with the configured relay URL - #3484
Open
JHSeo-git wants to merge 1 commit into
Open
fix(desktop): spawn managed agents with the configured relay URL#3484JHSeo-git wants to merge 1 commit into
JHSeo-git wants to merge 1 commit into
Conversation
Relay tenancy is derived from the HTTP Host header, but the managed-agent spawn path handed the child the canonical runtime-key relay URL, whose normalization rewrites loopback spellings to 127.0.0.1. Against a local relay joined as ws://localhost:3000, every harness therefore connected to the empty 127.0.0.1:3000 community, discovered 0 channels, and never saw a mention while the UI showed the agent stuck on Waking. Spawn now hands the child the caller's configured relay URL (BUZZ_RELAY_URL and the git-credential scope) through a small child_connect_relay_url seam, and every path that reaches spawn passes the configured spelling through: start_pair, launch restore, ensure-running, the reconcile fan-out, and the relay-access probe (which now probes the requested authority). start_pair also fills requested_relay_url in its status rows so the frontend's requestedRelayUrl fallback re-dials the configured URL on restart. The canonical form remains the identity for runtime keys, receipts, log paths, and the spawn-config hash: status_for recomputes that hash from key.relay_url, so hashing the configured spelling would read as permanent drift and flag a spurious restart. Signed-off-by: JHSeo <qnfqnfqnf@gmail.com>
JHSeo-git
force-pushed
the
fix/managed-agent-relay-url-tenancy
branch
from
July 30, 2026 00:39
556d776 to
cb11965
Compare
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.
Summary
On a local relay, desktop-managed agents silently never respond: the relay derives the community boundary from the HTTP Host header, but every managed-agent spawn path handed the child
ManagedAgentRuntimeKey.relay_url— the canonical identity form, whose normalization folds every loopback spelling to127.0.0.1. With a community configured asws://localhost:3000, the UI writes all channels, memberships, and messages into thelocalhost:3000community while every agent connects to the empty127.0.0.1:3000community. Each harness logsdiscovered 0 channel(s)/no channel subscriptions resolved — agent will sit idle, the member list shows the agent stuck on "Waking", and mentions are never answered. No error surfaces anywhere.This also violates the contract documented on
buzz_core::relay::normalize_relay_urlitself:Related issue
Fixes #2444. Same root cause family as #3283 (loopback tenant split on the seed side). Closest existing PR: #2446 — same diagnosis and direction; it now has merge conflicts against
mainand its description notes the missing automated regression test as an honest gap. This PR is rebased on currentmain, adds that regression coverage via a small testable seam, and additionally pins the spawn-config hash to the canonical form so restart-drift detection cannot false-positive. Happy to close this in favor of a revived #2446 if maintainers prefer — the test seam here grafts onto it cleanly.Fix
Keep the canonical form for identity only (runtime-map keys, receipts, log paths, spawn-config hash). Dial the configured URL everywhere a child or probe actually connects:
child_connect_relay_url(configured, key)— new seam inruntime.rsthat returns the configured URL for the child'sBUZZ_RELAY_URLand git-credential scope, with adebug_assertthat the configured URL canonicalizes to the runtime key's relay (callers cannot hand it a URL from a different pair).start_pair, launch restore, ensure-running) pass their already-resolved configured URL instead ofkey.relay_url.start_pairinstead of the canonical echo.probe_agent_relay_accessprobes over the requested authority, so spawn eligibility is checked against the same community the child will join.start_pairfillsrequested_relay_urlin its status rows, so the frontend's existingrequestedRelayUrl ?? relayUrlfallback re-dials the configured URL on restart.runtime_key.relay_url:status_forrecomputes that hash fromkey.relay_url, so hashing the configured spelling would read as permanent drift and flag a spurious restart on every status pass.Testing
child_connect_relay_url_preserves_configured_loopback_authority(canonical key isws://127.0.0.1:3000while the child still getsws://localhost:3000) andchild_connect_relay_url_is_identity_for_non_loopback_relays.just cipasses locally;cargo test --libon the Tauri crate: 1851 passed, 0 failed; clippy clean.discovered 0 channel(s)and never replied (memberships verified present in the relay DB, all events under thelocalhost:3000community while harnesses connected to127.0.0.1:3000); after the fix, each harness logsdiscovered 1 channel(s)and a mention in the Welcome channel gets an agent reply within ~50s.Follow-up candidates (out of scope here, discussed in #2444/#3283): collapsing loopback spellings into one community key on the relay side (#2619 explores this), and surfacing the agent-idle state in the UI instead of only in the harness log.