Repository navigation
fix(native-chat): render Claude structured chat through the same UI as Codex - #18743
Conversation
…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.
|
Warning Review limit reachedNext included review available in 2 minutes. View limit detailsLimit 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. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe structured composer now derives slash commands from the selected agent. Tests cover agent-specific commands, Merge Risk: ⚪ Minimal · up to 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)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Turn-status chrome ungated for Claude —
NativeChatStructuredSession.tsxpassesshowTurnStatusunconditionally (wasprops.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 —
runtimeContextnow always passesimageRuntimeContext(wasprops.agent === 'codex' ? imageRuntimeContext : undefined), enabling image previews for Claude. - Slash menu reads the agent-aware catalog —
NativeChatComposer.tsxcallsstructuredSlashCommands(agent)(newly exported fromstructured-agent-session-composer.ts) instead of the Codex-onlySTRUCTURED_AGENT_SESSION_SLASH_COMMANDS, so the menu and thedispatchStructuredAgentSessionComposerCommandguard 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 onshowTurnStatusstill 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).
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Live QA (review-only) — Claude structured chat chromeIsolated Electron at pushed HEAD ProvenClaude structured session. New tab → Claude opened Claude Chat ( Slash menu. Turn status + activity. Real Bash turns:
Image preview. Pasted 80×80 PNG rendered as an 80px thumbnail in the composer and in the Claude user bubble ( Journal (37 rows) recorded the Bash tool-calls, ScreenshotsSlash menu (Claude catalog, including Thinking during a real turn: Live tool row: Settled expanded activity: Second turn settled ( Composer paste thumbnail: Transcript image preview (80px) + Claude read it: Visual notesUncropped 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 ( GapsNot exercised: light theme, other window sizes, Linux/Windows, SSH/remote, approval/question cards, interrupted Claude turn, Codex regression pass. |
Review status: LandReviewed final head
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. |
…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>








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:
NativeChatStructuredSession.tsxshowTurnStatus={props.agent === 'codex'}showTurnStatusNativeChatStructuredSession.tsxruntimeContext={props.agent === 'codex' ? … : undefined}runtimeContext={imageRuntimeContext}NativeChatComposer.tsxSTRUCTURED_AGENT_SESSION_SLASH_COMMANDS(Codex catalog)structuredSlashCommands(agent)showTurnStatusis 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.runtimeContextgates 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 anynative-chatcomponent.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
useNativeChatTurnStatusnoruseNativeChatImageRuntimeContexthas any agent-specific logic.The slash menu was a live defect, not just cosmetics. The menu ignored
agentwhile the dispatcherstructuredSlashCommands(agent)did branch. So Codex-only tokens offered in a Claude session (/vim,/pets,/mcp,/permissions,/subagents) missed the command guard, returnedhandled: false, and fell through totransport.send()— picking/vimsent 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.
1× Bash cat …, always visible.Worked for 5s ›disclosure, with the activity tucked behind it — the Codex behavior./model,/vim,/pets,/permissions…) in a Claude session./clear /compact /init /review /help) plus/effort.Testing
Automated — ablation-proven: reverting each fix turns its test red on
claudeonly whilecodexstays green, so the tests bind to the real mechanism.NativeChatStructuredSession.test.tsx—it.each(['codex','claude'])asserts identical transcript chrome propsNativeChatComposer.test.tsx—it.eachasserts each agent is offered its own catalog and not the other'ssrc/shared/structured-agent-session-composer.test.ts(new) — menu/dispatcher agreement invariantpnpm test src/renderer/src/components/native-chat src/shared/…: 1004 passing / 101 files.tc:nodeandtc:webexit 0. Changed-code quality gate clean.Manual — macOS, isolated dev instance under CDP, real Claude Agent SDK session (verified
contentType: agent-session,agent: claude):Thinking→Working for 3s/6s/9s→ settlesWorked for 11saria-liveRunning echo four1×count, expands toBash+ command andResult+ outputvim/pets/mcp/permissions/subagentsall absentNot 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.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):
kind: 'diff'items, so anEditrenders inside the collapsed tool line rather than a dedicated Diff rowimage-refonly forurlsources, not local paths, so local-path previews stay chipsAgent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
agent-launch-routing.tsis untouched.executionHostId === 'local'.showTurnStatus/structuredActivityUiare desktop-only components; no mobile file changed.AgentJournalItemBodymodel, and unknown frames already shareunhandledProviderFrameJournalItem.useNativeChatImageRuntimeContextwas already called unconditionally, only its result was discarded.One test-scaffolding note for reviewers: proving the composer fix required deleting a
getVerifiedNativeChatCommands: () => []mock inNativeChatComposer.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
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)