Skip to content

feat: render structured Codex session detail messages#197

Merged
vakovalskii merged 2 commits intovakovalskii:mainfrom
akolotov:feat/structured-messages
Apr 21, 2026
Merged

feat: render structured Codex session detail messages#197
vakovalskii merged 2 commits intovakovalskii:mainfrom
akolotov:feat/structured-messages

Conversation

@akolotov
Copy link
Copy Markdown
Contributor

@akolotov akolotov commented Apr 18, 2026

Summary

This PR improves Codex session details by detecting known structured user messages and rendering them in a readable layout instead of showing raw XML-like wrappers.

It currently supports:

  • user_shell_command messages with separate command and result sections
  • user_action messages with context, action, and results sections

What Changed

  • add backend parsing for supported structured Codex user messages and return an additive structured payload alongside the raw message content
  • render supported structured messages in the detail panel with labeled sections and code-style blocks
  • preserve plain-text fallback for unknown or malformed payloads
  • apply per-field truncation after parsing so large result / results blocks are capped without breaking structured parsing

Notes

  • scope is limited to Codex session details
  • replay, export, previews, and search continue to use the existing raw message content path
  • no new dependencies were added

Screenshots

User Shell Command

image

User Action

image

@akolotov akolotov changed the title feat: Codex structured messages support feat: render structured Codex session detail messages Apr 18, 2026
@akolotov akolotov marked this pull request as ready for review April 18, 2026 05:01
Copy link
Copy Markdown
Owner

@vakovalskii vakovalskii left a comment

Choose a reason for hiding this comment

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

LGTM — additive parser with strict validation (returns null on any anomaly), XSS-safe rendering, plain-text fallback preserved. Scope limited to detail view as documented. Clean.

@vakovalskii vakovalskii merged commit 50d9757 into vakovalskii:main Apr 21, 2026
6 checks passed
Copy link
Copy Markdown
Collaborator

@NovakPAai NovakPAai left a comment

Choose a reason for hiding this comment

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

Code Review

Clean, well-structured implementation. The XML-tag based structured message parsing is solid:

  • ✅ Regex-based wrapper detection with proper escaping
  • ✅ Field descriptors with max_length truncation prevent unbounded output
  • ✅ CSS classes follow existing naming convention
  • ✅ Graceful fallback to plain text rendering when parsing fails

One minor note: truncateStructuredField treats maxLength === 0 as "no limit" — this is a reasonable convention but worth documenting in a comment, since 0 usually implies "empty" to readers.

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.

3 participants