Skip to content

feat(trace-preview): hide system messages from pretty IO view (2BB-289)#3

Merged
alexanderkreidich merged 1 commit into
openclaw-stablefrom
sasha/2bb-289-preview-hide-system
Apr 18, 2026
Merged

feat(trace-preview): hide system messages from pretty IO view (2BB-289)#3
alexanderkreidich merged 1 commit into
openclaw-stablefrom
sasha/2bb-289-preview-hide-system

Conversation

@alexanderkreidich

Copy link
Copy Markdown

Summary

Linear: 2BB-289

The Preview tab in the trace/observation detail view (and session views) was rendering the full system prompt — tool catalog, skills list, operator rules, often many KB of text with strikethrough — alongside the actual user/assistant turns. That makes Preview useless for scanning "what was the conversation."

This PR filters messages with role of system, developer, or tool_definitions out of the ChatML transcript at the pretty render layer only. The JSON and JSON Beta tabs are untouched and still show the full trace payload.

Changes

  • web/src/components/trace2/components/IOPreview/components/chat-message-utils.ts
    • Add SYSTEM_ROLES set + isSystemRole(role) helper (case-insensitive)
  • web/src/components/trace2/components/IOPreview/hooks/useChatMLParser.ts
    • Add UseChatMLParserOptions { hideSystemMessages } (defaults to true)
    • Single-pass filter over combinedMessages: extracts tool definitions from all messages (so SectionToolDefinitions stays populated even when only a system message carried the tools), but omits system-role messages from the messages array consumed by ChatMessageList
    • Track filtered inputMessageCount so tool-call numbering and "output message" detection remain correct
  • chat-message-utils.clienttest.ts — 6 new unit tests for isSystemRole

Why default true?

Every current caller of useChatMLParser (via IOPreviewPretty) is a trace/observation/session surface where system prompts leak into the Preview tab:

  • TraceDetailView, ObservationDetailView
  • TracePreview, ObservationPreview
  • session/index.tsx, session/TraceEventsRow.tsx

There are no playground/eval consumers of IOPreview — playground only imports the ThinkingBlock subcomponent and prompt-detail only imports OpenAiMessageView. An opt-out remains available via the option for future callers.

Test plan

  • pnpm --filter=web run lint — passes
  • pnpm --filter=web run test-client --testPathPatterns chat-message-utils — 34/34 pass (including 6 new)
  • pnpm --filter=web run test-client --testPathPatterns "chatml|IOPreview|trace2" — 197/197 pass across 7 suites
  • pnpm --filter=web run typecheck — my files produce zero new errors (9 pre-existing errors unrelated to IOPreview remain on openclaw-stable, same count before/after)
  • Visual smoke: live Langfuse stack (stack not available in sandbox — skipped per task brief)

Verification limitations

  • Could not run the full Langfuse dev stack in this sandbox. Typecheck/lint/unit tests were used as the substitute per the task brief.
  • Node 22.14 used (repo requests Node 24); only a warning, no impact.

🤖 Generated with Claude Code

The Preview tab in trace/observation detail views was rendering the full
system prompt (tool catalog, skills list, operator rules — many KB of
text) alongside the user/assistant turns, making it useless for scanning
what the conversation actually was.

Filter messages with role=system/developer/tool_definitions out of the
ChatML transcript at the pretty render layer. The JSON and JSON Beta
views are untouched and still show the full trace payload, so no data
is hidden from reviewers who need it.

- Add isSystemRole() helper (case-insensitive) in chat-message-utils
- useChatMLParser accepts hideSystemMessages (defaults to true — every
  current caller is a trace/observation/session surface)
- Tool definitions are extracted from the pre-filter combinedMessages so
  SectionToolDefinitions stays populated even when only a system message
  declared the tools
- inputMessageCount tracks kept input messages so tool-call numbering
  stays correct after filtering

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@alexanderkreidich

Copy link
Copy Markdown
Author

@codex review

@2bb-dev 2bb-dev deleted a comment from github-actions Bot Apr 18, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@alexanderkreidich alexanderkreidich merged commit e1e50f2 into openclaw-stable Apr 18, 2026
3 of 4 checks passed
@alexanderkreidich alexanderkreidich deleted the sasha/2bb-289-preview-hide-system branch April 18, 2026 17:42
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.

1 participant