feat(trace-preview): hide system messages from pretty IO view (2BB-289)#3
Merged
alexanderkreidich merged 1 commit intoApr 18, 2026
Merged
Conversation
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>
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
roleofsystem,developer, ortool_definitionsout 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.tsSYSTEM_ROLESset +isSystemRole(role)helper (case-insensitive)web/src/components/trace2/components/IOPreview/hooks/useChatMLParser.tsUseChatMLParserOptions { hideSystemMessages }(defaults totrue)combinedMessages: extracts tool definitions from all messages (soSectionToolDefinitionsstays populated even when only a system message carried the tools), but omits system-role messages from themessagesarray consumed byChatMessageListinputMessageCountso tool-call numbering and "output message" detection remain correctchat-message-utils.clienttest.ts— 6 new unit tests forisSystemRoleWhy default
true?Every current caller of
useChatMLParser(viaIOPreviewPretty) is a trace/observation/session surface where system prompts leak into the Preview tab:TraceDetailView,ObservationDetailViewTracePreview,ObservationPreviewsession/index.tsx,session/TraceEventsRow.tsxThere are no playground/eval consumers of
IOPreview— playground only imports theThinkingBlocksubcomponent andprompt-detailonly importsOpenAiMessageView. An opt-out remains available via the option for future callers.Test plan
pnpm --filter=web run lint— passespnpm --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 suitespnpm --filter=web run typecheck— my files produce zero new errors (9 pre-existing errors unrelated to IOPreview remain onopenclaw-stable, same count before/after)Verification limitations
🤖 Generated with Claude Code