fix(matrix): replace recovered command progress lines#89920
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 12, 2026, 3:02 AM ET / 07:02 UTC. Summary PR surface: Source +249, Tests +929. Total +1178 across 22 files. Reproducibility: unclear. the PR body provides a credible live Matrix sequence and regression scenario, but the current-main failing path was not independently traced in this incomplete review. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Complete the full review of the shared correlation invariant, Codex event contract, all channel callers, scoped policies, tests, current-main behavior, and prepared live proof before deciding whether to merge. Do we have a high-confidence way to reproduce the issue? Unclear: the PR body provides a credible live Matrix sequence and regression scenario, but the current-main failing path was not independently traced in this incomplete review. Is this the best way to solve the issue? Unclear: shared correlation appears directionally appropriate, but the full event contract and sibling channel behavior were not reviewed deeply enough to establish that this is the best fix. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against d4819948f37d. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +249, Tests +929. Total +1178 across 22 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Added redacted after-fix live Matrix transport proof to the PR body: real Matrix Client-Server API send + m.replace edit in a private no-invite proof room, showing the edited m.new_content body contains completed and omits failed. Also reran focused handler test, full handler test, and git diff --check. @clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
/clawsweeper re-review |
|
Land-ready verification after rebase on Local proof run: Focused tests: Matrix QA: CI: GitHub reports Known proof gap: I did not rerun the external production Matrix homeserver proof after the rebase. The PR body has earlier redacted live Matrix transport proof, and this rebase was verified with the Matrix QA homeserver plus the real OpenClaw Matrix gateway path. |
Summary
run openclaw cron -> run jq (agent) failedfrom remaining visible after the command recoversProof
Redacted live behavior that motivated this fix
In a private Matrix room, a tool-progress notice presented a nested tool-chain failure as a live/current failure:
run openclaw cron -> run jq (agent) failedThe private room, sender, Matrix event IDs, cron job ID, exact room label, and surrounding transcript are intentionally omitted. The important user-visible behavior was that Matrix progress rendering made the stale nested failure remain visible even after the underlying work had recovered.
A follow-up check of the underlying cron/run state showed the later run was green, so the remaining bad user experience was Matrix progress state reconciliation: the old failed progress line was not being replaced by later recovered command output.
Here is a screenshot of the same behavior (see the failed message posted after the substantive work which did not actually fail):

Redacted after-fix live Matrix transport proof
First, here is a screenshot of after-fix behavior from the same agent (no more false "failed" message):

Further, I verified the after-fix behavior on 2026-06-07 against a real Matrix homeserver through the Matrix Client-Server API, using the [redacted] bot account in a temporary private proof room with no invites and no user transcript content.
Setup:
41512ac1636d28e4e98d25391d4245b825a5c372Readback proof:
{ "roomId": "[redacted-room-id]", "originalDraftEventId": "[redacted-original-event-id]", "editEventId": "[redacted-edit-event-id]", "beforeDraftBody": "Working\n- `🛠️ redacted command failed`", "editOuterBody": "* Working\n- `🛠️ completed`", "editNewContentBody": "Working\n- `🛠️ completed`", "editRelation": { "rel_type": "m.replace", "event_id": "[redacted-original-event-id]" }, "assertions": { "sameDraftEdited": true, "beforeContainsFailed": true, "afterContainsCompleted": true, "afterOmitsFailed": true, "originalRoomHasNoInvites": true } }This proves the visible Matrix transport operation is an edit of the existing draft event via
m.replace, and the editedm.new_content.bodycontainscompletedwhile no longer containingfailed.Matrix handler regression proof
The regression in
extensions/matrix/src/matrix/monitor/handler.test.tsuses synthetic Matrix identifiers and the public-safe failure string above.Reproduction sequence:
itemId: command-1toolCallId: call-1progressText: run openclaw cron -> run jq (agent) failedfailed.status: completedexitCode: 0completed.failedrun openclaw cron -> run jqThat proves the recovered command progress replaces the stale failed line instead of leaving a fake live failure in Matrix.
Commands run:
pnpm -s exec vitest run --config test/vitest/vitest.extension-matrix.config.ts extensions/matrix/src/matrix/monitor/handler.test.ts -t "replaces recovered Matrix command progress"— 1 passed, 113 skippedpnpm -s exec vitest run --config test/vitest/vitest.extension-matrix.config.ts extensions/matrix/src/matrix/monitor/handler.test.ts— 114 passedgit diff --check— passedRedaction note
No live Matrix room IDs, user IDs, message IDs, cron IDs, room labels, private transcript text, or private job contents are included. The proof uses synthetic identifiers and the minimum public-safe failure string needed to demonstrate the behavior.
Real behavior proof
Behavior addressed: Matrix command-progress drafts used the public
itemIdfor both the command start line and the later command-output line. When those IDs differed for the same command call, the draft kept the stale command-start line instead of replacing it with the completed command-output line.Real environment tested: OpenClaw Matrix QA on rebased head
e220ad3f905, with a real OpenClaw gateway process, Matrix room topology,ghcr.io/matrix-construct/tuwunel:v1.5.1, and mock OpenAI provider. The QA harness captured Matrix room events and verified the preview edit relation.Exact steps or command run after this patch:
Evidence after fix:
Observed result after fix: the Matrix preview contains the completed command line only, and the final Matrix reply replaces the same preview event with
m.replace. The stalematrix-command-progress-startcommand line is gone.Additional before/after check on the same merge helper:
What was not tested: an external production Matrix homeserver was not rerun after the rebase. The PR already includes earlier redacted live Matrix transport evidence, and this rebase rerun used the Matrix QA homeserver plus the real OpenClaw Matrix gateway path.