Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion desktop/src-tauri/src/managed_agents/restore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,15 @@ pub async fn restore_managed_agents_on_launch(
// mid-turn session is not resumed by an
// eager child — and silently reintroduces
// N idle brains on every launch.
// Connect via the configured relay
// (`relay_url`), not the normalized
// key — see spawn_agent_child: the
// loopback fold to 127.0.0.1 is
// identity-only.
spawn_agent_child(
app,
record,
&key.relay_url,
&relay_url,
true,
owner_hex_ref,
)
Expand Down
17 changes: 13 additions & 4 deletions desktop/src-tauri/src/managed_agents/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,16 @@ pub fn spawn_agent_child(
.map(|p| p.display().to_string())
.unwrap_or_else(|| effective_command.clone());

// The caller supplies the explicit canonical pair relay. This is the only
// relay this child may connect to, regardless of the record/workspace default.
let effective_relay_url = runtime_key.relay_url.clone();
// Connect the child to the CONFIGURED relay URL (the raw `relay_url` the
// caller passed), NOT the normalized `runtime_key.relay_url`. Buzz's relay
// is multi-tenant and keys each community by the literal request Host, so
// folding loopback spellings to 127.0.0.1 — correct for the dedup IDENTITY
// key, and still used for receipts/pids/logs via `runtime_key` — would
// connect the agent to a DIFFERENT, empty tenant than the one the human
// joined on `localhost`, leaving it "online" but discovering 0 channels.
// `normalize_relay_url`'s own contract says connection code must retain the
// configured URL; this honors that.
let effective_relay_url = relay_url.to_string();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep restart hashes on a consistent relay URL

For relay URLs whose configured form differs from the normalized runtime key (the fixed localhost case, [::1], default ports, etc.), this raw assignment also changes the value stamped into process.spawn_config_hash; later build_managed_agent_summary recomputes the hash with key.relay_url (the normalized value), so a freshly started agent is reported as needs_restart immediately even though no config changed. Split the connection URL from the hash input, or make the summary recompute with the same configured URL.

Useful? React with 👍 / 👎.


// Augment PATH for DMG launches so child processes can find:
// - bundled CLI via ~/.local/bin symlink
Expand Down Expand Up @@ -997,7 +1004,9 @@ pub fn start_managed_agent_process(
// Scalar PIDs are migration-only and never establish pair liveness.
record.runtime_pid = None;

let mut process = spawn_agent_child(app, record, &key.relay_url, false, owner_hex)?;
// Connect via the configured relay (`relay_url`), not the normalized key —
// see spawn_agent_child: the loopback fold to 127.0.0.1 is identity-only.
let mut process = spawn_agent_child(app, record, &relay_url, false, owner_hex)?;
let now = now_iso();
let receipt = super::ManagedAgentRuntimeReceipt {
key: key.clone(),
Expand Down
10 changes: 8 additions & 2 deletions desktop/src-tauri/src/managed_agents/runtime_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,9 @@ fn start_pair(
.lock()
.ok()
.map(|keys| keys.public_key().to_hex());
let mut process = spawn_agent_child(&app, record, &key.relay_url, lazy, owner.as_deref())?;
// Connect via the configured relay (`relay_url`), not the normalized key —
// see spawn_agent_child: the loopback fold to 127.0.0.1 is identity-only.
let mut process = spawn_agent_child(&app, record, &relay_url, lazy, owner.as_deref())?;
let now = crate::util::now_iso();
let receipt = ManagedAgentRuntimeReceipt {
key: key.clone(),
Expand Down Expand Up @@ -504,7 +506,11 @@ pub async fn reconcile_managed_agent_runtimes(
Ok((record, key, requested)) => {
match start_pair(
record.pubkey.clone(),
key.relay_url.clone(),
// Connect via the raw requested community URL, not the
// normalized pair key — see spawn_agent_child: the
// loopback fold to 127.0.0.1 is identity-only and would
// land the agent in a different, empty tenant.
requested.clone(),
true,
Some(&record.updated_at),
app.clone(),
Expand Down