Skip to content

fix: remove truncated preview from inbound system events#67761

Open
jgallowa07 wants to merge 1 commit intoopenclaw:mainfrom
jgallowa07:fix/system-event-truncation
Open

fix: remove truncated preview from inbound system events#67761
jgallowa07 wants to merge 1 commit intoopenclaw:mainfrom
jgallowa07:fix/system-event-truncation

Conversation

@jgallowa07
Copy link
Copy Markdown

Summary

Removes the truncated 160-char message preview from system event headers for Slack, MS Teams, and Mattermost channels.

Problem

System events were including a truncated preview of the message body:

System: [2026-04-15 21:56:40 MDT] Slack DM from Jared: What I'm saying is that you are can handle this task (you just showed me you can), but starting tomorrow (and including tomorrow), When we're planning the day o

This caused the model to sometimes reference the truncated header instead of the full message body, leading to responses like "your message got cut off at 'day o'" when the full message was delivered correctly.

Solution

System events now only contain the notification label without message content:

System: [2026-04-15 21:56:40 MDT] Slack DM from Jared

The system event's purpose is notification ("a message arrived"), not content delivery. The full message body is delivered separately in the user turn.

Changes

  • extensions/slack/src/monitor/message-handler/prepare.ts — remove preview from system event (keep for debug logging/type compat)
  • extensions/msteams/src/monitor-handler/message-handler.ts — remove preview from system event (keep for debug logging)
  • extensions/mattermost/src/mattermost/monitor.ts — remove preview from system event

Testing

  • pnpm test:extension slack — ✅ 641 tests passed
  • pnpm test:extension msteams — ✅ 862 tests passed
  • pnpm test:extension mattermost — ✅ 316 passed (1 timeout failure unrelated to changes)
  • pnpm build — ✅
  • Pre-commit hooks — ✅

Fixes #67503

@openclaw-barnacle openclaw-barnacle Bot added channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: slack Channel integration: slack size: XS labels Apr 16, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 16, 2026

Greptile Summary

Removes the 160-character truncated message body preview from enqueueSystemEvent calls in the Slack, MS Teams, and Mattermost extension handlers, so system events serve only as arrival notifications rather than partial content deliveries. The preview variable is retained in Slack and MS Teams where it has legitimate downstream uses (debug logging and the Slack return-value shape), and is fully removed from Mattermost where it had no other consumers.

Confidence Score: 5/5

Safe to merge — focused, well-tested fix with no behavioral regressions on the changed path.

All three changed files make the same targeted, correct change. The preview variable is kept only where it has real consumers (debug log on line 806 in MS Teams, debug log on line 829 and return field on line 844 in Slack), and is cleanly removed in Mattermost where it had no other uses. No dead code is introduced. Extension tests passed on all three plugins and the build is clean.

No files require special attention.

Reviews (1): Last reviewed commit: "fix: remove truncated preview from inbou..." | Re-trigger Greptile

@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Apr 27, 2026

Codex review: needs real behavior proof before merge.

Summary
This PR removes Slack and MS Teams inbound message previews from queued system events, updates focused regression coverage, and adds a changelog entry.

Reproducibility: yes. Source inspection gives a high-confidence reproduction path: current main enqueues a 160-character Slack/MS Teams preview into the system-event prompt while separately delivering the full inbound body to the agent payload.

Real behavior proof
Needs real behavior proof before merge: Missing: PR comments show tests/build/checks but no after-fix output from a real Slack or Teams setup; add a redacted screenshot, recording, terminal output, runtime log, or linked artifact to the PR body so ClawSweeper can re-review, or ask a maintainer to comment @clawsweeper re-review if it does not trigger automatically. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, ask a maintainer to comment @clawsweeper re-review.

Next step before merge
No repair PR is needed right now; the remaining blockers are contributor real behavior proof plus exact-head CI gate handling.

Security
Cleared: The diff only narrows channel prompt text and updates tests/changelog; it does not change dependencies, CI, secrets, package resolution, downloads, or privileged execution.

Review details

Best possible solution:

Land the narrow Slack/Teams label-only system-event change after adding real after-fix proof and resolving the exact-head CI gate, while preserving Mattermost's no-user-post-system-event behavior.

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

