Repository navigation
fix(matrix): stop seeding new thread sessions from the room transcript - #177272
Conversation
|
🦞👀 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. What this changesStops new Matrix threads from copying the room transcript while preserving model ancestry and thread-root context. Example: After discussing “remember lantern” in a Matrix room, start a thread under a separate “Plan lunch” message.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a demonstrated Matrix thread-isolation bug that remains on current main, with no actionable defect found in the narrowed patch. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherMatrix inbound context assembly supplies session routing facts to the shared reply pipeline, which initializes transcripts, selects models, and sends agent requests. flowchart LR
A[Matrix thread event] --> B[Matrix context owner]
B --> C[Thread session routing]
B --> D[Descriptive model parent]
C --> E[Shared session initialization]
D --> F[Model selection]
E --> G[Thread model request]
F --> G
Technical reviewBest possible solution: Land the focused Matrix route-fact correction once the existing required checks finish successfully. Do we have a high-confidence way to reproduce the issue? Current-main source directly requests the transcript fork, and the supplied real-Matrix main-versus-candidate captures independently demonstrate its effect; no target code was executed during this review. Is this the best way to solve the issue? This is the smallest complete fix: correct the parent facts at the existing Matrix context owner while retaining shared lifecycle, model-selection, binding, and root-context implementations. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f461e03db240. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +2, Docs +1. Total +3 across 2 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (18 earlier review cycles; latest 8 shown)
Reviewed October 31, 2026, 2:27 AM ET / 06:27 UTC (Revision 19). |
|
Thanks for the thorough review — both findings are correct and this revision addresses them. [P2] Tombstone recovery — fixed by separating transcript inheritance from recovery replacement in the shared lifecycle, as suggested:
[P3] Model fallback claim — the review is right and the PR body is corrected: stored model overrides resolve through the derived parent of the Removed Merge conflicts: GitHub's Real behavior proof (shipped entry point, real core builder + real finalize): On base @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Resolve conflict in src/channels/inbound-event/context.test.ts: adopt upstream's refactored lean fixture and toMatchObject assertions, replaying this PR's recoveryParentSessionKey contract assertions.
|
Merged Conflict resolution (1 file)
Resolved diff vs upstream is exactly the two PR-specific additions; production path ( Local verification (node 26.12.1 — upstream raised the floor to
|
|
🦞👀 Re-review progress:
|
|
CI attribution for the new head Failure
Attribution: upstream-side, unrelated to this PR's diff
All other 128 checks on this run pass or skip. Not rerunning/patching from this side (not a maintainer); flagging for attribution. If maintainers prefer, a rerun of the failed shard should clear it. |
Run 40249960625 failed in extensions/slack monitor shard (provider.auth-test-token.test.ts, StateDatabaseMaintenanceScopeError lease race) - a shared-infra flake unrelated to this PR's matrix/ auto-reply diff, as attributed in comment 6406439785. No code changes; this empty commit refreshes all check runs.
|
Pushed an empty commit ( |
Re-review requested for current head
|
|
🦞👀 Re-review progress:
|
Compatibility surface documented for the
|
|
🦞👀 Re-review progress:
|
Responding to ClawSweeper Revision 15 (finding [P3] — additive public contract)Thanks for the careful read. You're right: the previous compatibility section claimed the public plugin contract is unchanged because no file under What changed in the PR body (no code change): The "Compatibility surface of the new route fact" section now states this is an additive, backward-compatible public API change, not a contract freeze:
Why it's safe / backward-compatible:
Owner decision (contributor recommendation): accept the narrowly scoped optional field. It preserves existing The patch itself is unchanged and CI remains green on head @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Requesting an owner decision — the latest ClawSweeper review (head
@steipete @obviyus — could you confirm or reject this contract addition? Minimal context for the decision: What the contract is. One new optional route fact, Why it exists. Without it, the shared reply pipeline cannot distinguish three parent roles that must not blur: ordinary transcript inheritance, descriptive model ancestry, and guarded recovery replacement. Issue #176224: seeding a new thread session from the room transcript let recovered sessions inherit foreign context; the fix rejects implicit inheritance and requires this explicit source for authorized recovery. Compatibility posture.
If the owner prefers a different shape (e.g. keeping recovery entirely Matrix-plugin-internal), the reviewer's own technical review concluded the shared-lifecycle-owner + optional fact is the best available solution, so we'd want that called out explicitly before we rework. Absent an objection, we consider the contract accepted once a maintainer states approval here. |
|
Media proof link fix — the reviewer-side "blocked GIF host" should now be resolved. The previous primary link was a fork release asset: The same 292 KB recording ( That is a @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Conflict resolution takes the upstream side for the three restart-tombstone files: upstream openclaw#185730 (refactor: resume running sessions after graceful restarts) removed the restart recovery-admission machinery this PR's recovery-parent contract was built against. The thread-isolation core (Matrix handler route facts) survives the merge via auto-merge and is stripped of the now-consumerless recovery key in the following commit.
… facts Upstream openclaw#185730 (refactor: resume running sessions after graceful restarts) removed the restart recovery-admission machinery, so the recoveryParentSessionKey contract this PR introduced has no consumer left on main. Drop the whole recovery-parent chain — RouteFacts field, inbound-context pass-through, admission-evidence scope key, MsgContext entry, guarded replacement admission, and its tests — and keep only the isolation fix: Matrix thread routes carry parentSessionKey: undefined (no room-transcript fork) plus the descriptive modelParentSessionKey. The remaining diff touches no public contract; the bug from openclaw#176224 is still present on main (thread routes still fork the room session).
|
Rebased and adapted to upstream #185730 — the PR is now a single-purpose isolation fix with no public-contract surface. Why the adaptation. What changed on the branch (head
New diff: 4 files, +95/−2 — handler route facts, handler tests, one docs line. No Verification on the adapted head: @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Independent real-Matrix proof for exact head Exercised boundarySecretless Linux arm64 Docker, Node 24.22.1, and the repository's maintained real Tuwunel v1.9.3 Matrix homeserver ( Both source archives use the canonical full runtime build, including its external-plugin local-dist producer. User flow and captured model inputEach independent run posts two ordinary room turns containing unique private-to-the-room synthetic markers, posts a third room message as the thread root, then sends the first message of a new ordinary Matrix thread. The capture includes both earlier user markers and their assistant-reply markers, not just one word or a context flag.
Thus both main runs copy the room conversation into the first thread turn; both exact-head candidate runs contain only the new thread input plus its allowed root context and generated runtime context. Full request bodies and stage-to-request identities are retained locally. Preservation controlsAll four runs also complete these real channel flows:
Activity-recap requests are retained separately from the six primary tool-bearing agent requests per run; they were not disabled or mistaken for duplicate user turns in the completed captures. Checks, scope and limits70 existing tests passed across three Matrix consumer files (handler, binding route and routing), and scoped formatting passed. Final introduced delta: production +3/-1, docs +1/-0, tests +0/-0, no test-budget allocation. The contributor's original commits are retained. Simplification removes the single-use parent variable and repeated comments; the existing conditional is passed directly as Cleanup limitation: all four Gateways logged application shutdown completion (640–968 ms), but the spawned CLI process groups had not exited by the driver's 30-second cleanup deadline, so the driver killed the remaining groups on both main and candidate. These forced-cleanup receipts remain explicit; no clean OS-exit claim is made. A final container census shows only init/sleep, with no live proof/Gateway children. The local homeserver and build volume remain retained. Excluded setup attempts are preserved: restricting bundled build IDs could not select downloadable Matrix and then omitted browser help metadata; the canonical full build resolved that. A local-archive install attempt collided with the canonical already-staged Matrix implementation, so completed runs use the explicitly inspected local-dist artifact instead. The first fixture config used retired model-policy syntax, and early request counting included auxiliary recap calls; the completed runs use canonical configuration and distinguish primary versus auxiliary requests without changing product behavior. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
CI red on
|
Exact-head CI follow-upHead: The initial QA profile 6/6 attempt timed out in Focused local replay through canonical full private-QA runtime builds passed on both the exact candidate and the same source with only One maintainer-authorized rerun of the failed QA job then passed on the unchanged head: No further push or rerun was made. Current checks have no failures or cancellations; two earlier auto-response jobs were cancelled (not test coverage). The real Matrix/Gateway before-and-after proof and controls and 5/6 exact-head review still apply. |
|
Landed in 5a6d22c. Thanks @Linux2010. New Matrix threads no longer pull in the room transcript. |
Fixes #176224
What Problem This Solves
An ordinary new Matrix thread requested a fork of the room transcript by passing its room session as
parentSessionKey. That copied unrelated room user/assistant turns into the thread's first model prompt instead of starting with isolated thread history and the allowed root context.User Impact
New ordinary thread sessions start isolated, preserving the thread-isolation contract from #57995. Thread-root context and reply placement remain intact. Existing threads retain their own conversation; their saved transcripts are not rewritten.
Why This Change Was Made
Matrix now explicitly clears the transcript-fork parent and passes the same existing conditional room key through the SDK's already-supported descriptive
modelParentSessionKey. This preserves model ancestry without copying conversation content. Thread-root resolution, session-key construction and binding selection are unchanged. No SDK, schema, option or global channel policy change is included.The contributor's commits are retained. Simplification removes a single-use variable and repeated comments, keeping the distinction at the existing Matrix context owner.
Evidence
Independent real-Matrix model-input captures and preservation controls.
a4b07c63b60cf3a971c824064c82946c530e1686and exact candidate9977dd1529666fbbc3723a078809e1f3b8cd7073, independently built in secretless Linux arm64 Docker, Node 24.22.1.opsrather than the default agent; a real room-session model override is inherited by both new and existing thread turns on both builds.Selected source-checkout Matrix local-dist artifacts and their complete emitted graph digests are recorded in the evidence. This is not an encrypted-Matrix or registry-package-install qualification. All four Gateways logged application shutdown completion, but their CLI process groups required the harness's forced cleanup after 30 seconds on both arms; that limitation is disclosed, and no live proof children remain.
Merge Danger
Two-way code door with retained conversation history: reverting restores future fork requests, but neither this fix nor its revert rewrites transcripts of already-created threads. No schema/config migration occurs, and previously copied room content is not retroactively removed. Blast radius is Matrix thread context: an incorrect parent distinction could lose model ancestry or mix conversation histories. Real routing, model-override, root and existing-thread controls are retained in the linked proof.