Skip to content

fix(tui): strip inbound metadata blocks from user messages (clean rewrite)#22345

Merged
vincentkoc merged 18 commits intomainfrom
vincentkoc-code/clean-22319-rebase-origin-main
Feb 21, 2026
Merged

fix(tui): strip inbound metadata blocks from user messages (clean rewrite)#22345
vincentkoc merged 18 commits intomainfrom
vincentkoc-code/clean-22319-rebase-origin-main

Conversation

@vincentkoc
Copy link
Copy Markdown
Member

@vincentkoc vincentkoc commented Feb 21, 2026

This is a clean reroute of the closed PR for this change.

  • Reuses the final intended payload from the previously closed work.
  • Rebased onto origin/main and squashed to a single clean commit.
  • This branch is clean and ready for normal review.

This supersedes #22319. The original PR became stale due a detached/dirty head after history churn while attempting rebase/cleanup.

Closes #22276.

Greptile Summary

This PR consolidates duplicate metadata stripping implementations by removing stripInboundMetadataBlocks and switching all callers to use the canonical stripInboundMetadata function from src/auto-reply/reply/strip-inbound-meta.ts.

Key changes:

  • Replaced regex-based stripInboundMetadataBlocks with line-by-line state machine parser stripInboundMetadata
  • Updated src/gateway/chat-sanitize.ts and src/tui/tui-formatters.ts to use the canonical implementation
  • Updated tests to use DEFAULT_EMOJIS constants instead of hardcoded emoji literals (aligns with emoji set change from commit f555835)
  • Included unrelated fix from #086af568 for Discord DM component session key handling
  • Cleaned up CHANGELOG entries to remove duplicates and align with actual PR scope

The consolidation addresses the code duplication issue raised in previous review threads and ensures consistent metadata stripping behavior across TUI, webchat, and gateway surfaces.

Confidence Score: 5/5

  • This PR is safe to merge - it consolidates duplicate code implementations and includes test updates that properly align with recent emoji constant changes.
  • The consolidation successfully removes code duplication by making all callers use the canonical stripInboundMetadata implementation. Test changes correctly reflect upstream emoji constant changes (commit f555835) and Discord component behavior fixes (commit 086af56). The CHANGELOG cleanup removes duplicate entries and properly scopes the description to TUI-specific changes.
  • No files require special attention

Last reviewed commit: e148071

@openclaw-barnacle openclaw-barnacle bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Feb 21, 2026
@vincentkoc vincentkoc force-pushed the vincentkoc-code/clean-22319-rebase-origin-main branch from cafe70b to 1642afc Compare February 21, 2026 02:29
@vincentkoc vincentkoc self-assigned this Feb 21, 2026
@vincentkoc vincentkoc marked this pull request as ready for review February 21, 2026 02:29
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

@vincentkoc
Copy link
Copy Markdown
Member Author

PR #22345 status update (post-rebase)

I rebased this branch onto origin/main and pushed.

  • Branch is now non-draft with a clean 3-commit history.
  • Targeted PR-surface tests pass: src/gateway/chat-sanitize.test.ts + src/tui/tui-formatters.test.ts.

Current merge blocker: CI remains failing in unrelated suites (new/known baseline failures):

Observed failures are not in PR diff (src/gateway/chat-sanitize.ts, src/shared/chat-envelope.ts, src/tui/tui-formatters.ts, CHANGELOG.md) and include:

  • src/web/media.test.ts (local media path policy and cap assertions)
  • src/discord/send.components.test.ts
  • src/discord/monitor/message-handler.process.test.ts
  • src/media-understanding/runner.auto-audio.test.ts
  • src/media-understanding/runner.deepgram.test.ts
  • related extensions/msteams/src/messenger.test.ts

@vincentkoc
Copy link
Copy Markdown
Member Author