Yes. Source inspection gives a high-confidence reproduction path: current main enqueues a 160-character Slack/MS Teams preview into the system-event prompt while separately delivering the full inbound body to the agent payload.

Is this the best way to solve the issue?

Yes for the code direction. The latest diff is the narrow maintainable fix for Slack and MS Teams and has dropped the stale Mattermost change, but merge should wait for real behavior proof and green or waived exact-head CI.

Acceptance criteria:

  • Add after-fix real Slack or Teams behavior proof to the PR body with private details redacted.
  • Confirm Real behavior proof passes or is explicitly overridden by a maintainer.
  • Resolve or rerun the failing checks-node-core / checks-node-auto-reply-reply-dispatch lane on head 4db272b29a343282f69631191b1277efca914a6d.
  • Keep targeted coverage for extensions/slack/src/monitor/message-handler/prepare.test.ts and extensions/msteams/src/monitor-handler/message-handler.thread-parent.test.ts.

What I checked:

Likely related people:

  • steipete: GitHub path history shows recent Slack, MS Teams, Mattermost, and system-event/runtime refactors in the affected files and adjacent rendering path; shallow local blame on the affected lines also points to recent mainline maintenance by Peter Steinberger. (role: recent channel/runtime maintainer; confidence: high; commits: 05eda57b3c72, ffe67e9cdc9e, 9180173f9a79; files: extensions/slack/src/monitor/message-handler/prepare.ts, extensions/msteams/src/monitor-handler/message-handler.ts, extensions/mattermost/src/mattermost/monitor.ts)
  • vincentkoc: Recent path history includes Slack hot-path work, Mattermost fixes, and system-event/session-event performance work close to the prompt-event boundary reviewed here. (role: adjacent Slack/Mattermost/system-event maintainer; confidence: medium; commits: ac74a928456d, c0302512d4dd, 468c6a0101e9; files: extensions/slack/src/monitor/message-handler/prepare.ts, extensions/mattermost/src/mattermost/monitor.ts, src/auto-reply/reply/session-system-events.ts)
  • BradGroux: PR discussion says Brad prepared the current rebased head, and GitHub path history shows Brad co-authored recent MS Teams message-handler fixes in the affected area. (role: MS Teams adjacent maintainer and current repair preparer; confidence: medium; commits: eecda912ee75, 0f192710924f; files: extensions/msteams/src/monitor-handler/message-handler.ts, extensions/msteams/src/monitor-handler/message-handler.thread-parent.test.ts)

Remaining risk / open question:

  • External after-fix real behavior proof is absent, and the Real behavior proof check is failing on the exact PR head.
  • The exact PR head has failing auto-reply/core CI annotations outside the touched files; they need confirmation, rerun, or maintainer handling before merge.

Codex review notes: model gpt-5.5, reasoning high; reviewed against fb66a101e272.

System events were including a truncated 160-char preview of the message
body, leading to model confusion when the full message was delivered
separately. The model would sometimes reference the truncated header
instead of the full body.

Now system events only contain the notification label (e.g., "Slack DM
from Alice") without the message content. The preview is retained for
debug logging where applicable.

Fixes openclaw#67503
@BradGroux BradGroux force-pushed the fix/system-event-truncation branch from 8091d60 to 4db272b Compare May 8, 2026 07:46
@BradGroux
Copy link
Copy Markdown
Member

Prepared this one for maintainer review/CI.\n\nChanges made on top of the original patch:\n- Rebased onto current origin/main.\n- Kept the stale Mattermost hunk out because current main already removed that inbound message system-event path.\n- Added focused Teams and Slack regression coverage proving inbound system events no longer include truncated message previews.\n- Added the missing changelog attribution.\n\nPrepared head: 4db272b29a343282f69631191b1277efca914a6d\n\nLocal verification:\n- node scripts/test-projects.mjs extensions/msteams/src/monitor-handler/message-handler.thread-parent.test.ts extensions/slack/src/monitor/message-handler/prepare.test.ts ✅ after final rebase\n- pnpm build ✅ before final rebase\n- pnpm check ✅ before final rebase\n\nFresh CI is running now.

@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. and removed channel: mattermost Channel integration: mattermost labels May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: msteams Channel integration: msteams channel: slack Channel integration: slack size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inbound message envelope header truncates message body, causing model confusion

2 participants