Repository navigation
fix(channels): preserve forwarded text and threaded sender commands - #137313
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. Reviewed September 5, 2026, 5:21 PM ET / 21:21 UTC. ClawSweeper reviewWhat this changesPreserves forwarded Discord content, separates sender commands from supplemental channel context, and consolidates reply preparation while retaining Teams history and Slack mention handling. Merge readiness✅ Ready for maintainer review This PR remains necessary: current main and the latest release retain the Discord text-selection defect. The prior Slack and Teams blockers are addressed, and the reviewed candidate has no remaining actionable correctness finding. Priority: P2 Review scores
Verification
How this fits togetherChannel plugins prepare incoming messages, sender command text, and supplemental history for OpenClaw’s shared reply pipeline. That pipeline selects commands and builds the model prompt before dispatching replies. flowchart TD
A[Incoming channel message] --> B[Channel preparation]
B --> C[Sender command text]
B --> D[Forwarded content and history]
C --> E[Authorized command selection]
E --> F[Model prompt assembly]
D --> F
E --> G[Command reply]
F --> H[Agent reply]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -6, Tests +879, Docs +2. Total +875 across 27 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep sender command provenance separate from model context, using plugin-produced facts and the existing shared routing and transcript owners. Do we have a high-confidence way to reproduce the issue? Yes, from source: forwarding a Discord message with empty sender text or a caption reaches an agent-body selection that discards the prepared forwarded content on current main and v2026.9.2; this review did not execute that path. Is this the best way to solve the issue? Yes. Repairing the channel producer and carrying sender-only command selection through shared dispatch avoids whole-prompt rescanning and trailing-text guesses; the Teams preservation marker keeps independent history windows intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e6a0eb9ff39b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (16 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Supplemental maintainer proof for the Discord context boundary: Baseline run on unchanged main Candidate run on This candidate uses the same direct composed-text selection now present in the Discord context owner in |
|
@clawsweeper re-review The forwarding fix now preserves captions and sender-owned command selection through routing and prevents duplicate standalone command dispatch. Head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Addressed the threaded MS Teams regression at head |
Slack renders resolved mentions in sender text and may append attachment context after that text. Shared routing could not reconstruct the sender-owned command source in direct messages or multiline messages, so inline shortcuts were left in the model prompt and their native replies were skipped. Carry the exact rendered sender span from Slack preparation through channel context. Routing accepts that span only when provider mention stripping and normalization reproduce the command body, keeping supplemental or arbitrary context from becoming a command source. Cover channel, direct-message, and multiline attachment shapes through preparation, routing, and dispatch.
08b3b55 to
8aaae89
Compare
|
@clawsweeper re-review Exact head: The Slack direct-message and multiline attachment-context findings are addressed at the producer boundary. Post-rebase validation: 527 focused tests passed; the compiled isolated-Gateway Slack DM proof produced one native help reply, one model request with |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Keep provider-owned Graph thread windows outside canonical transcript eviction while restoring transcript rows separately through inbound history. Cover a populated session at the prepared-turn boundary and assert the final model-facing context retains Graph history, canonical history, and pending backlog.
|
@clawsweeper re-review Exact head: The populated-session Teams finding is fixed. A regression failed on the old behavior because canonical transcript rows evicted both Graph messages, then passed after provider-owned Graph windows were preserved separately. The final model-facing context retains Graph history, canonical history, and pending backlog. Focused owner/sibling suites passed 583/583. Per the author's direction, I stopped the broader repeated gate rather than running another exhaustive cycle; the PR body states that explicitly. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Preserve sender command provenance and supplemental context while removing duplicate reply loading, prompt updates, and Slack routing setup.
|
@clawsweeper re-review The appended maintainer commit preserves the previously reviewed forwarding and command-provenance repairs while removing duplicate reply loading, prompt updates, and Slack routing setup. Combined production delta is now net -6 lines. SDK-owner acceptance covers the optional preservation field. Fresh independent review is clean; focused Testbox suites passed. The PR body records current proof and remaining checks. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Merge main without rewriting contributor commits to repair the exact-head CI failure. Supply the canonical prepared conversation in the sender-command regression fixture.
|
@clawsweeper re-review Head 5601417 merges main without rewriting contributor history and updates the sender-command regression fixture for the current prepared-conversation contract. Fresh independent review is clean; production remains net -6. Current proof is recorded in the PR body. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Merged via squash.
|
…penclaw#137313) * fix(discord): deliver forward-only messages to agents * fix(discord): preserve forwarded text beside captions and commands Use prepared Discord message text while preserving sender-owned command input. Carry selected shortcuts through routing, retain raw sender tails, and keep standalone commands on ordinary dispatch so forwarded context cannot strip content or cause duplicate replies. Co-authored-by: Marvinthebored <[email protected]> * fix: clean directives after threaded context * fix(msteams): keep sender directives separate from thread history Supply Graph thread history through structured channel context so directive cleanup reads the current sender while history, pending backlog and unavailable-media notices remain intact. Replace the trailing-text heuristic and retain the existing thread reply and visibility owners. Preserve Marvinthebored's original commits and subsequent threaded-context fix in the ancestry. Verified through the real compiled Gateway with emulated Teams/Graph and model endpoints, owner tests and changed-path checks. Co-authored-by: Marvinthebored <[email protected]> * fix(slack): keep inline shortcuts after mention rendering Slack renders resolved mentions in sender text and may append attachment context after that text. Shared routing could not reconstruct the sender-owned command source in direct messages or multiline messages, so inline shortcuts were left in the model prompt and their native replies were skipped. Carry the exact rendered sender span from Slack preparation through channel context. Routing accepts that span only when provider mention stripping and normalization reproduce the command body, keeping supplemental or arbitrary context from becoming a command source. Cover channel, direct-message, and multiline attachment shapes through preparation, routing, and dispatch. * fix(msteams): preserve supplemental thread context Keep provider-owned Graph thread windows outside canonical transcript eviction while restoring transcript rows separately through inbound history. Cover a populated session at the prepared-turn boundary and assert the final model-facing context retains Graph history, canonical history, and pending backlog. * refactor(channels): share reply preparation and lazy loading Preserve sender command provenance and supplemental context while removing duplicate reply loading, prompt updates, and Slack routing setup. --------- Co-authored-by: Marvinthebored <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
Related: #137239
What Problem This Solves
Fixes an issue where Discord forwarded messages lose their forwarded text when a sender caption is present. Shared reply routing could also interpret commands in forwarded context or dispatch a sender shortcut twice. Teams thread history and Slack rendered mentions exposed sibling failures in the same command-provenance path. Reported by community members on Discord.
Why This Change Was Made
Discord passes its prepared message text to the agent while preserving sender-only command input. Shared routing selects commands from sender text and carries that decision to dispatch. Teams carries Graph history as structured supplemental context; the optional
sessionTranscriptModefield keeps that provider window independent of canonical transcript enrichment. Slack carries the rendered sender span and exact mention strings through its channel context.The maintainer cleanup removes duplicate lazy-loading wrappers, prompt-body updates, skill lookup options, Slack routing arguments, and the one-use mention mapper. It preserves the existing lazy caches and invalidation, authorization, metadata omission, array copies, and error responses. Whole-prompt rescanning and trailing-text guessing were rejected because they consume quoted commands or fail beside attachment context.
The optional exported preservation field has SDK-owner acceptance. No new configuration option, dependency, schema, protocol version, or storage mechanism is introduced.
User Impact
Forwarded Discord content stays visible beside captions. Sender commands run once, while command-looking quoted content stays intact. Teams retains Graph parent/reply history, canonical history, and pending backlog. Slack shortcuts continue working with rendered mentions, direct messages, multiline text, and display names containing parentheses.
Thanks to @Marvinthebored. Their commits and the existing maintainer improvements remain in the original PR history; this continuation appends a maintainer commit without replacing ancestry.
Evidence
5601417af995c46a9e26bbfdb946f5b9a26dc45d.pnpm check:changed: passed every selected guard, formatting, four typecheck lanes, three dead-export scans, and scoped lint. Testbox command exit 0: https://github.com/openclaw/openclaw/actions/runs/33992782182 . The command result owns the proof; later lease cleanup can mark its hosting workflow cancelled.openclaw/ci-gate: https://github.com/openclaw/openclaw/actions/runs/33992513667 . All fetched checks are successful, skipped, or neutral.git diff --check origin/main...HEAD: passed. Native review artifacts andOPENCLAW_TESTBOX=1 scripts/pr prepare-run 137313passed on this head.The earlier continuation CI run found that main had replaced
groupResolutionwith a prepared conversation. The fixture now uses the canonical producer. An unrelated UI toast timer failure was also observed in that run and did not recur on the final head; no UI source was changed. Initial raw changed-file runs selected unrelated newer-main drift, and source-capsule attempts rejected checkout movement. Final proof used a frozen candidate and completed successfully.Previously accepted compiled Gateway evidence exercised Discord forwarded content, Teams parent/reply history with media and backlog, and Slack rendered-mention command delivery through emulated channel and model endpoints. This continuation does not claim authenticated external-service delivery or a new run of those recordings. Final-head regressions and CI preserve those owner boundaries.
ClawSweeper completed review of the exact final head at 2026-09-05T21:21:07.884Z; native merge validated that receipt. There are no inline review conversations requiring resolution.
Merged as
fc5e53d086a72c50f347b1d6c1fbd0132499ffed. Main ancestry and the landed source were verified; the actual landed production delta remains net -6.