Updated PR with Greptile issues addressed:

  • src/shared/chat-envelope.ts now aliases stripInboundMetadataBlocks to the canonical parser from src/auto-reply/reply/strip-inbound-meta.ts, removing duplicate implementation + .trim() behavior drift.
  • src/gateway/chat-sanitize.ts now uses stripInboundMetadata from canonical parser.
  • src/tui/tui-formatters.ts now uses stripInboundMetadata from canonical parser for user text extraction.

This commit has been pushed: 18adc45.

Current CI status still fails in CI -> check because format:check reports:

  • src/agents/tools/common.ts
  • src/channels/plugins/actions/discord/handle-action.guild-admin.ts
  • src/discord/send.channels.ts

Those are unrelated formatting-only drifts and block merge. I created a separate quick PR to fix them:

Once 22391 merges, rerun checks on #22345 and it should move to clean.

@vincentkoc
Copy link
Copy Markdown
Member Author

@greptileai review

@vincentkoc vincentkoc merged commit 35be87b into main Feb 21, 2026
7 of 8 checks passed
@vincentkoc vincentkoc deleted the vincentkoc-code/clean-22319-rebase-origin-main branch February 21, 2026 04:52
ly85206559 pushed a commit to ly85206559/openclaw that referenced this pull request Feb 21, 2026
…rite) (openclaw#22345)

* fix(tui): strip inbound metadata blocks from user text

* chore: clean up metadata-strip format and changelog credit

* chore: format tui metadata-strip tests

* test: align metadata-strip regression expectations

* refactor: reuse canonical inbound metadata stripper

* test: allow tmp media fixture paths in media-understanding tests

* refactor: reuse canonical inbound metadata stripper

* format: fix changelog blank line after headings

* test: fix unrelated check typing regressions

* test: align memory async mock embedding signatures

* test: avoid tsgo mock typing pitfall

* test: restore async search mock typings in merge tree

* test: trigger ci rerun without behavior change

* chore: dedupe todays changelog entries

* fix: dedupe sqlite mock keys in qmd manager test

* Update qmd-manager.test.ts

* test: align chat metadata sanitization expectation
Hansen1018 pushed a commit to Hansen1018/openclaw that referenced this pull request Feb 21, 2026
…rite) (openclaw#22345)

* fix(tui): strip inbound metadata blocks from user text

* chore: clean up metadata-strip format and changelog credit

* chore: format tui metadata-strip tests

* test: align metadata-strip regression expectations

* refactor: reuse canonical inbound metadata stripper

* test: allow tmp media fixture paths in media-understanding tests

* refactor: reuse canonical inbound metadata stripper

* format: fix changelog blank line after headings

* test: fix unrelated check typing regressions

* test: align memory async mock embedding signatures

* test: avoid tsgo mock typing pitfall

* test: restore async search mock typings in merge tree

* test: trigger ci rerun without behavior change

* chore: dedupe todays changelog entries

* fix: dedupe sqlite mock keys in qmd manager test

* Update qmd-manager.test.ts

* test: align chat metadata sanitization expectation
mmyyfirstb pushed a commit to mmyyfirstb/openclaw that referenced this pull request Feb 21, 2026
…rite) (openclaw#22345)

* fix(tui): strip inbound metadata blocks from user text

* chore: clean up metadata-strip format and changelog credit

* chore: format tui metadata-strip tests

* test: align metadata-strip regression expectations

* refactor: reuse canonical inbound metadata stripper

* test: allow tmp media fixture paths in media-understanding tests

* refactor: reuse canonical inbound metadata stripper

* format: fix changelog blank line after headings

* test: fix unrelated check typing regressions

* test: align memory async mock embedding signatures

* test: avoid tsgo mock typing pitfall

* test: restore async search mock typings in merge tree

* test: trigger ci rerun without behavior change

* chore: dedupe todays changelog entries

* fix: dedupe sqlite mock keys in qmd manager test

* Update qmd-manager.test.ts

* test: align chat metadata sanitization expectation
clickmediapropy pushed a commit to clickmediapropy/openclaw that referenced this pull request Feb 22, 2026
…rite) (openclaw#22345)

* fix(tui): strip inbound metadata blocks from user text

* chore: clean up metadata-strip format and changelog credit

* chore: format tui metadata-strip tests

* test: align metadata-strip regression expectations

* refactor: reuse canonical inbound metadata stripper

* test: allow tmp media fixture paths in media-understanding tests

* refactor: reuse canonical inbound metadata stripper

* format: fix changelog blank line after headings

* test: fix unrelated check typing regressions

* test: align memory async mock embedding signatures

* test: avoid tsgo mock typing pitfall

* test: restore async search mock typings in merge tree

* test: trigger ci rerun without behavior change

* chore: dedupe todays changelog entries

* fix: dedupe sqlite mock keys in qmd manager test

* Update qmd-manager.test.ts

* test: align chat metadata sanitization expectation
obviyus pushed a commit to guirguispierre/openclaw that referenced this pull request Feb 22, 2026
…rite) (openclaw#22345)

* fix(tui): strip inbound metadata blocks from user text

* chore: clean up metadata-strip format and changelog credit

* chore: format tui metadata-strip tests

* test: align metadata-strip regression expectations

* refactor: reuse canonical inbound metadata stripper

* test: allow tmp media fixture paths in media-understanding tests

* refactor: reuse canonical inbound metadata stripper

* format: fix changelog blank line after headings

* test: fix unrelated check typing regressions

* test: align memory async mock embedding signatures

* test: avoid tsgo mock typing pitfall

* test: restore async search mock typings in merge tree

* test: trigger ci rerun without behavior change

* chore: dedupe todays changelog entries

* fix: dedupe sqlite mock keys in qmd manager test

* Update qmd-manager.test.ts

* test: align chat metadata sanitization expectation
Copilot AI added a commit to jiulingyun/openclaw-cn that referenced this pull request Feb 22, 2026
mreedr pushed a commit to mreedr/openclaw-custom that referenced this pull request Feb 24, 2026
…rite) (openclaw#22345)

* fix(tui): strip inbound metadata blocks from user text

* chore: clean up metadata-strip format and changelog credit

* chore: format tui metadata-strip tests

* test: align metadata-strip regression expectations

* refactor: reuse canonical inbound metadata stripper

* test: allow tmp media fixture paths in media-understanding tests

* refactor: reuse canonical inbound metadata stripper

* format: fix changelog blank line after headings

* test: fix unrelated check typing regressions

* test: align memory async mock embedding signatures

* test: avoid tsgo mock typing pitfall

* test: restore async search mock typings in merge tree

* test: trigger ci rerun without behavior change

* chore: dedupe todays changelog entries

* fix: dedupe sqlite mock keys in qmd manager test

* Update qmd-manager.test.ts

* test: align chat metadata sanitization expectation
jiulingyun added a commit to jiulingyun/openclaw-cn that referenced this pull request Mar 1, 2026
…s from user messages (#322)

* Initial plan

* fix(tui): strip inbound metadata blocks from user messages (port openclaw#22345)

Co-authored-by: jiulingyun <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: jiulingyun <[email protected]>
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…rite) (openclaw#22345)

* fix(tui): strip inbound metadata blocks from user text

* chore: clean up metadata-strip format and changelog credit

* chore: format tui metadata-strip tests

* test: align metadata-strip regression expectations

* refactor: reuse canonical inbound metadata stripper

* test: allow tmp media fixture paths in media-understanding tests

* refactor: reuse canonical inbound metadata stripper

* format: fix changelog blank line after headings

* test: fix unrelated check typing regressions

* test: align memory async mock embedding signatures

* test: avoid tsgo mock typing pitfall

* test: restore async search mock typings in merge tree

* test: trigger ci rerun without behavior change

* chore: dedupe todays changelog entries

* fix: dedupe sqlite mock keys in qmd manager test

* Update qmd-manager.test.ts

* test: align chat metadata sanitization expectation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord gateway Gateway runtime maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI renders inbound metadata block in user messages

1 participant