fix(desktop): dedupe profile mention completions - #89019
Draft
zhongwater123 wants to merge 1 commit into
Draft
Conversation
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.
What / Why
Fixes #88915.
When Bot Mode is active, a profile can be offered twice in the Desktop
@autocomplete: once by the synchronous Bot plugin contribution and once by the gateway's core profile completion. Both rows insert the same mention, so the duplicate is not a distinct choice.Product impact path
@in the main Desktop composer or the edit-message composer.useAtCompletions.composer.atCompletions.complete.pathindependently returns the same active profile handle.@handle.Root cause and scope
useAtCompletionshad no identity reconciliation at the only merge seam between contributed and core completion rows.This patch deduplicates case-insensitive bare
@handleoverlaps while preserving contribution order, so the richer Bot row wins. It deliberately does not collapse typed references such as@file:..., distinct multi-source handles such as@researcher-homelab, or the simple context actions@diff/@staged. The same merge is used for gateway success, no-gateway fallback, and request-error fallback.Non-goals: changing backend profile enumeration, Bot roster/group behavior, path-reference formatting, databases, Langfuse, security behavior, or unrelated completion sources.
Commits
NousResearch/hermes-agent:main):e624e9fde561e1add9388384012b295fde669adeb6b494493853006525a60939dfcedc6779044de3zhongwater123; two files changed; no commits from another PR.Main / head comparison and mutation proof
Regression command:
['@Researcher', '@researcher']; expected['@Researcher'].Validation
Passed on the final head:
vitest run --project ui src/app/chat/composer/hooks: 87 / 87 across 14 files.node --test src/plugins/*/tests/*.test.mjs: 254 / 254.npm run typecheck: renderer, Electron, and E2E TypeScript configs passed.npm run build: production renderer (15,033 modules), Electron main/preload bundles, native dependency staging, andassert-dist-builtpassed.npm run lint: exit 0, 0 errors; 123 warnings are in unmodified repository files. The two touched files separately pass ESLint with--max-warnings=0.python scripts/check-windows-footguns.py --all: passed, 983 files scanned.git diff --check: passed.Checks that did not pass or could not run:
npm run test:uidid not pass in this Windows environment. The captured run timed out in four unrelated files:src/app/skills/index.test.tsx,src/app/messaging/index.test.tsx,src/store/session-unread-tile.test.ts, andsrc/app/settings/gateway-settings.test.tsx. A single-worker rerun of exactly those files also failed 12 / 20 (mostly 15-second timeouts plus existing DOM/act()isolation symptoms). None imports or exercises the changed hook.HERMES_PYTHON=D:\python312\python.exe scripts/run_tests.sh tests/gateway/test_complete_path_at_filter.pyreached pytest collection but could not collect becauseconcurrent_log_handleris not installed. No Python production code is changed.Platform
Overlap audit
No open PR references #88915 or its exact symptom at publication time. #86814 touches the Bot plugin but is a stale/conflicting alternate feature implementation and does not reconcile contributed/core completion rows.
Prepared with Codex assistance; evidence verified against the stated commits.