fix(desktop): recover tenant-scoped agent runtimes - #5993
Conversation
Signed-off-by: ugiya <17926591+ugiya@users.noreply.github.com>
themiguelamador
left a comment
There was a problem hiding this comment.
Found and fixed one fail-closed gap in the new connection-target comparator.
connection_target and its TypeScript mirror accepted any parseable URL and dropped userinfo/fragments while normalizing it. As a result, invalid relay descriptors such as wss://alice@relay.example and wss://bob@relay.example (or different fragments) could alias in frontend reconciliation/status cache keys instead of following the documented exact-string fallback; the Rust helper had the same contract mismatch. This matters here because the PR relies on connection-target identity to prevent one status/action row from claiming another.
Verified fix commit: dce21a6031f37fd71fa337934db5209cdaeaf62b (fix(desktop): reject invalid runtime connection targets). It rejects non-ws(s), credential-bearing, and fragment-bearing targets in both implementations and adds regressions for exact fallback.
Verification: 140 focused Tauri tests passed; all 4,960 Desktop tests passed; TypeScript typecheck, Biome, Rust fmt, Tauri clippy with -D warnings, and git diff --check passed.
I attempted to push the commit to ugiya/fix/tenant-scoped-agent-runtimes because maintainer edits are enabled, but GitHub returned 403 for themiguelamador.
Summary
Context
This carries forward the configured-relay work from #4859 by @anilkishan and addresses the outstanding review findings on that PR.
Buzz deliberately treats
localhost,127.0.0.1, and::1as distinct configured communities even when they canonicalize to the same local relay identity. The runtime therefore needs two concepts:Collapsing those concepts can make one community appear live in another community and can let Stop, Restart, restore, or reconciliation act on the wrong process.
Fix
Connection-target comparison folds harmless URL spelling differences while preserving tenant-significant distinctions such as
localhostversus127.0.0.1.Review
An independent
xai/grok-4.6xhigh review found one remaining legacy-PID safety gap. The pair-scoped scalar-PID conflict guard was added, focused regressions were expanded, and the follow-up review returned SOLID with no remaining findings.Verification
Exact pushed head:
29a7fdb11just desktop-tauri-test: 2,458 passed, 15 ignored; all integration suites passedjust desktop-tauri-clippy: passed with-D warningsjust desktop-tauri-fmt-check: passedpnpm --dir desktop test: 4,960 passedpnpm --dir desktop typecheck: passedpnpm --dir desktop build: passedgit diff --check origin/main...HEAD: passedThis PR is independent of #5980 and has no file overlap with it; either change can be reviewed and merged first.