Skip to content

fix(native-chat): render Claude structured chat through the same UI as Codex - #18743

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/claude-native-chat-restructured
Sep 5, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/claude-native-chat-restructured

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​92 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​87
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​9 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1

ELI5

Claude's Chat UI sessions were missing the nice chrome that Codex sessions have — the "Worked for 5s" row, the live "Running …" tool line, image previews — and its / menu listed Codex's commands. All three were hardcoded to Codex. This removes the hardcoding so Claude runs through the exact same code.

What Changed

Structured native chat is already one shared, agent-agnostic component tree. Three Codex-hardcoded terms on that path made a Claude session render differently:

Location Was Now
NativeChatStructuredSession.tsx showTurnStatus={props.agent === 'codex'} showTurnStatus
NativeChatStructuredSession.tsx runtimeContext={props.agent === 'codex' ? … : undefined} runtimeContext={imageRuntimeContext}
NativeChatComposer.tsx STRUCTURED_AGENT_SESSION_SLASH_COMMANDS (Codex catalog) structuredSlashCommands(agent)

showTurnStatus is not a small flag — it gates the whole structured presentation: the live tool-progress row, the completion check and activity grouping (structuredActivityUi), and the Thinking / Working for N / Worked for N rows. runtimeContext gates transcript image previews.

No new rendering logic — two gates deleted and one existing shared function reused. There are now zero agent === 'codex' | 'claude' branches in any native-chat component.

Why

The first two gates landed Codex-first in #17597 (commit: "limit turn status UI to structured Codex") and #18266, both before the Claude structured lane existed (#18560). They were rollout scoping, not capability limits — neither useNativeChatTurnStatus nor useNativeChatImageRuntimeContext has any agent-specific logic.

The slash menu was a live defect, not just cosmetics. The menu ignored agent while the dispatcher structuredSlashCommands(agent) did branch. So Codex-only tokens offered in a Claude session (/vim, /pets, /mcp, /permissions, /subagents) missed the command guard, returned handled: false, and fell through to transport.send() — picking /vim sent the literal string "/vim" to the model as a chat turn. The same pick on Codex correctly shows "not available in chat sessions." Menu and dispatcher now read one list.

Linked Issue

No existing issue covers this — I searched open/closed issues for Claude structured chat UI parity and found none. Happy to file one if you'd like it tracked.

Fixes #

Visual Proof

Same Claude conversation, toggling only this change via HMR. See comment below for images.

  • Transcript BEFORE: no turn-status row at all; the tool run sits bare as 1× Bash cat …, always visible.
  • Transcript AFTER: Worked for 5s › disclosure, with the activity tucked behind it — the Codex behavior.
  • Slash menu BEFORE: Codex's catalog (/model, /vim, /pets, /permissions …) in a Claude session.
  • Slash menu AFTER: Claude's own (/clear /compact /init /review /help) plus /effort.

Testing

Automated — ablation-proven: reverting each fix turns its test red on claude only while codex stays green, so the tests bind to the real mechanism.

  • NativeChatStructuredSession.test.tsx — it.each(['codex','claude']) asserts identical transcript chrome props
  • NativeChatComposer.test.tsx — it.each asserts each agent is offered its own catalog and not the other's
  • src/shared/structured-agent-session-composer.test.ts (new) — menu/dispatcher agreement invariant

pnpm test src/renderer/src/components/native-chat src/shared/…: 1004 passing / 101 files. tc:node and tc:web exit 0. Changed-code quality gate clean.

Manual — macOS, isolated dev instance under CDP, real Claude Agent SDK session (verified contentType: agent-session, agent: claude):

  • turn status across a live turn: Thinking → Working for 3s/6s/9s → settles Worked for 11s
  • live tool row captured mid-turn: pulsing aria-live Running echo four
  • settled activity group: check-mark, 1× count, expands to Bash + command and Result + output
  • slash menu: Claude catalog only; asserted vim/pets/mcp/permissions/subagents all absent
  • image preview: pasted image renders as an 80px thumbnail in the bubble (not a filename chip) and Claude read it

Not tested: Linux, Windows, SSH/remote (structured chat is gated to executionHostId === 'local'). Approval/question cards are covered by unit tests only — I couldn't get Claude to trigger one live.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Review

Reviewers may want to weigh in on one intentional behavior change: completed Claude tool runs now collapse behind the turn disclosure instead of always showing. That is the Codex rule and the point of the change, but it is the most visible difference for existing Claude Chat users.

Adapter-side gaps deliberately out of scope here (they need new Claude translator code, not UI changes):

  • Claude emits no kind: 'diff' items, so an Edit renders inside the collapsed tool line rather than a dedicated Diff row
  • Claude emits image-ref only for url sources, not local paths, so local-path previews stay chips
  • no exit/interruption settlement, so a killed Claude leaves tool rows spinning

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: none — no new data flows, no IPC or wire changes.
  • Cross-platform: no platform-dependent code touched; structured chat is local-host gated. The Codex Windows refusal at agent-launch-routing.ts is untouched.
  • Remote SSH: unaffected — structured sessions require executionHostId === 'local'.
  • Mobile: unaffected — showTurnStatus/structuredActivityUi are desktop-only components; no mobile file changed.
  • Backwards compatibility: no wire, RPC, or journal schema change. Both adapters already normalize into the same AgentJournalItemBody model, and unknown frames already share unhandledProviderFrameJournalItem.
  • Performance: strictly fewer branches; useNativeChatImageRuntimeContext was already called unconditionally, only its result was discarded.

