fix(chat): tell the sender when an @agent mention can't delegate - #595
Open
asteroida123 wants to merge 1 commit into
Open
fix(chat): tell the sender when an @agent mention can't delegate#595asteroida123 wants to merge 1 commit into
asteroida123 wants to merge 1 commit into
Conversation
An @-mention only routes work to another agent when BOTH gates are open: multi-agent delegation is enabled in settings, and the target agent is enabled in Agents management. With a gate closed, delegate_to_agent was never injected into the host session, so the host model just answers the mention itself and the sender never learns why — @ looks silently broken (xintaofei#545). Warn at send time instead. The composer scans the outgoing text blocks for codeg://agent/<type> routing URIs (free-standing @prose never triggers), then best-effort + fire-and-forget classifies the mentions against the delegation settings and the agent list (30s module-level cache). A blocked mention raises a toast with a deep link: Settings → General → Multi-Agent Collaboration when delegation is off, Settings → Agents (preselected on the agent) when the target is disabled. A lookup failure is swallowed — the hint must never block the send. Deep-linking General required threading a "general" section through open_settings_window: the desktop route resolver and the web handler both fell back to appearance; the TS SettingsSection union gains it too. i18n: 3 keys x 10 locales; entry names are lifted from each locale's own UI labels so the path in the hint matches what the user sees. Related to xintaofei#545 — this covers only the "gate closed" failure mode; deterministic mention routing as proposed there is a larger design question left to that discussion.
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.
背景
@ 智能体的委托有两个闸门:「多智能体协同」总开关(默认关闭)+ 目标智能体在 Agents 管理中启用。任一关闭时,
delegate_to_agent工具根本不会注入宿主会话,宿主模型就会自己把消息答掉 —— 对发送者来说,@ 就是"无声失效"(相关讨论:#545)。本 PR 在发送时刻把这件事讲出来,让新手至少知道"为什么没委托、去哪里开":
codeg://agent/<type>路由 URI(用户手打的@文本不会误触发)toast.warning+ 深链按钮:范围边界:本 PR 只覆盖"闸门关闭"这一失败模式。#545 中提出的确定性整轮路由(发送前把提及改写为委托调用)是更大的产品设计问题 —— 涉及混合意图、多提及拆分、steer/队列路径等 —— 留待该 issue 单独讨论。
附带:
open_settings_window支持general段深链"常规"页此前不通:桌面端
resolve_settings_route与 Web 端 handler 都没有"general"映射(会回退到外观页)。三处各补一行(桌面 / Web / TSSettingsSectionunion),行为纯增量。i18n
3 键 × 10 语言。提示中的入口名称(常规 / 智能体 / 多智能体协同 等)逐一取自各语言现有 UI 译名,保证提示里的路径与用户实际看到的界面一致。
测试
agent-mention-hint.test.ts(10 例):URI 提取与去重、自由文本 @ 不误报、仅扫描文本块、四种闸门组合、无提及时不请求后端pnpm vitest run全量 5183 通过;tsc --noEmit干净;eslint 干净cargo check桌面 + server 两模式通过;cargo clippy(server lib / desktop all-targets)-D warnings通过