Skip to content

fix(chat): preserve native mentions in quote reply JSON - #1550

Open
Effet wants to merge 3 commits into
DingTalk-Real-AI:mainfrom
Effet:codex/fix-quote-reply-mention-encoding
Open

Effet wants to merge 3 commits into
DingTalk-Real-AI:mainfrom
Effet:codex/fix-quote-reply-mention-encoding

Conversation

@Effet

@Effet Effet commented Oct 23, 2026 •

Copy link
Copy Markdown

Summary

Personal quote replies sent with chat +messages-reply --at-open-dingtalk-ids can display a literal <@ID> instead of a native mention. The shared quote encoder HTML-escapes the marker inside the nested content JSON; the gateway does not recognize that representation. Reuse jsonutil.Marshal, matching the working atomic reply path:

 ChatQuoteContent
-  json.Marshal       -> {"content":"\u003c@ID\u003e ...", ...}
+  jsonutil.Marshal   -> {"content":"<@ID> ...", ...}

Full CI also exposed a pre-existing build prerequisite failure: host PE inspection tools reject the checksum-pinned Windows arm64 DLL, so Linux make build stops before tests run. Verify the PE signature and little-endian COFF Machine field directly using POSIX od, independent of host tool guesses. Checksum and export verification remain intact; wrong architectures and malformed headers fail closed.

Risk tier

  • Documentation-only
  • Standard
  • High-risk: includes a cross-platform runtime-payload build-verification fix; stable package graph and unchanged payload binaries.

Verification

  • Release fragments: .changes/chat-quote-mention-json-encoding.md and .changes/runtime-payload-pe-unknown-architecture.md.
  • ./scripts/policy/check-release-fragments.sh origin/main HEAD — passed. Release-seal validation is N/A; CHANGELOG.md is untouched.
  • Quote wire red/green: the new helper and shortcut tests fail on escaped member/all markers on the unmodified base and pass after the encoder fix. Tests inspect the nested JSON before decoding, then verify all decoded quote fields.
  • DWS_PACKAGE_VERSION=0.0.0-test go test -race ./internal/helpers ./internal/shortcut/chat -run 'TestCrossPlatformCoverage(ChatQuoteContentPreservesMentionMarkers|ReplyMentionPreservesWirePlaceholders)$' -count=1 — passed.
  • Live isolation: otherwise identical quote requests show raw IDs with escaped markers and native blue mentions with literal markers. Installed v1.0.63 atomic replies and a candidate built from this PR both pass native-client inspection, send-status lookup (SUCCESS) and message-ID readback.
  • PE architecture red/green: the previous tool-based check rejects a valid arm64 DLL when the host tool guesses x86-64. DWS_PACKAGE_VERSION=0.0.0-test go test ./test/scripts -run '^TestRuntimePayloadPE' -count=1 — all 15 scenarios pass with direct PE verification, including wrong Machine fields, malformed signatures, truncated headers, strict mode and unsupported/misidentifying host tools.
  • sh -n scripts/policy/check-runtime-payload.sh and make build — passed, including payload verification and attachment.
  • go vet ./test/scripts and affected chat packages — passed.
  • git diff --check — passed.
  • Full local suite: DWS_PACKAGE_VERSION=0.0.0-test GIT_CONFIG_NOSYSTEM=1 GIT_CONFIG_GLOBAL=/dev/null go test ./... -count=1 -timeout=10m is running; expanded CI reruns the full gates. An initial release-script run hit two fixture-hook failures caused by this machine's global core.hooksPath; both pass with the isolated Git configuration used by the full run.
  • Generated drift and command-surface checks: N/A; no generator inputs or CLI parameters change. Package-manager install behavior is unchanged; existing package/release tests run in CI.

Notes

replyMsgType remains text; changing it is unnecessary. JSON round-trip coverage includes quotes, newline, backslash, angle brackets and ampersand. This follows up on the mention support in #881.

Merge Danger

Door: two-way; no persistent data or payload binary changes.

Blast Radius: personal-quote-content serialization and runtime-payload architecture verification during builds/releases.

auto-merge was automatically disabled October 24, 2026 03:00

Head branch was pushed to by a user without write access

@github-actions
github-actions Bot requested a review from haofeng0705 October 24, 2026 03:00
auto-merge was automatically disabled October 24, 2026 03:09

Head branch was pushed to by a user without write access

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant