Skip to content

refactor(matrix): share draft fallback delivery - #144840

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/matrix-reply-fallback-rank142
Sep 13, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/matrix-reply-fallback-rank142

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 11, 2026 •

Copy link
Copy Markdown
Member
Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

Maintainer-requested cleanup of Matrix streamed reply delivery. Draft replacement and final delivery need consistent fallback behavior; maintaining equivalent delivery callbacks separately makes future fixes easier to apply unevenly. This is preventive maintenance, not a claim of an observed user-facing defect.

Why This Change Was Made

Move the existing private async deliverFallback callback immediately after the inactive-draft early return and reuse it for draft replacement. Its body, captured values, awaited delivery, and existing completion path stay unchanged.

The change is confined to one dispatcher file. No API, SDK, import/export, configuration, dependency, authentication, or encryption-policy changes are included.

User Impact

No user-visible behavior change is intended. Matrix reply routing, thread and reply targets, media handling, and delivery sequencing retain their existing behavior. The shared callback reduces maintenance duplication without introducing another abstraction.

Evidence

  • The same four existing test partitions passed before and after: 89 handler-streaming, 22 reply, four delivery-trace, and one selected sender case, totaling 116 executed cases per version. Skipped cases are not counted. This is PASS/PASS characterization, not RED/GREEN bug evidence.
  • All 24 selected check components passed, including six Doctor contract cases, production/test typechecks, formatting, lint, boundaries, and three dead-code scopes with zero entries.
  • Independent review completed with no actionable findings; the signed commit preserves the reviewed one-file diff.
  • Proof is controlled local testing at the recorded checkpoint, not a full-suite or current-main build. Live Matrix/E2EE and unsupported scripted trace faults were not run. Hosted CI passed for exact head cfed65f9d4e66b72c1e3ff04ad01139207005118: https://github.com/openclaw/openclaw/actions/runs/34588133139, including the required openclaw/ci-gate.

@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vincentkoc vincentkoc self-assigned this Sep 11, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review September 11, 2026 10:13
@openclaw-barnacle openclaw-barnacle Bot added channel: matrix Channel integration: matrix size: XS maintainer Maintainer-authored PR labels Sep 11, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 7:24 AM ET / 11:24 UTC (Revision 3).

ClawSweeper review

What this changes

The Matrix reply dispatcher reuses one private fallback-delivery callback for draft replacement and final delivery without changing message behavior.

Merge readiness

✅ Ready for maintainer review

The refreshed review finds no actionable defects. This maintainer-requested cleanup remains useful because current main still contains the duplicated callbacks; the unchanged head has successful CI.

Priority: P3
Reviewed head: cfed65f9d4e66b72c1e3ff04ad01139207005118

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving cleanup with successful exact-head CI and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored private dispatcher refactor is exempt from the external-contributor proof gate and changes no authority. Existing fallback characterization and exact-head CI are supplemental evidence; live Matrix/E2EE behavior was not exercised.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored private dispatcher refactor is exempt from the external-contributor proof gate and changes no authority. Existing fallback characterization and exact-head CI are supplemental evidence; live Matrix/E2EE behavior was not exercised.
Evidence reviewed 6 items Verified introduced change: The pinned merge-base-to-head diff only moves the existing callback and replaces its identical inline counterpart. Captured payload, routing, account, media roots, awaited delivery, and completion paths remain equivalent.
Current-main and release necessity: Current main retains the duplicate callbacks. Its dispatcher blob is c40f2d047d8dcf9121754a33aaec036b33f41786, matching the dispatcher returned by GitHub for v2026.9.4; this cleanup is absent from both.
Release source check: GitHub's v2026.9.4 content endpoint returned the same dispatcher blob as current main.
Findings None None.
Security None None.

How this fits together

The Matrix reply dispatcher receives generated reply payloads and manages their streamed previews. It finalizes previews or sends replacement messages, preserving delivery receipts and retaining previews when replacement fails.

flowchart TD
  A[Generated reply] --> B[Matrix reply dispatcher]
  B --> C{Preview can finalize?}
  C -->|Yes| D[Finalize existing preview]
  C -->|No or edit fails| E[Shared fallback delivery]
  E --> F{Replacement visible?}
  F -->|Yes| G[Redact replaced preview]
  F -->|No| H[Retain preview and delivery receipt]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -13. Total -13 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 15 28 -13
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 15 28 -13

Review metrics

None.

Technical review

Best possible solution:

Keep fallback delivery local to the existing dispatcher, sharing its callback while preserving preview settlement and message-routing contracts.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR explicitly proposes preventive maintenance, not a reproduced user-facing defect.

Is this the best way to solve the issue?

Yes. Reusing the identical private callback removes duplication without adding an abstraction or changing delivery ownership.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against c1191cf5c9b2.

Labels

Label justifications:

  • P3: This is bounded preventive cleanup with no intended user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored private dispatcher refactor is exempt from the external-contributor proof gate and changes no authority. Existing fallback characterization and exact-head CI are supplemental evidence; live Matrix/E2EE behavior was not exercised.

Evidence

What I checked:

  • Verified introduced change: The pinned merge-base-to-head diff only moves the existing callback and replaces its identical inline counterpart. Captured payload, routing, account, media roots, awaited delivery, and completion paths remain equivalent. (extensions/matrix/src/matrix/monitor/handler-reply-dispatcher.ts:182, cfed65f9d4e6)
  • Current-main and release necessity: Current main retains the duplicate callbacks. Its dispatcher blob is c40f2d047d8dcf9121754a33aaec036b33f41786, matching the dispatcher returned by GitHub for v2026.9.4; this cleanup is absent from both. (extensions/matrix/src/matrix/monitor/handler-reply-dispatcher.ts:295, c1191cf5c9b2)
  • Release source check: GitHub's v2026.9.4 content endpoint returned the same dispatcher blob as current main. (extensions/matrix/src/matrix/monitor/handler-reply-dispatcher.ts, 3a9d69db306c)
  • Existing delivery invariant: Settlement still awaits replacement before redaction and retains the draft on failure or suppression. Existing handler tests exercise final-edit and generic fallback failures, including preservation of the visible draft receipt. (extensions/matrix/src/matrix/monitor/handler.test.ts:4100, cfed65f9d4e6)
  • Feature-history routing: Current-main path history includes joshavant's preview-retention work and Peter Steinberger's later reply-target maintenance. GitHub independently returned joshavant as author and committer of the retention change. Deeper local blame encountered unavailable history objects, so no definitive introduction attribution is asserted. (extensions/matrix/src/matrix/monitor/handler-reply-dispatcher.ts:128, 4408ceb68e91)
  • Validation and review continuity: GitHub confirms the linked CI run completed successfully for the exact reviewed head. The supplied prior completed review covers this same head and records no findings or published rank-up moves. The body reports 116 characterization cases per version and explicitly disclaims live Matrix/E2EE proof; no tests were executed during this read-only review. (cfed65f9d4e6)

Likely related people:

  • joshavant: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-11T10:22:00.978Z sha cfed65f :: needs maintainer review before merge. :: none
  • reviewed 2026-09-11T17:12:32.979Z sha cfed65f :: needs maintainer review before merge. :: none

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please refresh the completed review for unchanged head cfed65f9d4e66b72c1e3ff04ad01139207005118; its 12-hour freshness window has expired.

@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc
vincentkoc merged commit 09cfbce into main Sep 13, 2026
368 of 369 checks passed
@vincentkoc
vincentkoc deleted the refactor/matrix-reply-fallback-rank142 branch September 13, 2026 12:21
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (1537 commits)
  test: align plugin fixtures with current runtime contracts (#147000)
  refactor(browser): separate session tab tracking from cleanup (#146973)
  fix(tests): make systemd clock fixtures private (#146990)
  fix(linux): retire sleep guards when logind disconnects (#146046)
  refactor(matrix): share draft fallback delivery (#144840)
  fix(sessions): preserve cross-agent replies after reload (#146799)
  test(models): cover quota recovery during catalog discovery (#146708)
  fix(macos): recover browser sign-in when no browser opens (#146787)
  fix(process): prevent one-shot agents exiting while polling (#144268)
  fix(status): label the session inventory as stored (#146979)
  fix: avoid repeated background reads while loading chat (#146953)
  refactor(ui): narrow Skill Workshop proposal context (#146977)
  perf(sessions): keep cleanup responsive and reuse workers (#140897)
  fix(sessions): prevent stranded writers after abort and restart (#146792)
  refactor: reuse deferred owners in Gateway and infra fixtures (#146809)
  fix: prevent queued conversation replies from switching storage (#146984)
  test(ui): preserve nested failure summaries in CI logs (#146864)
  fix(test): respect process memory limits in local scheduling (#146298)
  fix: validate large media data URLs without regexp stack exhaustion (#146972)
  fix(ui): label model usage contributions as messages (#146735)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
* temp/pr-145950: (101 commits)
  refactor(memory-wiki): share freshness result construction (#146935)
  improve(gateway): use metadata projection for presence (#146817)
  test(agents): reuse complete Responses model fixtures (#147015)
  fix(sessions): align the reclamation-memory test with the archive session owner (#147028)
  refactor(terminal): simplify copy-sensitive token checks (#146934)
  refactor(media): remove duplicate spaced path fallback (#146933)
  refactor(cli): reuse command-group names (#146893)
  improve(plugins): reduce JavaScript generation capture work (#146993)
  test: align plugin fixtures with current runtime contracts (#147000)
  refactor(browser): separate session tab tracking from cleanup (#146973)
  fix(tests): make systemd clock fixtures private (#146990)
  fix(linux): retire sleep guards when logind disconnects (#146046)
  refactor(matrix): share draft fallback delivery (#144840)
  fix(sessions): preserve cross-agent replies after reload (#146799)
  test(models): cover quota recovery during catalog discovery (#146708)
  fix(macos): recover browser sign-in when no browser opens (#146787)
  fix(process): prevent one-shot agents exiting while polling (#144268)
  fix(status): label the session inventory as stored (#146979)
  fix: avoid repeated background reads while loading chat (#146953)
  refactor(ui): narrow Skill Workshop proposal context (#146977)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '060e856e5f9df245d63c98990fcb47e18108c6b9': (97 commits)
  refactor(memory-wiki): share freshness result construction (#146935)
  improve(gateway): use metadata projection for presence (#146817)
  test(agents): reuse complete Responses model fixtures (#147015)
  fix(sessions): align the reclamation-memory test with the archive session owner (#147028)
  refactor(terminal): simplify copy-sensitive token checks (#146934)
  refactor(media): remove duplicate spaced path fallback (#146933)
  refactor(cli): reuse command-group names (#146893)
  improve(plugins): reduce JavaScript generation capture work (#146993)
  test: align plugin fixtures with current runtime contracts (#147000)
  refactor(browser): separate session tab tracking from cleanup (#146973)
  fix(tests): make systemd clock fixtures private (#146990)
  fix(linux): retire sleep guards when logind disconnects (#146046)
  refactor(matrix): share draft fallback delivery (#144840)
  fix(sessions): preserve cross-agent replies after reload (#146799)
  test(models): cover quota recovery during catalog discovery (#146708)
  fix(macos): recover browser sign-in when no browser opens (#146787)
  fix(process): prevent one-shot agents exiting while polling (#144268)
  fix(status): label the session inventory as stored (#146979)
  fix: avoid repeated background reads while loading chat (#146953)
  refactor(ui): narrow Skill Workshop proposal context (#146977)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
* temp/pr-137049: (110 commits)
  improve: reduce GitHub OAuth maintenance work for large agent rosters (#147021)
  fix(test): avoid settings lock writer startup timeouts (#147029)
  fix(update): correct backup guidance and cover incident regressions (#147023)
  refactor(gateway): share connection lifecycle across transports (#145950)
  refactor(telegram): share HTML text escaping (#146936)
  perf(build): reduce disk use in UI performance checks (#146687)
  refactor(memory-wiki): share freshness result construction (#146935)
  improve(gateway): use metadata projection for presence (#146817)
  test(agents): reuse complete Responses model fixtures (#147015)
  fix(sessions): align the reclamation-memory test with the archive session owner (#147028)
  refactor(terminal): simplify copy-sensitive token checks (#146934)
  refactor(media): remove duplicate spaced path fallback (#146933)
  refactor(cli): reuse command-group names (#146893)
  improve(plugins): reduce JavaScript generation capture work (#146993)
  test: align plugin fixtures with current runtime contracts (#147000)
  refactor(browser): separate session tab tracking from cleanup (#146973)
  fix(tests): make systemd clock fixtures private (#146990)
  fix(linux): retire sleep guards when logind disconnects (#146046)
  refactor(matrix): share draft fallback delivery (#144840)
  fix(sessions): preserve cross-agent replies after reload (#146799)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (30 commits)
  test: align plugin fixtures with current runtime contracts (#147000)
  refactor(browser): separate session tab tracking from cleanup (#146973)
  fix(tests): make systemd clock fixtures private (#146990)
  fix(linux): retire sleep guards when logind disconnects (#146046)
  refactor(matrix): share draft fallback delivery (#144840)
  fix(sessions): preserve cross-agent replies after reload (#146799)
  test(models): cover quota recovery during catalog discovery (#146708)
  fix(macos): recover browser sign-in when no browser opens (#146787)
  fix(process): prevent one-shot agents exiting while polling (#144268)
  fix(status): label the session inventory as stored (#146979)
  fix: avoid repeated background reads while loading chat (#146953)
  refactor(ui): narrow Skill Workshop proposal context (#146977)
  perf(sessions): keep cleanup responsive and reuse workers (#140897)
  fix(sessions): prevent stranded writers after abort and restart (#146792)
  refactor: reuse deferred owners in Gateway and infra fixtures (#146809)
  fix: prevent queued conversation replies from switching storage (#146984)
  test(ui): preserve nested failure summaries in CI logs (#146864)
  fix(test): respect process memory limits in local scheduling (#146298)
  fix: validate large media data URLs without regexp stack exhaustion (#146972)
  fix(ui): label model usage contributions as messages (#146735)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: matrix Channel integration: matrix maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant