Repository navigation
fix(matrix): preserve selected reply targets inside threads - #139479
Conversation
Distinguish selected replies from compatibility fallbacks at the Matrix relation owner, preserving that distinction through incoming context, delivery receipts, automatic replies, and streamed finalization. Keep the existing thread scenario and verify both relations through an isolated homeserver and Gateway.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 9:10 PM ET / September 6, 2026, 01:10 UTC. ClawSweeper reviewWhat this changesPreserves selected Matrix reply targets within threads, excludes compatibility fallbacks from quoted context and receipts, and replaces streamed previews when the final reply target differs. Merge readiness✅ Ready for maintainer review This PR remains useful: current main still conflates selected thread replies with compatibility fallbacks. The reviewed patch has no actionable correctness findings, and the recorded live Matrix proof supports the repair. Priority: P2 Review scores
Verification
How this fits togetherThe Matrix plugin translates incoming room events into agent context and outgoing answers into Matrix messages. Thread placement and selected reply targets affect chat presentation, quoted context, and delivery receipts. flowchart LR
A[Incoming Matrix event] --> B[Interpret thread and reply metadata]
B --> C[Agent context]
C --> D[Reply or streamed preview]
D --> E[Encode selected reply or fallback]
E --> F[Matrix room message]
E --> G[Delivery receipt]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +27, Tests +66, Docs +2, Other 0. Total +95 across 19 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one Matrix relation owner that preserves selected replies independently of thread placement while retaining automatic compatibility fallbacks. Do we have a high-confidence way to reproduce the issue? Yes, from source: sending both a thread ID and selected reply ID on current main unconditionally marks the reply as a compatibility fallback. This review did not execute a reproduction. Is this the best way to solve the issue? Yes. Centralizing relation encoding and interpretation fixes the protocol distinction at its owner, and the caller migrations preserve automatic fallback behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d85142c70935. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
Move the consumed first-reply fallback case into the existing native send table and retain explicit selected-reply coverage without depending on the private send-option name.
|
Merged via squash.
|
* commit '047587a542ce205ee78354fbd88ba8ec05c07844': (45 commits) chore(ui): refresh control ui locales (#139481) fix(slack): keep prototype-named emoji shortcodes intact (#136374) fix(gateway): deliver upgrade rejection responses under Bun (#139516) refactor(test): simplify catalog guards and fix native report fixture (#139496) fix(macos): prevent dashboard fixture loopback timeouts (#139556) fix(matrix): preserve selected reply targets inside threads (#139479) test(gateway): preserve held-work close failures (#139593) refactor(exec): share package argument scanning (#139560) fix(audit): preserve sequence range validation before numeric decoding (#139587) fix(transcripts): retain capture ownership through failed cleanup (#139572) refactor(models): share selector reference traversal (#139571) perf(agents): classify allowlists without intermediate sets (#138392) chore(release): update appcast for 2026.9.2 (#139575) fix(ci): synchronize cloud retries and board widget input (#139506) fix(plugins): explain SDK incompatibilities after core updates (#139458) fix(voice-call): retain installed WebSocket behavior under Bun (#139567) test(text): consolidate literal sanitizer cases (#139579) test(gateway): observe native drain without a lint exception (#139576) test(memory): consolidate visibility fixtures without policy defaults (#139569) fix(ui): show shimmer skeletons while loading Control UI (#139525) ...
* origin/main: fix(cli): keep note text with Windows and Unicode line endings (#139512) fix(agents): keep isolated completion context on its admitted generation (#139607) fix: avoid declaration builds during source-server updates (#139392) fix(models): keep discovered models after catalog refresh failures (#139357) fix(gateway): record a transcript notice when a run fails before replying (#139439) refactor(ios): reuse shared integer conversion (#139581) fix(sessions): prevent database lock failures during reclamation (#139469) perf(test): reuse transforms within owned scheduler slots (#139553) test(agents): share sparse transcript input fixtures (#139589) chore(ui): refresh control ui locales (#139481) fix(slack): keep prototype-named emoji shortcodes intact (#136374) fix(gateway): deliver upgrade rejection responses under Bun (#139516) refactor(test): simplify catalog guards and fix native report fixture (#139496) fix(macos): prevent dashboard fixture loopback timeouts (#139556) fix(matrix): preserve selected reply targets inside threads (#139479)
* commit 'refs/openclaw/tasks/pr-135167-main': (2467 commits) refactor(ios): reuse shared integer conversion (#139581) fix(sessions): prevent database lock failures during reclamation (#139469) perf(test): reuse transforms within owned scheduler slots (#139553) test(agents): share sparse transcript input fixtures (#139589) chore(ui): refresh control ui locales (#139481) fix(slack): keep prototype-named emoji shortcodes intact (#136374) fix(gateway): deliver upgrade rejection responses under Bun (#139516) refactor(test): simplify catalog guards and fix native report fixture (#139496) fix(macos): prevent dashboard fixture loopback timeouts (#139556) fix(matrix): preserve selected reply targets inside threads (#139479) test(gateway): preserve held-work close failures (#139593) refactor(exec): share package argument scanning (#139560) fix(audit): preserve sequence range validation before numeric decoding (#139587) fix(transcripts): retain capture ownership through failed cleanup (#139572) refactor(models): share selector reference traversal (#139571) perf(agents): classify allowlists without intermediate sets (#138392) chore(release): update appcast for 2026.9.2 (#139575) fix(ci): synchronize cloud retries and board widget input (#139506) fix(plugins): explain SDK incompatibilities after core updates (#139458) fix(voice-call): retain installed WebSocket behavior under Bun (#139567) ...
…#139479) * fix(matrix): preserve selected reply targets inside threads Distinguish selected replies from compatibility fallbacks at the Matrix relation owner, preserving that distinction through incoming context, delivery receipts, automatic replies, and streamed finalization. Keep the existing thread scenario and verify both relations through an isolated homeserver and Gateway. * test(matrix): assert thread fallback at the provider boundary Move the consumed first-reply fallback case into the existing native send table and retain explicit selected-reply coverage without depending on the private send-option name.
Additional instructions
Keep Allow edits from maintainers enabled for this PR.
What Problem This Solves
Fixes an issue where users selecting a Matrix reply target inside a thread would receive an ordinary threaded message without the selected-message quote. Thread compatibility metadata could also appear as quoted context to the agent, and a streamed preview could lose the final answer's explicit reply target.
Why This Change Was Made
One Matrix relation owner now distinguishes selected replies from compatibility fallbacks across outgoing messages, incoming context, and delivery receipts, following the existing Matrix thread-reply contract. Automatic replies and recovery notices retain their fallback behavior, while a draft whose immutable reply target differs from the final answer is replaced.
User Impact
Explicit replies preserve both the thread root and the selected message. Ordinary thread fallbacks remain available to older clients and no longer masquerade as selected quotes in agent context or receipts. No configuration, storage, authentication, or dependency changes are required.
Evidence
sendMessageMatrix→ native Matrix SDK wire probe fails on the baseline's incorrect fallback flag and passes with this change. The recovery-notice control retainsm.notice, fallback metadata, and an accurate receipt.OPENCLAW_BUILD_PRIVATE_QA=1 pnpm buildpassed; the supported CLI refreshed the runtime after the final caller correction.pnpm openclaw qa matrix --provider-mode mock-openai --scenario matrix-thread-nested-reply-shape --output-dir .artifacts/qa30-matrix-thread-gateway-review1 --concurrency 1: 1 passed, 0 failed, 0 skipped. A disposable local Tuwunel homeserver and ephemeral Gateway observed the automatic fallback and the explicit selected reply. Owned containers and ports were cleaned up.{ "scenario": "matrix-thread-nested-reply-shape", "providerMode": "mock-openai", "channelDriver": "live", "total": 1, "passed": 1, "failed": 0, "skipped": 0, "automaticThreadFallback": true, "explicitReplyFallback": false, "threadRootPreserved": true, "selectedReplyPreserved": true }Production: +76/−92 (net −16). Tests and QA support: +176/−67 (net +109). The recorded assertion count drops from 2 to 1; no checks are weakened.