One test-scaffolding note for reviewers: proving the composer fix required deleting a getVerifiedNativeChatCommands: () => [] mock in NativeChatComposer.test.tsx. The Codex catalog constant is frozen at module load, so a per-test override can't reach it. All pre-existing tests in that file still pass against the real catalogs.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…s Codex

Structured native chat is one shared, agent-agnostic component tree, but three
Codex-hardcoded terms on that path made a Claude session render differently.

- `showTurnStatus` was `agent === 'codex'`, which gated the whole structured
  presentation: the live tool-progress row, the completion check and activity
  grouping (`structuredActivityUi`), and the Thinking / Working for N /
  Worked for N status rows. Claude fell back to the legacy compact chrome.
- `runtimeContext` was likewise Codex-only, so a Claude transcript rendered
  images as filename chips instead of previews.
- The composer's structured slash menu always served the Codex catalog,
  ignoring `agent`. That disagreed with the dispatcher, which does branch per
  agent: Codex-only tokens offered to Claude missed the command guard and were
  sent to the model as literal prompt text, where Codex shows an error.

The first two gates landed Codex-first (#17597, #18266) before the Claude
structured lane existed; they were rollout scoping, not capability limits.
Neither `useNativeChatTurnStatus` nor `useNativeChatImageRuntimeContext` has
any agent-specific logic. The menu now reads `structuredSlashCommands(agent)`,
the function the dispatcher already used, so both read one list.

No new rendering logic: two gates removed and one existing shared function
reused. There are now zero `agent === 'codex' | 'claude'` branches in any
native-chat component.
@coderabbitai

coderabbitai Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 8ea7f22d-deb9-47e8-9eab-dce05b0d8069

📥 Commits

Reviewing files that changed from the base of the PR and between 1dee49b and f0efa5e.

📒 Files selected for processing (1)
  • src/renderer/src/components/native-chat/NativeChatMessageList.tsx

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 8bed865d-2efb-4320-a460-0c55c853fc6e

📥 Commits

Reviewing files that changed from the base of the PR and between 0a821e5 and 1dee49b.

📒 Files selected for processing (6)
  • src/renderer/src/components/native-chat/NativeChatComposer.test.tsx
  • src/renderer/src/components/native-chat/NativeChatComposer.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
  • src/shared/structured-agent-session-composer.test.ts
  • src/shared/structured-agent-session-composer.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The structured composer now derives slash commands from the selected agent. Tests cover agent-specific commands, effort, and command-dispatch consistency. Structured sessions now always pass turn-status rendering and image runtime context to the message list for Codex and Claude. Tests cover both agents.

Merge Risk: ⚪ Minimal · up to 1dee4

Claude structured chat now uses the shared transcript presentation and agent-appropriate slash commands, with coverage for command dispatch, activity status, and image context behavior. No merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: bringing Claude structured chat into parity with the Codex UI.
Description check ✅ Passed The description is detailed, focused, and covers the change, rationale, testing, visual behavior, compatibility, and checklist items. The Linked Issue section does not provide an issue number, and the…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Turn-status chrome ungated for Claude — NativeChatStructuredSession.tsx passes showTurnStatus unconditionally (was props.agent === 'codex'), giving Claude structured sessions the same "Thinking / Working for N / Worked for N" disclosure and activity grouping as Codex.
  • Transcript image previews ungated for Claude — runtimeContext now always passes imageRuntimeContext (was props.agent === 'codex' ? imageRuntimeContext : undefined), enabling image previews for Claude.
  • Slash menu reads the agent-aware catalog — NativeChatComposer.tsx calls structuredSlashCommands(agent) (newly exported from structured-agent-session-composer.ts) instead of the Codex-only STRUCTURED_AGENT_SESSION_SLASH_COMMANDS, so the menu and the dispatchStructuredAgentSessionComposerCommand guard now read one list. This closes the real defect where a Claude session was offered Codex-only tokens (/vim, /pets, …) that missed the guard and reached the model as literal prompt text.

I verified the two ungated hooks (useNativeChatTurnStatus, useNativeChatImageRuntimeContext) have no agent-specific logic, so neither gate was a capability limit — they were rollout scoping. The null vs undefined runtimeContext distinction is handled downstream (TranscriptImagePreview keeps local-path images as chips when the context is unresolved, and renders URL images regardless), so the change degrades safely when no worktree route resolves. The three new tests are ablation-proven and bind to the real mechanism (agentCommands → picker → field autocomplete.items), not a tautology.

ℹ️ Nitpicks

  • src/renderer/src/components/native-chat/NativeChatMessageList.tsx:203 — the JSDoc on showTurnStatus still reads "available only on the structured Codex lane." This PR removes the Codex gate, so the comment is now stale and should say the structured lane (all agents).

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Live QA (review-only) — Claude structured chat chrome

Isolated Electron at pushed HEAD f0efa5ed2b3 (brennanb2025/claude-native-chat-restructured). window.api.app.getIdentity() returned Orca: brennanb2025/claude-native-chat-restructured / pr18743-review @ brennanb2025/claude-native-chat-restructured. Playwright CDP only. No source edits.

Proven

Claude structured session. New tab → Claude opened Claude Chat (structured-agent-session-claude_96f2da9e_2547_4a7b_9f12_1d2cc60ef159). Journal providerHandle.kind: claude.

Slash menu. / showed Claude Commands: /clear, /compact, /init, /review, /help, plus /effort. Codex-only /vim, /pets, /mcp, /permissions, /subagents were absent from the option list.

Turn status + activity. Real Bash turns:

  • Live: Thinking → Working for 0s → Running sleep 12 && echo four
  • After: Worked for 1s / Worked for 23s, expanded 1× Bash echo four with Bash + Result four

Image preview. Pasted 80×80 PNG rendered as an 80px thumbnail in the composer and in the Claude user bubble (View image: Pasted image), not a filename chip. Claude replied Blue; yes, a white circle is present.

Journal (37 rows) recorded the Bash tool-calls, Claude is working… status items, and the image-ref submission.

Screenshots

Slash menu (Claude catalog, including /compact):

02-claude-slash-menu.png

Thinking during a real turn:

06-live-thinking.png

Live tool row:

06-live-running.png

Settled expanded activity:

05-worked-for-expanded.png

Second turn settled (Worked for 23s, activity collapsed):

08-second-turn-settled.png

Composer paste thumbnail:

09-image-paste-composer.png

Transcript image preview (80px) + Claude read it:

10-transcript-image-preview.png

Visual notes

Uncropped full-app frames. No product clipping/overlap of the slash popup, turn-status rows, activity group, or image thumbnail. Dark theme consistent. Tiny bottom-center blob on some frames is the Playwright-cli overlay, not app UI. Gemini CLI visual review was not used (gemini -p required interactive auth).

Gaps

Not exercised: light theme, other window sizes, Linux/Windows, SSH/remote, approval/question cards, interrupted Claude turn, Codex regression pass. /effort was in the a11y tree but below the Commands fold in the slash screenshot.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status: Land

Reviewed final head f0efa5ed2b3.

  • Fixed one stale Codex-only contract comment so showTurnStatus now documents the shared structured-agent behavior; pushed directly to this branch.
  • Opening and closing readiness audits both passed with no P0/P1/P2 findings.
  • The same-model review-until-clean loop returned clean, including regression and performance review.
  • Targeted verification passed: 69 adjacent/changed tests, renderer and node typechecks, changed-code quality checks, React Doctor, and git diff --check.
  • All required CI is green, including macOS/Linux packaging, Windows packaging, static analysis, typecheck, all 8 test shards, verify, and Pullfrog.
  • Live Claude structured-chat validation passed for the provider-specific slash catalog, active/settled turn status, activity rendering, and image attachments. Electron screenshots and detailed evidence.

No in-scope findings remain.

Non-blocking residual coverage gaps: light theme, alternate window sizes, live Linux/Windows UI, SSH/remote execution, approval/question cards, an interrupted Claude turn, and a live Codex regression pass. These are unproven gaps rather than observed defects.

@brennanb2025
brennanb2025 merged commit 8096cb2 into main Sep 5, 2026
28 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…s Codex (stablyai#18743)

* fix(native-chat): render Claude structured chat through the same UI as Codex

Structured native chat is one shared, agent-agnostic component tree, but three
Codex-hardcoded terms on that path made a Claude session render differently.

- `showTurnStatus` was `agent === 'codex'`, which gated the whole structured
  presentation: the live tool-progress row, the completion check and activity
  grouping (`structuredActivityUi`), and the Thinking / Working for N /
  Worked for N status rows. Claude fell back to the legacy compact chrome.
- `runtimeContext` was likewise Codex-only, so a Claude transcript rendered
  images as filename chips instead of previews.
- The composer's structured slash menu always served the Codex catalog,
  ignoring `agent`. That disagreed with the dispatcher, which does branch per
  agent: Codex-only tokens offered to Claude missed the command guard and were
  sent to the model as literal prompt text, where Codex shows an error.

The first two gates landed Codex-first (stablyai#17597, stablyai#18266) before the Claude
structured lane existed; they were rollout scoping, not capability limits.
Neither `useNativeChatTurnStatus` nor `useNativeChatImageRuntimeContext` has
any agent-specific logic. The menu now reads `structuredSlashCommands(agent)`,
the function the dispatcher already used, so both read one list.

No new rendering logic: two gates removed and one existing shared function
reused. There are now zero `agent === 'codex' | 'claude'` branches in any
native-chat component.

* docs(native-chat): update structured turn status contract

---------

Co-authored-by: Merge Sim <sim@local>
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