-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
TUI /sessions list: gateway-injected inbound metadata block used as session title (shows 'untrusted metadata' for all sessions) #39722
Copy link
Copy link
Open
BingqingLyu/openclaw
#148Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.User-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.User-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Type
Fields
Priority
None yet
Summary
Every session in the TUI
/sessionslist displaysSender (untrusted metadata):…as its title (truncated by the TUI column width to showuntrusted metadata). Affects all sessions routed through the gateway client.Version
2026.3.2Root cause (two bugs)
Bug 1 —
extractFirstUserMessageFromTranscriptChunkdoes not strip the injected inbound metadata blockThe gateway prepends an inbound context block to every user message before it is written to the transcript:
[Sun 2026-03-08 06:03 EDT] actual user message text here
entryis the inner session file metadata. ThedisplayNamevalue ("openclaw-tui") is on the outer session record (rest.displayNameinlistSessionsFromStore), not onentry. The guard never fires, so every gateway session falls through tofirstUserMessage.Evidence:
sessions_listAPI returns"displayName": "openclaw-tui"correctly on the outer record;entry.displayNameisundefined.Reproduction
openclaw-tui) and send one message/sessionsin the TUISender (untrusted metadata):…as titleExpected behaviour
Session title should show:
entry.displayNameor outer recorddisplayName(whichever is populated) —"openclaw-tui"in this casesubject, then a stripped/sanitised excerpt of the actual user message (with the inbound metadata envelope removed)Suggested fixes
Fix 1 (Bug 2 — quick): In
deriveSessionTitle, also accept the outer record'sdisplayNameas a parameter or merge it intoentrybefore the call.Fix 2 (Bug 1 — correct): In
extractFirstUserMessageFromTranscriptChunk/extractTextFromContent, strip the inbound metadata envelope pattern before returning the title candidate. The envelope is consistently formatted:Strip everything up to and including the closing fence + blank line, then take the remainder as the message text.
Fix 3 (defence-in-depth):
DERIVED_TITLE_MAX_LENis 60 chars. Even after the above fixes, the title should preferdisplayName/subjectover raw message content for gateway sessions where those fields are populated.Additional note: session name length in TUI
Even with a correct title, 60 chars is too wide for the TUI's session column in typical terminal widths. The formatted label is
${title} (${formattedKey})which pushes total visible width well past a standard 80-col pane. Consider a shorterDERIVED_TITLE_MAX_LEN(e.g. 32–40) or truncation at render time based on actual column width.