Skip to content

fix(gateway): strip inbound metadata from TUI session titles and prefer external displayName#148

Open
BingqingLyu wants to merge 1 commit into
mainfrom
fork-pr-39790-fix-tui-session-title-metadata-39722
Open

fix(gateway): strip inbound metadata from TUI session titles and prefer external displayName#148
BingqingLyu wants to merge 1 commit into
mainfrom
fork-pr-39790-fix-tui-session-title-metadata-39722

Conversation

@BingqingLyu

@BingqingLyu BingqingLyu commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Fixes openclaw#39722

Summary

Fixes two bugs in TUI session title derivation:

  1. Bug 1: extractTextFromContent did not strip inbound metadata blocks before extracting the first user message, causing session titles to show untrusted metadata instead of actual message content.

  2. Bug 2: deriveSessionTitle only checked entry.displayName but the actual displayName value is on the outer session record, not on entry, causing the guard to never fire and falling through to the first user message.

Changes

  • Added stripInboundMetadata import to session-utils.fs.ts
  • Modified extractTextFromContent to strip inbound metadata blocks before extracting text
  • Updated deriveSessionTitle to accept an optional displayName parameter (external displayName from outer session record)
  • Modified listSessionsFromStore to pass rest.displayName to deriveSessionTitle
  • Added test case to verify external displayName takes precedence over entry.displayName

Testing

  • All existing tests pass
  • New test case verifies external displayName priority
  • Linting passes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI /sessions list: gateway-injected inbound metadata block used as session title (shows 'untrusted metadata' for all sessions)

2 participants