Skip to content

fix(chat): preserve Telegram sender labels in dashboard history#39414

Merged
obviyus merged 2 commits intomainfrom
codex/38989-dashboard-sender-labels
Mar 8, 2026
Merged

fix(chat): preserve Telegram sender labels in dashboard history#39414
obviyus merged 2 commits intomainfrom
codex/38989-dashboard-sender-labels

Conversation

@obviyus
Copy link
Copy Markdown
Contributor

@obviyus obviyus commented Mar 8, 2026

Summary

  • extract inbound sender labels from OpenClaw metadata blocks in the shared metadata helper
  • preserve a top-level senderLabel in the shared gateway chat sanitizer before stripping AI-only metadata from user messages
  • group and label dashboard user message groups by that preserved sender label instead of collapsing everything into a generic "You"

Fixes #38989.

Root cause

The dashboard was stripping inbound Telegram metadata before rendering, but sender attribution only existed inside those AI-only metadata blocks. After sanitization, the UI had no per-message sender identity left, so it grouped consecutive group messages only by role and labeled them as "You".

This patch fixes the shared sanitized message shape instead of reparsing stripped prompt metadata in the UI.

Testing

  • pnpm exec vitest run -c vitest.config.ts src/auto-reply/reply/strip-inbound-meta.test.ts src/gateway/chat-sanitize.test.ts
  • pnpm tsgo
  • pnpm --dir ui exec vitest run --config vitest.config.ts src/ui/views/chat.test.ts src/ui/chat/message-normalizer.test.ts

@aisle-research-bot

This comment was marked as outdated.

@openclaw-barnacle openclaw-barnacle bot added app: web-ui App: web-ui gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Mar 8, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 8, 2026

Greptile Summary

This PR fixes the root cause of missing per-sender attribution in the dashboard chat history for Telegram group messages. It threads a senderLabel field extracted from the AI-only inbound metadata blocks through the full stack — from the shared gateway sanitizer (chat-sanitize.ts) down to the UI grouping logic (chat.ts) and renderer (grouped-render.ts) — so that consecutive messages from different Telegram senders are displayed under their own names rather than collapsed into a generic "You".

Key changes:

  • extractInboundSenderLabel (new export in strip-inbound-meta.ts): Parses the Sender and Conversation info metadata blocks to derive a display name, with a sensible priority order (labelnameusernamee164idconversationInfo.sender).
  • extractMessageSenderLabel / stripEnvelopeFromMessage (chat-sanitize.ts): Extracts and preserves senderLabel on the sanitized message object before the inbound metadata is stripped, so the label survives sanitization.
  • groupMessages (chat.ts): Breaks user message groups on senderLabel changes in addition to role changes, ensuring different senders produce distinct visual groups.
  • renderMessageGroup (grouped-render.ts): Substitutes senderLabel for "You" when present.
  • Test coverage is solid across all layers.

Confidence Score: 5/5

  • This PR is safe to merge. The fix is well-scoped, the approach is correct, and test coverage spans all changed layers.
  • The implementation correctly threads the senderLabel field through the entire stack from metadata extraction through sanitization to UI rendering. The logic is sound, the type changes are minimal and safe, and comprehensive test coverage validates all layers of the change.
  • No files require special attention

Last reviewed commit: 864145c

@obviyus obviyus self-assigned this Mar 8, 2026
@obviyus
Copy link
Copy Markdown
Contributor Author

obviyus commented Mar 8, 2026

pr39414-manual-chat-thread-crop

Seeded a local gateway transcript with two consecutive user messages carrying inbound sender metadata for Iris and Joaquin De Rojas, then opened the dashboard against that session.

Observed:

  • 2 separate user groups rendered
  • footer labels show Iris and Joaquin De Rojas
  • labels are no longer You
  • message bodies show only first / second
  • raw metadata blocks are not visible in the UI

@obviyus obviyus force-pushed the codex/38989-dashboard-sender-labels branch from 864145c to f8c0717 Compare March 8, 2026 03:46
@openclaw-barnacle openclaw-barnacle bot added the cli CLI command changes label Mar 8, 2026
@obviyus obviyus merged commit 5214859 into main Mar 8, 2026
10 checks passed
@obviyus obviyus deleted the codex/38989-dashboard-sender-labels branch March 8, 2026 03:47
@obviyus
Copy link
Copy Markdown
Contributor Author

obviyus commented Mar 8, 2026

Landed via temp rebase onto main.

  • Gate: pnpm check
  • Gate: pnpm build
  • Gate: pnpm exec vitest run -c vitest.config.ts src/auto-reply/reply/strip-inbound-meta.test.ts src/gateway/chat-sanitize.test.ts src/cli/daemon-cli/lifecycle.test.ts
  • Gate: pnpm --dir ui exec vitest run --config vitest.config.ts src/ui/views/chat.test.ts src/ui/chat/message-normalizer.test.ts
  • Land commit: f8c0717
  • Merge commit: 5214859

mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Mar 8, 2026
* main: (290 commits)
  test: stabilize exec resolver timeout fixture
  chore: add changelog and format fix for openclaw#39414
  fix(chat): preserve sender labels in dashboard history
  docs: clean up latest changelog sections
  docs: dedupe changelog contributor attribution
  fix(ci): resolve current gate regressions
  refactor(voice-call): share tts deep merge
  fix: land openclaw#39337 by @goodspeed-apps for acpx MCP bootstrap
  fix(ci): resolve type regressions on main
  fix: document discord agentComponents schema parity (openclaw#39378) (thanks @gambletan) (openclaw#39378)
  fix(discord): validate agentComponents config
  test: cover daemon probe auth seam
  refactor: preserve explicit mock voice-call values
  refactor: register gateway service adapters
  refactor: reuse shared gateway probe auth
  refactor: split daemon status gathering
  refactor: centralize strict numeric parsing
  refactor: normalize voice-call runtime defaults
  fix(ci): pin multi-arch docker base digests
  docs: add changelog for Telegram DM draft restore (openclaw#39398)
  ...
mcaxtr pushed a commit to mcaxtr/openclaw that referenced this pull request Mar 8, 2026
ziomancer pushed a commit to ziomancer/openclaw that referenced this pull request Mar 8, 2026
Saitop pushed a commit to NomiciAI/openclaw that referenced this pull request Mar 8, 2026
GordonSH-oss pushed a commit to GordonSH-oss/openclaw that referenced this pull request Mar 9, 2026
jenawant pushed a commit to jenawant/openclaw that referenced this pull request Mar 10, 2026
dhoman pushed a commit to dhoman/chrono-claw that referenced this pull request Mar 11, 2026
senw-developers pushed a commit to senw-developers/va-openclaw that referenced this pull request Mar 17, 2026
V-Gutierrez pushed a commit to V-Gutierrez/openclaw-vendor that referenced this pull request Mar 17, 2026
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui cli CLI command changes gateway Gateway runtime maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Web Dashboard: Incorrect user attribution for some group members in Telegram sessions

1 participant