Repository navigation
feat(dingtalk): mention response senders - #6679
Conversation
…-mention # Conflicts: # packages/channels/dingtalk/src/DingtalkAdapter.test.ts # packages/channels/dingtalk/src/DingtalkAdapter.ts
wenshao
left a comment
There was a problem hiding this comment.
Reviewed — no blockers. Suggestions are inline.
|
|
||
| function splitTextChunks(text: string, firstChunkLimit: number): string[] { | ||
| if (!text) return [text]; | ||
|
|
There was a problem hiding this comment.
[Suggestion] splitTextChunks has no guard against non-positive firstChunkLimit. If the mention prefix ever exceeds TEXT_MESSAGE_LIMIT (3800), chunkLimit becomes 0 and the while loop never advances (offset += 0, text.slice(offset, offset + 0) returns ""), causing an infinite loop.
| function splitTextChunks(text: string, firstChunkLimit: number): string[] { | |
| if (!text) return [text]; | |
| if (firstChunkLimit <= 0) firstChunkLimit = TEXT_MESSAGE_LIMIT; | |
| const chunks: string[] = []; |
— qwen3.7-max via Qwen Code /review
| atUserId?: string, | ||
| ): Promise<void> { | ||
| const webhook = this.webhooks.get(chatId); | ||
| if (!webhook) return; |
There was a problem hiding this comment.
[Suggestion] sendTextReply silently returns when the webhook is missing, while sendReply logs [DingTalk:${name}] No webhook for chatId ${chatId}, cannot send. before returning. This is an observability regression for the mention-enabled code path — operators debugging silent delivery failures have no log to grep for.
| if (!webhook) return; | |
| const webhook = this.webhooks.get(chatId); | |
| if (!webhook) { | |
| process.stderr.write( | |
| `[DingTalk:${this.name}] No webhook for chatId ${chatId}, cannot send text reply.\n`, | |
| ); | |
| return; | |
| } |
— qwen3.7-max via Qwen Code /review
| this.mentionTargets.delete(messageId); | ||
| if (this.atSender && atUserId) { | ||
| this.sessionMentionTargets.set(sessionId, atUserId); | ||
| this.textReplySessions.add(sessionId); |
There was a problem hiding this comment.
[Suggestion] textReplySessions is set here alongside sessionMentionTargets and persists until onPromptEnd, so every chunk/response in a mention-enabled prompt uses plain text (sendTextReply) — not just the one carrying the @. The PR description says "only the first message of a long reply contains the mention" but all chunks lose Markdown formatting (code blocks, bold, links).
Consider clearing textReplySessions alongside sessionMentionTargets after the mention is consumed in sendResponseMessage, so subsequent chunks revert to Markdown via sendReply.
— qwen3.7-max via Qwen Code /review
| private client: DWClient; | ||
| private readonly atSender: boolean; | ||
| private connectionManager?: DingtalkConnectionManager<DWClient>; | ||
| private seenMessages: Map<string, number> = new Map(); |
There was a problem hiding this comment.
[Suggestion] Five interrelated Maps/Sets track mention targets through the lifecycle, with cleanup spread across seven methods (onPromptStart, onPromptEnd, onSessionDied, onTaskLifecycle, onPromptBufferDropped, onPromptBufferDrained, processInbound finally). A block comment documenting the state machine — which map holds what, when entries move between maps, and which methods are cleanup owners — would prevent a future maintainer who adds a new lifecycle hook from missing a cleanup path.
— qwen3.7-max via Qwen Code /review
| this.stopReaction(chatId, messageId, sessionId); | ||
| } | ||
|
|
||
| protected override async sendResponseMessage( |
There was a problem hiding this comment.
[Suggestion] textReplySessions and sessionMentionTargets are always set together in onPromptStart and always cleared together in onPromptEnd/onSessionDied, but sendResponseMessage reads them as independent. They could be collapsed into a single Map<string, string> (sessionId → staffId), where presence implies text-reply mode. This eliminates the risk that a future change clears one without the other.
— qwen3.7-max via Qwen Code /review
✅ Local verification report — maintainer reviewI built this PR from source and verified it end-to-end on macOS. All gates pass and the runtime behavior matches the PR description. Recommending it as ready for merge, with one intentional tradeoff to keep in mind (below).
What I ran
Real end-to-end behavior (captured wire payloads)The PR's own mention-body tests drive the 1. { "msgtype": "text",
"text": { "content": "@staff-777\n\nHere is your answer." },
"at": { "atUserIds": ["staff-777"] } }2. Same message, { "msgtype": "markdown", "markdown": { "text": "Here is your answer." } } // no `at`3. { "msgtype": "markdown", ... } // no `at`4. This confirms the message→session→sender correlation works through the real queue/prompt loop, the opt-in gate is respected, the DM / missing-staff-ID fallbacks are correct, and long replies stay within DingTalk's text limit while mentioning exactly once. Before / AfterThe exact outbound payloads captured from the real pipeline, plus the local test/build gates: Reviewer notes
🇨🇳 中文说明(点击展开)✅ 本地验证报告 — 维护者复核我从源码构建了本 PR,并在 macOS 上做了端到端验证。所有检查项均通过,运行时行为与 PR 描述一致。建议可以合并,但有一个需要注意的、有意为之的取舍(见下)。
执行的检查
真实端到端行为(抓取的实际出站报文)PR 自带的 @ 报文测试是直接调用 1. { "msgtype": "text",
"text": { "content": "@staff-777\n\nHere is your answer." },
"at": { "atUserIds": ["staff-777"] } }2. 同样的消息, { "msgtype": "markdown", "markdown": { "text": "Here is your answer." } } // 无 `at`3. { "msgtype": "markdown", ... } // 无 `at`4. 这证明了「消息 → 会话 → 提问者」的关联在真实队列/prompt 循环中有效,开关(opt-in)被正确遵守,私聊/无 staffId 的回退正确,长回复在钉钉文本长度限制内且只 @ 一次。 前后对比从真实链路抓取的实际出站报文,以及本地测试/构建检查结果: 复核备注
🔍 Verified locally by the maintainer from source (build + typecheck + lint + full DingTalk/ChannelBase suites + an independent real-pipeline E2E harness). Screenshots above are rendered from the actual captured wire payloads. |
|
@qwen-code /triage |
* docs: design DingTalk at-sender replies * docs: plan DingTalk at-sender replies * feat(channels): preserve session for response delivery * feat(dingtalk): optionally mention response sender * docs(dingtalk): explain response mentions * fix(dingtalk): retain queued mention targets * fix(dingtalk): bound mention target lifecycle * fix(dingtalk): clear synthetic command mention target * fix(dingtalk): clear buffered targets on session death * debug(dingtalk): log mention delivery result * fix(dingtalk): render response mentions * fix(dingtalk): send visible response mentions * feat(dingtalk): use text replies for mentions * fix(dingtalk): preserve mentioned text replies
* feat(web-shell): add mobile welcome composer slots * refactor(web-shell): deduplicate MessageList JSX and remove dead CSS reference - Extract ~80 lines of duplicated MessageList rendering into shared variables with conditional props and wrapper - Remove dead chatPaneWithWelcomeMiddle className reference (CSS class never defined) - Document mobileWelcomeFooterMiddle dependency on renderWelcomeFooter in JSDoc * fix(web-shell): stabilize MessageList tree position and conditional customFooter wrapper - Use stable outer wrapper div for IIFE to prevent MessageList unmount/remount when showMobileWelcomeFooterMiddle toggles - Only wrap CustomFooter in styles.customFooter div when hasMobileComposerBottom is true, avoiding DOM depth change for non-mobile consumers * fix(release): raise package size budget to 85 MiB (QwenLM#6688) * fix(interactive): configure Docker sandbox networking for protocol tag retry test (QwenLM#6684) (QwenLM#6689) The protocol-tags-interactive.test.ts started the fake OpenAI server on 127.0.0.1 without Docker-aware host options, making it unreachable from inside the Docker sandbox container. The CLI running in the container tried to connect to 127.0.0.1 which resolved to the container's own loopback, not the host where the test server listens. Bind the fake server to 0.0.0.0 and advertise host.docker.internal as the base URL host when QWEN_SANDBOX is docker or podman, matching the established pattern in tool-control.test.ts. Also set NO_PROXY to include host.docker.internal so the CLI does not route sandbox model requests through an HTTP proxy. Co-authored-by: qwen-autofix[bot] <qwen-autofix[bot]@users.noreply.github.com> * fix(core): keep YOLO mode when the model calls enter_plan_mode (QwenLM#6630) * fix(core): keep YOLO mode when the model calls enter_plan_mode A model-initiated enter_plan_mode call from YOLO silently switched the session into the read-only Plan mode, surprising users who explicitly chose YOLO for low-friction execution and then blocking the reads/writes they expected to proceed. Genuine user-driven plan-mode entries (Shift+Tab, /plan) call setApprovalMode directly and never route through this tool, so guarding the tool only affects the model deciding to plan on its own. From YOLO the tool now keeps the current mode and returns a message telling the model to continue planning without switching. Fixes QwenLM#5970 * fix(core): gate the YOLO plan-mode guard on an explicit user request Addresses review feedback on QwenLM#6630. The previous guard suppressed every enter_plan_mode invocation while the session was in YOLO mode. That fixes the unsolicited switch reported in QwenLM#5970, but it also blocks the legitimate path: the tool description tells the model to call this tool only after the user explicitly asks, and /plan is interactive-only (supportedModes: ['interactive']) with no Shift+Tab equivalent. In a headless or ACP YOLO session the tool is the only door into plan mode, so a blanket guard made an explicit user request unreachable. Add an optional userRequested flag to the tool schema and only no-op when the entry is NOT user-requested. A user-requested entry still goes through setApprovalMode(PLAN, { enteredByModel: true }) so the Plan Approval Gate on exit continues to run for AUTO/YOLO sessions (QwenLM#5574). * fix(core): address review suggestions on the YOLO plan-mode guard - Log via debugLogger.info when the guard suppresses a model-initiated entry, so a "I asked for plan mode and nothing happened" report is diagnosable by grepping ENTER_PLAN_MODE (the other early-return paths already log). - Strengthen the userRequested:false test to assert on the returned llmContent/returnDisplay, matching the unsolicited-entry sibling test. - Add a defensive test pinning that userRequested is inert outside YOLO: DEFAULT with the flag set enters plan mode normally. --------- Co-authored-by: Shaojin Wen <[email protected]> * feat(cli): forward ask_user_question answers from SDK can_use_tool (QwenLM#6655) * feat(cli): forward ask_user_question answers from SDK can_use_tool SDK-hosted agents could receive ask_user_question calls through the can_use_tool callback and approve them, but the user's answers never reached the tool: the CLI called onConfirm(ProceedOnce) with no payload, so the tool read an empty answers map and the model never got the decisions. Route updatedInput.answers from the SDK's allow response into the tool confirmation payload so the collected answers reach the tool. Reuses the existing updatedInput channel — no new SDK API or types. Document the pattern in the TypeScript and Python SDK READMEs. * fix(cli): forward ask_user_question answers on teammate approval path Address review feedback on QwenLM#6655: - handleTeammateApproval now mirrors the leader path and promotes the user's answers from updatedInput into the confirmation payload, so ask_user_question calls approved through a teammate no longer drop the user's choices (wenshao). - Extract a shared buildAllowConfirmationPayload helper used by both the leader and teammate paths, and only promote `answers` for ask_user_question so a same-named field on any other tool's input can't leak into the payload. - Add tests for the teammate path and the defensive guards (array updatedInput, array/null/empty answers, foreign answers field). * test(web-shell): stub Range client-rect methods to fix flaky CI CodeMirror's async measure pass (scheduled via requestAnimationFrame) calls getClientRects()/getBoundingClientRect() on a text Range. jsdom implements these on Element but not on Range, so the call throws "textRange(...).getClientRects is not a function" from a rAF callback after the test completed. Vitest surfaces it as an unhandled error and fails the whole run with exit code 1 even though every assertion passed (seen intermittently in useComposerCore.dom.test.tsx). Polyfill both methods on Range.prototype in the shared test setup, mirroring the existing ResizeObserver/scrollIntoView stubs. * refactor(cli): use ToolNames constant and broaden permission tests Address review suggestions on QwenLM#6655: - buildAllowConfirmationPayload now gates answers-promotion on the ToolNames.ASK_USER_QUESTION constant instead of a bare string literal, so a future rename of the tool name is a compile-time break rather than a silent regression. - Add an it.each case for a non-object primitive updatedInput (string) to cover the `typeof updatedInput !== 'object'` guard branch. - Assert the leader path overrides toolCall.request.args with the host's sanitized updatedInput before confirming. - Add a teammate-path test for an allow response with no updatedInput, asserting respond is called with (ProceedOnce, undefined). --------- Co-authored-by: qwen-code-dev-bot <[email protected]> * fix(cli): localize approval mode UI labels (QwenLM#6592) * fix(cli): localize approval mode UI labels * fix(cli): address approval mode i18n review * fix(cli): stabilize approval mode i18n key * test(cli): cover approval mode i18n follow-up * test(cli): cover localized auto indicator * test(cli): address approval i18n suggestions --------- Co-authored-by: Shaojin Wen <[email protected]> * feat(dingtalk): mention response senders (QwenLM#6679) * docs: design DingTalk at-sender replies * docs: plan DingTalk at-sender replies * feat(channels): preserve session for response delivery * feat(dingtalk): optionally mention response sender * docs(dingtalk): explain response mentions * fix(dingtalk): retain queued mention targets * fix(dingtalk): bound mention target lifecycle * fix(dingtalk): clear synthetic command mention target * fix(dingtalk): clear buffered targets on session death * debug(dingtalk): log mention delivery result * fix(dingtalk): render response mentions * fix(dingtalk): send visible response mentions * feat(dingtalk): use text replies for mentions * fix(dingtalk): preserve mentioned text replies * feat(web-shell): add artifact right panel (QwenLM#6591) * feat(web-shell): add artifact right panel * fix(web-shell): address artifact panel review feedback * fix(web-shell): handle artifact panel review edge cases * fix(web-shell): tighten scheduled task parsing * fix(web-shell): address artifact panel review followups * fix(web-shell): guard large file diff stats * fix(web-shell): address review panel suggestions * test(webui): stabilize heartbeat prompt cleanup test * fix(web-shell): address artifact review refresh issues * test(web-shell): stabilize ChatPane artifact hook mock * fix(web-shell): clear stale session artifacts while loading * fix(web-shell): preserve artifact tabs during refresh * fix(web-shell): address artifact review followups * fix(web-shell): respect workspace cwd for artifact outputs * fix(web-shell): scope artifact panel actions to pane * fix(web-shell): resolve split pane merge conflict * fix(web-shell): clear stale artifact panel state * fix(web-shell): preserve leading turn outputs * fix(web-shell): tighten turn output selectors * fix(web-shell): harden artifact preview sanitizer * fix(web-shell): address artifact panel review regressions * fix(web-shell): reconcile split pane artifact snapshots * fix(web-shell): clear pane artifacts on session switch * fix(web-shell): clear stale right panel snapshots * fix(web-shell): repair scheduled task hint string --------- Co-authored-by: ytahdn <[email protected]> Co-authored-by: qwen-code-dev-bot <[email protected]> * feat(cli): workspace-qualified ACP transport (daemon multi-workspace phase 4) (QwenLM#6621) * docs(design): add daemon multi-workspace phase 4 (workspace-qualified ACP) design * feat(cli): add workspace-qualified ACP transport (issue QwenLM#6378 phase 4) Per-runtime ACP dispatcher at /workspaces/:workspace/acp (HTTP + WS) dispatched by URL path from the single upgrade listener; per-runtime device-flow + reverse client-MCP; owner-index via bridge lifecycle; untrusted/unknown rejected; legacy /acp unchanged; advertise workspace_qualified_acp for multi-workspace. * fix(cli): keep per-runtime device-flow registry out of serve fast-path bundle Phase 4 secondary-runtime device-flow statically imported createDeviceFlowRegistry into run-qwen-serve, pulling glob/@iarna/toml into the serve fast-path bundle and failing the closure check. Import it dynamically at the creation site; the check now passes and behavior is unchanged. * refactor(cli): drop per-runtime device-flow for secondary workspaces Follow-up to the fast-path fix: instead of dynamically importing createDeviceFlowRegistry for secondary runtimes, drop the per-runtime device-flow wiring entirely. Secondary ACP device-flow falls back to the dispatcher default, keeping the serve fast-path bundle closure clean without the dynamic-import indirection. WorkspaceRuntime.deviceFlowRegistry stays optional for a future per-runtime hook. * fix(cli): share daemon-global device-flow across ACP mounts; harden WS path parsing Secondary ACP mounts share the daemon-global device-flow registry (single instance per daemon) instead of a per-runtime one; the event sink fans out to every trusted runtime bridge so secondary ACP clients receive their own flow events, fixing the reviewer QwenLM#6621 Critical and the CI test failure. Drops WorkspaceRuntime.deviceFlowRegistry. WS upgrade path is parsed from the raw request-target instead of new URL().pathname, rejecting %2e%2e / backslash / dot-segment traversal. * refactor(cli): gate CDP claim on primary mount; return plural ACP POST promise Add a primary flag to RuntimeAcpMount so a secondary workspace's ACP connection cannot claim the CDP tunnel -- the claim is gated on activeMount.primary, matching the primary-only chrome-devtools MCP wiring. The plural /workspaces/:workspace/acp POST handler returns the dispatch promise instead of voiding it. * refactor(cli): centralize ACP-HTTP enablement in resolveAcpHttpEnabled Add resolveAcpHttpEnabled() as the single interpretation of the QWEN_SERVE_ACP_HTTP opt-out, replacing four independent env checks across mount, voice-WS advertisement, and CDP-MCP gating. Advertise workspace_qualified_acp only when the ACP HTTP surface is enabled AND multi-workspace sessions are active, so it is not announced when ACP HTTP is disabled. * feat(cli): ACP dispose 503 gate + aggregate connection snapshot across mounts After dispose() the shared ACP HTTP handlers (legacy /acp + workspace-qualified) return 503 server_disposed instead of racing torn-down registries during the shutdown drain. Add AcpHttpHandle.getSnapshot() aggregating connection and wsStream counts across the primary mount and every trusted secondary runtime, and switch the metrics sampler to it so daemon metrics report all workspaces' ACP connections rather than only the primary's. * test(cli): cover ACP dispose 503, aggregate snapshot, and raw dot-segment WS reject * docs(design): record Phase 4 ACP systematic rework (8-axis hardening) Correct the Summary (the device-flow registry stays daemon-global and shared, not per-runtime) and add a section documenting the final architecture: runtime mount factory, routing/trust isolation, raw request-target WS parsing, daemon-global device-flow with event-sink fan-out, primary-only CDP, disposed 503 gate, aggregate getSnapshot, and resolveAcpHttpEnabled-gated capability advertisement. * fix(cli): align /daemon/status ACP counts with the aggregate mount snapshot Code review found a drift: the metrics sampler switched to the aggregate AcpHttpHandle.getSnapshot() (all mounts) while /daemon/status still read the primary-only registry snapshot, so the two observability surfaces diverged under multi-workspace. Extend AcpHttpSnapshot to aggregate all transport counters (connection/session/sse/ws streams + pending client requests) and feed the /daemon/status transport summary from it; per-connection diagnostics and the connection cap stay primary-scoped. Also refresh the device-flow-registry doc comment to the daemon-global shared model. * test(cli): regression-test device-flow on a trusted secondary workspace Locks in the reviewer Critical fix: a trusted secondary workspace's ACP now shares the daemon-global device-flow registry, so device_flow/start reaches provider resolution (an unsupported-provider error here) instead of erroring 'Device flow not configured'. Wires a shared DeviceFlowRegistry into the test harness and drives initialize + device_flow/start over the secondary WebSocket. * docs(design): mark the superseded per-runtime device-flow section Address PR QwenLM#6621 review: the pre-rework 'Per-runtime device-flow registry' section contradicted Systematic rework axis 4 (daemon-global shared registry + fan-out). Flag it as superseded design-history so readers don't build the wrong mental model. * refactor(cli): mount ACP only for trusted secondary workspaces Address PR QwenLM#6621 review suggestions: (1) skip creating a dispatcher/registry/remember-lane for untrusted non-primary workspaces (they are 403-rejected before any mount lookup), so they no longer appear as always-zero entries in the aggregate getSnapshot(); (2) test that a secondary workspace cannot claim the process-wide CDP tunnel (primary-only guard); (3) test that a WS upgrade to an unknown selector is rejected 400. * test(cli): cover device-flow event fan-out across bridges Address PR QwenLM#6621 review: the resolveEventBridges fan-out (the reviewer Critical fix's core delivery path) had zero test coverage. Add unit tests that a device-flow event reaches every resolved bridge, that one bridge throwing does not block the others (best-effort), and that it falls back to the single bridge when no resolver is provided. * fix(cli): report ACP connection pressure across all mounts Address PR QwenLM#6621 review: the connection_capacity_high warning read the primary mount's snapshot only, so a saturated secondary workspace was invisible. Compute the busiest mount from the aggregate snapshot (per-mount cap is uniform, opts.maxConnections) so any mount nearing capacity triggers the warning. * test(cli): allow acp-http-enabled.ts in the serve process.env guard Fix CI failure on PR QwenLM#6621: the serve process.env guard flagged the new acp-http-enabled.ts as a direct process.env reader. It is the QWEN_SERVE_ACP_HTTP interpreter extracted from index.ts and serve-features.ts (both already allow-listed); QWEN_SERVE_ACP_HTTP is a daemon-level process-global toggle, so the file inherits their allow-list entry. * docs: harden workspace-qualified ACP design Co-authored-by: Qwen-Coder <[email protected]> * docs: plan workspace-qualified ACP hardening Co-authored-by: Qwen-Coder <[email protected]> * fix(cli): align workspace-qualified ACP routing Co-authored-by: Qwen-Coder <[email protected]> * fix(cli): harden qualified ACP request errors Co-authored-by: Qwen-Coder <[email protected]> * test(cli): cover unmarked URIError fallback Co-authored-by: Qwen-Coder <[email protected]> * fix(cli): make ACP disposal terminal Co-authored-by: Qwen-Coder <[email protected]> * fix(cli): aggregate ACP connection diagnostics Co-authored-by: Qwen-Coder <[email protected]> * chore: remove review process artifact Co-authored-by: Qwen-Coder <[email protected]> * fix(cli): address workspace ACP review feedback Co-authored-by: Qwen-Coder <[email protected]> * fix(cli): finish ACP review follow-ups Co-authored-by: Qwen-Coder <[email protected]> --------- Co-authored-by: Shaojin Wen <[email protected]> Co-authored-by: qwen-code-dev-bot <[email protected]> Co-authored-by: Qwen-Coder <[email protected]> --------- Co-authored-by: qwen-code-dev-bot <[email protected]> Co-authored-by: Shaojin Wen <[email protected]> Co-authored-by: qqqys <[email protected]> Co-authored-by: qwen-code-dev-bot <[email protected]> Co-authored-by: qwen-autofix[bot] <qwen-autofix[bot]@users.noreply.github.com> Co-authored-by: nas <[email protected]> Co-authored-by: Tianyuan <[email protected]> Co-authored-by: han <[email protected]> Co-authored-by: ytahdn <[email protected]> Co-authored-by: ytahdn <[email protected]> Co-authored-by: jinye <[email protected]> Co-authored-by: Qwen-Coder <[email protected]>


What this PR does
Adds an optional DingTalk channel setting that mentions the group-message sender in the bot's reply. When a mention is available, the reply uses plain text so the first visible token is a clickable DingTalk @ mention; replies without a mention continue to render as Markdown. It also preserves the sender association through queued prompts and streamed response blocks, and provides opt-in diagnostic logging for mention delivery results.
Why it's needed
Markdown payloads can request a DingTalk mention but do not display it as a visible clickable @ token. Users need an actual visible mention at the beginning of a reply without losing Markdown rendering for conversations where a mention does not apply.
Reviewer Test Plan
How to verify
Configure
atSender: truefor a DingTalk group channel, @ the bot, and send a short prompt. Confirm that the response is one plain-text message beginning with a clickable @ of the sender followed by the response body. Send a prompt without a resolvable staff ID, from a direct message, or with the setting disabled; confirm that the response remains Markdown. For a long reply, confirm each text payload stays within DingTalk's 3800-character limit, only the first payload mentions the sender, and the reassembled text is unchanged.Evidence (Before & After)
Before: the DingTalk API accepted mention metadata on Markdown responses, but the client did not display a visible clickable @ token. After: mentioned group replies use one plain-text response beginning with the visible @ token; responses that do not mention a sender retain Markdown rendering. Focused adapter tests cover normal, queued, long, block-streamed, disabled, and cleanup paths.
Tested on
Environment (optional)
Local Node.js workspace. Verified with the DingTalk adapter test suite, project build, typecheck, and CLI bundle.
Risk & Scope
atSenderis opt-in and defaults to disabled.Linked Issues
None.
中文说明
此 PR 的改动
为钉钉 channel 增加可选配置:机器人回复群消息时 @ 原提问者。能够 @ 时,回复使用普通文本,使第一段内容显示为可点击的钉钉 @;不需要 @ 的回复继续使用 Markdown。改动同时保证排队提示词和流式回复块仍能关联到正确的提问者,并提供可选的 @ 投递结果诊断日志。
为什么需要
钉钉 Markdown 消息虽然可以携带 @ 元数据,但客户端不会把它展示为可见、可点击的 @。用户需要在回复开头看到真实的 @,同时在不适用 @ 的对话中保留 Markdown 渲染。
审阅测试方案
如何验证
为钉钉群 channel 配置
atSender: true,@ 机器人并发送一个短问题。确认回复是一条普通文本消息,开头为可点击的提问者 @,后面紧跟回复正文。发送没有可解析 staff ID 的消息、私聊消息,或关闭该配置后发送消息;确认回复仍是 Markdown。对于长回复,确认每个普通文本消息都不超过钉钉 3800 字符限制,只有第一条 @ 提问者,且拼接后的正文完全不变。证据(前后对比)
改动前:钉钉 API 会接受 Markdown 回复上的 @ 元数据,但客户端不会显示可见、可点击的 @。改动后:需要 @ 的群回复使用一条以可见 @ 开头的普通文本;不 @ 提问者的回复保留 Markdown 渲染。适配器测试覆盖普通、排队、长文本、流式、关闭配置和清理路径。
测试环境
环境(可选)
本地 Node.js workspace。已验证钉钉适配器测试、项目构建、类型检查和 CLI 打包。
风险与范围
atSender为显式开启,默认关闭。关联 Issue
无。