Repository navigation
fix(matrix): deliver explicit reasoning notices - #128254
gaoanze888 wants to merge 19 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed September 2, 2026, 2:12 PM ET / 18:12 UTC. ClawSweeper reviewWhat this changesThe branch delivers Matrix reasoning notices according to the resolved visibility mode and serializes them before later reply output. Merge readiness⛔ Blocked before merge - 6 items remain The branch is a credible fix for the linked Matrix reasoning-delivery regression and no introduced correctness defect was found, but it remains unready to merge until a Plugin SDK owner accepts the new public callback and final-head Matrix transport proof covers the added CLI closure boundaries. Priority: P1 Review scores
Verification
How this fits togetherMatrix receives agent progress and final replies through its channel plugin. The shared reply runner resolves reasoning visibility and invokes Matrix callbacks, which enqueue Matrix notices before ordinary reply delivery. flowchart LR
A[Agent progress] --> B[Shared reply runner]
B --> C[Resolved reasoning mode]
C --> D[Matrix delivery queue]
D --> E[Reasoning notice]
D --> F[Tool and final replies]
Decision needed
Why: The callback is publicly re-exported and documented, so its compatibility and ownership cannot be resolved solely from this PR's Matrix behavior. Before merge
Agent review detailsSecurityNone. PR surfaceSource +75, Tests +627, Docs +4. Total +706 across 21 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Accept the documented generic SDK callback only if its owning reviewer agrees it is the right permanent seam, then attach a redacted final-head MatrixClient trace proving notice order and mention safety. Do we have a high-confidence way to reproduce the issue? Yes from source: current main suppresses typed Matrix reasoning before delivery, while this branch introduces the typed notice path; no local live run was performed under the read-only review constraint. Is this the best way to solve the issue? Unclear: the Matrix owner implementation is coherent, but the public SDK contract needs owner acceptance and the final commit needs exact-head transport evidence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1212f991db46. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (24 earlier review cycles; latest 8 shown)
|
This comment was marked as spam.
This comment was marked as spam.
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
This comment was marked as spam.
This comment was marked as spam.
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
This comment was marked as spam.
This comment was marked as spam.
|
🦞🧹 I asked ClawSweeper to review this item again. |
This comment was marked as spam.
This comment was marked as spam.
|
🦞🧹 I asked ClawSweeper to review this item again. |
This comment was marked as spam.
This comment was marked as spam.
|
🦞🧹 I asked ClawSweeper to review this item again. |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
|
🦞👀 Re-review progress:
|
Closes #81892
What Problem This Solves
Fixes Matrix reasoning delivery so explicitly tagged reasoning is delivered as Matrix notices instead of being suppressed, while unflagged reasoning-looking text remains hidden.
Why This Change Was Made
Matrix now opts into explicit reasoning payloads and delivers them through a separate notice path. Stream-mode reasoning buffers the latest reasoning text and sends it when the reasoning block ends, without overwriting the active answer draft.
Reasoning notice delivery is tracked by the Matrix reply dispatcher and drained before final reply delivery, so the reasoning notice cannot be overtaken by the final answer. Reasoning notices also suppress Matrix mention metadata, so
@roomor Matrix IDs inside model reasoning cannot notify room members.User Impact
Users who enable Matrix reasoning can see explicit reasoning output, including
/reasoning streamsummaries, while final answer delivery, draft delivery, and Matrix mention safety remain intact.Evidence
pnpm test extensions/matrix/src/matrix/monitor/handler-reply-dispatcher.test.ts extensions/matrix/src/matrix/monitor/replies.test.ts extensions/matrix/src/matrix/send.test.tspnpm check:changed -- extensions/matrix/src/matrix/send/types.ts extensions/matrix/src/matrix/send.ts extensions/matrix/src/matrix/send.test.ts extensions/matrix/src/matrix/monitor/replies.ts extensions/matrix/src/matrix/monitor/replies.test.ts extensions/matrix/src/matrix/monitor/handler.ts extensions/matrix/src/matrix/monitor/handler-reply-dispatcher.ts extensions/matrix/src/matrix/monitor/handler-reply-dispatcher.test.tsSafety / ordering proof:
sendMessageMatrix(..., { msgtype: "m.notice", disableMentions: true })m.mentionswhendisableMentionsis true@room/@alice:example.orgwithdisableMentions: trueand asserts the event remainsm.noticewithm.mentions: {}AI-assisted implementation; I reviewed Matrix reasoning delivery, active-draft behavior, mention handling, ordering, and validation output.
Exact-head Matrix transport proof
On head
a90f2c26680913993eacf08d1827b7c1f4f4b42c, a real repositoryMatrixClientsent events through an isolated loopback HTTP homeserver. The proof exercisedcreateMatrixReplyDispatcherfor all three configured reasoning modes and captured the homeserver PUT bodies.offm.textfinal; no reasoning eventonm.noticedurable reasoning, then onem.textfinalstreamm.noticestream-end reasoning, then onem.textfinalBoth reasoning notices contained
"m.mentions": {}even though the input included@roomand a Matrix user ID. The script asserted event counts and mention suppression and exited 0. The access token, loopback port, room ID, and user ID were disposable proof-only values.Follow-up validation: session-store read errors now fail closed to
off, and reasoning notices use one serialized delivery queue. A two-window regression proves both notices complete in source order before the final reply.