fix(desktop): distinguish duplicate agent devices - #6337
Conversation
Show this-device and other-device provenance for same-name owned agents in mention autocomplete while preserving pubkey selection. Co-authored-by: Carl <c7ebe626f000404285d3686e1dc74cc07cc60a9754a150041ba132e14bd3e2ec@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesbillman@users.noreply.github.com>
jedwards27
left a comment
There was a problem hiding this comment.
:bot: Jude’s code review agent
Reviewed exact head fe718f3661f9e704e7a95b3e43064353f3b7f638 against base 203735f15aa2de04320dbfe1c638675da6a2e004.
Request changes
Major: this device is asserted for remotely deployed managed agents
useMentions marks every ManagedAgent as isManagedAgent: true, and mapMentionCandidateToSuggestion translates that flag directly to agentDevice: "this". That is not equivalent to device locality: ManagedAgent.backend also supports { type: "provider" }, and the existing run-location contract explicitly resolves provider backends as remote (desktop/src/features/agents/lib/agentAccessWarning.ts:15-20). A provider-backed agent therefore renders as agent · this device during a same-name collision even though it runs on a server.
That label is a locality assurance at the exact point where the UI is helping the user select a cryptographic identity. It can lead someone to choose an agent expecting this machine's files/accounts/tools when the process is remote. The short npub helps distinguish keys, but it does not make the plain-language locality claim true.
Please either:
- derive
this deviceonly fromagent.backend.type === "local"and represent provider/relay-only provenance truthfully; or - rename the labels to facts the data actually establishes, such as
managed here/managed elsewhere.
Cover local managed, provider-backed managed, same-owner relay-only, and unknown-provenance cases.
Major: the new tests do not protect the production wiring
The behavior depends on useMentions propagating agent.ownerPubkey from the relay directory (desktop/src/features/messages/lib/useMentions.ts:342-354). The mapping test fabricates ownerPubkey, and the label test fabricates agentDevice; neither traverses relay result → candidate coalescing → suggestion → rendered duplicate row → selected pubkey.
A causal mutation confirms the gap: changing only ownerPubkey: agent.ownerPubkey back to ownerPubkey: null leaves all 7 added tests passing. Please add a composed component/mock-bridge workflow with two same-name, same-owner, distinct-pubkey agents. Assert truthful accessible row text and short npubs, select each row by keyboard/pointer, and verify send receives that row's exact pubkey. Mutation-check the relay-owner propagation so deleting it fails the test.
Validation
At the pinned head with a clean worktree:
just desktop-test: 5,103/5,103 passed.just desktop-typecheck: passed.just desktop-check: passed, with only unrelated existing diagnostics outside this five-file PR diff.- Added focused tests: 7/7 passed.
git diff --check HEAD^..HEAD: passed.- Causal mutation above: 7/7 added tests still passed, reproducing the coverage defect.
- CI snapshot at review time: Desktop build, integration, relay E2E, and smoke shards 1/3/4 passed; Desktop Core and smoke shard 2 were still running.
No persistence/schema change is introduced. In the searched ownership path, relay ownership is derived from verified profile events and owner-only filtering, candidate coalescing remains pubkey-keyed, and selection/send still use the selected pubkey. Those checks do not clear the false locality claim or the missing composed regression coverage.
Describe same-name agents by where they are managed rather than asserting runtime device locality. Add an end-to-end regression that verifies both labels and exact pubkey routing. Co-authored-by: Carl <c7ebe626f000404285d3686e1dc74cc07cc60a9754a150041ba132e14bd3e2ec@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesbillman@users.noreply.github.com>
|
Heads-up on a collision — I think we are solving the same problem in the same file, and whoever lands second will hit it. #6259 ("name the computer an agent lives on") adds to ownerPubkey?: string | null;
+ deviceLabel?: string | null;
+ isManagedAgent?: boolean;This PR adds Worth saying plainly: this PR is the better-scoped change. It is +219/-6 against #6259's +2029/-318, it shows provenance only when suggestions actually collide, and it already has an engaged reviewer. I am not asking you to wait on mine. The one substantive gap I would flag is that So the merge I would suggest, if you agree: keep this PR's presentation and collision-only trigger, and let a device label fill the Happy to do the work either way: I can rebase #6259 down to just the device-label plumbing on top of this once it lands, or hand you the |
jedwards27
left a comment
There was a problem hiding this comment.
:bot: Jude’s code review agent — APPROVED at exact head 14fa44ac29a0226a55ee63c885c1a54749e98f29 (base bbd20fae75ecc3bd7a83cc12a65379fac22a2b79).
The previous blockers are resolved:
- Truthful provenance: Desktop-managed identities now map to
managed-here, while verified same-owner relay identities map tomanaged-elsewhere; the UI renders “agent · managed here/elsewhere.” This states management provenance rather than making an unsupported runtime/device-locality claim. The composed fixture deliberately covers a provider-backed Desktop-managed identity and still expects “managed here.” - Exact-pubkey routing: the composed regression traverses mock bridge directories through production mention coalescing/mapping and duplicate-row rendering, then exercises keyboard and pointer selection and verifies each exact pubkey in the signed outbound
ptag.
Risk-shaped validation at this pin:
- Full Desktop unit suite: 5,103 passed, 0 failed.
- Focused mapping/label tests: 7/7 passed.
- Composed duplicate-agent Playwright regression: passed on a freshly built, known-clean exact-head artifact, including 3/3 consecutive runs in the systems lane.
- Provenance mutation (
ownerPubkeypropagation removed): causally failed the “managed elsewhere” assertion. - Routing mutation (selected pubkey replaced with a wrong fixed pubkey): causally failed the outbound mention-pubkey assertion.
git diff --check: passed.- GitHub checks are complete and green at this head, including Desktop Core and all Desktop Smoke E2E shards.
No material findings remain.
Residual risk is non-blocking: Playwright serves static desktop/dist, so mutation runs can accidentally use stale bundles unless artifact provenance is controlled. Reported control runs used a fresh exact-head build; contaminated intermediate runs were excluded. Native Tauri UI automation was not rerun because this change stays within mock-bridge React behavior and does not alter native IPC or OS lifecycle.
…ress * origin/main: fix(desktop): distinguish duplicate agent devices (#6337) feat(desktop): close Buzz window with Cmd+W (#6314) refactor(prompt): simplify Buzz agent guidance (#6340) feat(desktop): make Projects workspaces selectable (#6368) Add Buzz-native collaboration benchmarks (#6264) Polish mobile timeline and emoji interactions (#6297) feat(desktop): make the Projects overview follow the selected section (#6335) refactor(desktop): coordinate TTS playback (#6341) fix(desktop): show complete repository trees (#5102) Add appearance preference previews (#6193) fix(desktop): restore emoji recents (#6263) chore: serialize mobile pre-push checks (#6322) fix(buzz-acp): loosen workspace-scan guardrail to allow named paths (#6261) fix(buzz-dev-mcp): expand leading ~ in read_file/str_replace paths (#6271) perf(desktop): move five hot renderer paths from JS into Rust (#6024) fix(media): accept portrait video resolutions (#6058) fix(desktop): hide archived channels from #/Tab autocomplete (#6156) Unify mobile channel details (#6113) Revert "fix(acp): gate relay-signed workflow messages on their attributed author" (#6311) Signed-off-by: Taylor Ho <taylorkmho@gmail.com> # Conflicts: # desktop/src/features/messages/ui/MentionAutocomplete.test.mjs
…handoff * origin/main: feat(desktop): refine context-aware Projects collaboration (#6396) fix(desktop): distinguish duplicate agent devices (#6337) feat(desktop): close Buzz window with Cmd+W (#6314) refactor(prompt): simplify Buzz agent guidance (#6340) feat(desktop): make Projects workspaces selectable (#6368) Add Buzz-native collaboration benchmarks (#6264) Polish mobile timeline and emoji interactions (#6297) feat(desktop): make the Projects overview follow the selected section (#6335) refactor(desktop): coordinate TTS playback (#6341) fix(desktop): show complete repository trees (#5102) Add appearance preference previews (#6193) fix(desktop): restore emoji recents (#6263) chore: serialize mobile pre-push checks (#6322) Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
…el-directory * origin/main: feat(desktop): refine context-aware Projects collaboration (#6396) fix(desktop): distinguish duplicate agent devices (#6337) feat(desktop): close Buzz window with Cmd+W (#6314) refactor(prompt): simplify Buzz agent guidance (#6340) feat(desktop): make Projects workspaces selectable (#6368) Add Buzz-native collaboration benchmarks (#6264) Polish mobile timeline and emoji interactions (#6297) feat(desktop): make the Projects overview follow the selected section (#6335) refactor(desktop): coordinate TTS playback (#6341) Signed-off-by: Hayt <9e1c23a3fd83f61da34420e4e88ff1b16e45cafcc0cd9019eb07d4ecfa8ca9b0@buzz.block.builderlab.xyz>
…arer-auth * origin/main: test(desktop): use a wordlist-safe separator in passphrase word-count test (#6356) fix(models): curate Databricks alias-aware labels for 5 missing endpoints (#6360) fix(acp): guard against unrequested public relay skills (#6394) feat(desktop): refine context-aware Projects collaboration (#6396) fix(desktop): distinguish duplicate agent devices (#6337) Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
…el-directory * origin/main: feat(desktop): refine context-aware Projects collaboration (#6396) fix(desktop): distinguish duplicate agent devices (#6337) feat(desktop): close Buzz window with Cmd+W (#6314) refactor(prompt): simplify Buzz agent guidance (#6340) feat(desktop): make Projects workspaces selectable (#6368) Add Buzz-native collaboration benchmarks (#6264) Polish mobile timeline and emoji interactions (#6297) feat(desktop): make the Projects overview follow the selected section (#6335) refactor(desktop): coordinate TTS playback (#6341) Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Hayt <9e1c23a3fd83f61da34420e4e88ff1b16e45cafcc0cd9019eb07d4ecfa8ca9b0@buzz.block.builderlab.xyz>
…ounting-and-solo * origin/main: (48 commits) fix(hooks): scope pre-push lanes to branch merge-base diff (#6423) Enforce a three-day dependency cooldown (#6426) perf(desktop): resolve references without directory scans (#6328) feat(llm): stamp thinking effort on call-completed log line (#6424) Fix cross-owner relay agent mentions in owner-only builds (#6338) feat(cli): accept Buzz message links for thread reads (#6359) feat(workflows): add workflow editor (#6248) fix(desktop): preserve huddle speech boundaries (#6397) test(desktop): use a wordlist-safe separator in passphrase word-count test (#6356) fix(models): curate Databricks alias-aware labels for 5 missing endpoints (#6360) fix(acp): guard against unrequested public relay skills (#6394) feat(desktop): refine context-aware Projects collaboration (#6396) fix(desktop): distinguish duplicate agent devices (#6337) feat(desktop): close Buzz window with Cmd+W (#6314) refactor(prompt): simplify Buzz agent guidance (#6340) feat(desktop): make Projects workspaces selectable (#6368) Add Buzz-native collaboration benchmarks (#6264) Polish mobile timeline and emoji interactions (#6297) feat(desktop): make the Projects overview follow the selected section (#6335) refactor(desktop): coordinate TTS playback (#6341) ... Signed-off-by: Atish Patel <atishpatel2012@gmail.com>
…ifications-pr * origin/main: (33 commits) fix(hooks): scope pre-push lanes to branch merge-base diff (#6423) Enforce a three-day dependency cooldown (#6426) perf(desktop): resolve references without directory scans (#6328) feat(llm): stamp thinking effort on call-completed log line (#6424) Fix cross-owner relay agent mentions in owner-only builds (#6338) feat(cli): accept Buzz message links for thread reads (#6359) feat(workflows): add workflow editor (#6248) fix(desktop): preserve huddle speech boundaries (#6397) test(desktop): use a wordlist-safe separator in passphrase word-count test (#6356) fix(models): curate Databricks alias-aware labels for 5 missing endpoints (#6360) fix(acp): guard against unrequested public relay skills (#6394) feat(desktop): refine context-aware Projects collaboration (#6396) fix(desktop): distinguish duplicate agent devices (#6337) feat(desktop): close Buzz window with Cmd+W (#6314) refactor(prompt): simplify Buzz agent guidance (#6340) feat(desktop): make Projects workspaces selectable (#6368) Add Buzz-native collaboration benchmarks (#6264) Polish mobile timeline and emoji interactions (#6297) feat(desktop): make the Projects overview follow the selected section (#6335) refactor(desktop): coordinate TTS playback (#6341) ... Signed-off-by: Tom Brow <tomb@block.xyz>
Summary
managed herefor Desktop-managed identities andmanaged elsewherefor same-owner relay identitiesTesting
ownerPubkeywithnullmakes the composed E2E fail on themanaged elsewhereassertionManual test
With two same-name owned agents visible in a channel, type
@<name>. Duplicate rows identify the identities asagent · managed hereandagent · managed elsewhere, include distinct short npubs, and selecting either routes the mention to that row's exact pubkey.