Repository navigation
fix(native-chat): keep the running-work strip above a pending question card - #22779
Conversation
…pt card A pending approval or question card replaces the composer, but it rendered above the status block, so the running agents/shells strip dropped below the card. Render the cards in the composer's slot instead. Co-Authored-By: Claude <[email protected]>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThe structured session now renders retry controls, status, and the thread-goal banner before prompt cards. The composer renders only when no prompt exists. Tests cover task-strip and prompt-card rendering for pending question and approval prompts, including their document order. Priority: ⬇️ Low Merge Risk: 🔵 Low · up to Pane-level Paste cannot insert an answer into a pending question. This is a bounded usability regression with other input methods available; connecting Paste to the question input is advisable before merge. 🚥 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.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Connect the pending question input to pane-level Paste. · NativeChatStructuredSession.tsx:353
src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx:353
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winConnect the pending question input to pane-level Paste.
When
promptis pending,NativeChatStructuredSessionunmountsNativeChatComposer.useStructuredNativeChatPaneCommandspasses onlycomposerReftouseNativeChatPasteBridge, so pane-level Paste has no target. PassanswerInputRefthrough the command hook and attach it toNativeChatQuestionCard.🐛 Suggested fix
diff --git a/src/renderer/src/components/native-chat/use-structured-native-chat-pane-commands.ts b/src/renderer/src/components/native-chat/use-structured-native-chat-pane-commands.ts @@ rootRef, composerRef, + questionAnswerInputRef, terminalPaneActions @@ rootRef: RefObject<HTMLDivElement | null> composerRef: RefObject<NativeChatComposerHandle | null> + questionAnswerInputRef: RefObject<HTMLInputElement | null> terminalPaneActions?: Omit<NativeChatContextMenuActions, 'onPaste'> }) { @@ - const pasteClipboardIntoComposer = useNativeChatPasteBridge({ rootRef, composerRef }) + const pasteClipboardIntoComposer = useNativeChatPasteBridge({ + rootRef, + composerRef, + questionAnswerInputRef + })diff --git a/src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx b/src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx @@ const rootRef = useRef<HTMLDivElement>(null) const composerRef = useRef<NativeChatComposerHandle>(null) + const questionAnswerInputRef = useRef<HTMLInputElement>(null) const paneCommands = useStructuredNativeChatPaneCommands({ @@ rootRef, composerRef, + questionAnswerInputRef, terminalPaneActions: props.contextMenuActions @@ onCancel={cancelPrompt} + answerInputRef={questionAnswerInputRef} />
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: d1970fbc-3001-4e00-ab41-fe4e24ce43a2
📒 Files selected for processing (3)
src/renderer/src/components/native-chat/NativeChatStructuredSession.goal-dock.test.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.test-harness.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Prompt cards moved below the status dock —
NativeChatStructuredSession.tsxnow renders the delivery retry, launch retry,NativeChatStructuredSessionStatus(background-task strip), and goal banner before the approval/question cards, so with a prompt open the running-work strip sits above the card in the composer's slot, matching the no-prompt order. - Card mocks now render a node —
NativeChatStructuredSession.test-harness.tsxreturns<div data-native-chat-*-card-mock />from the mocked cards instead ofnull, letting the ordering test locate them. - Ordering test added —
NativeChatStructuredSession.goal-dock.test.tsxpinsstrip.compareDocumentPosition(card)for both the question and approval cases.
I confirmed the new test is not theatre: temporarily restoring the pre-fix ordering makes both it.each cases fail, and the fix makes them pass. The goal banner stays gated on !prompt, so its CSS next-sibling seam with the strip is untouched, and the existing goal-dock tests still pass. Also ran the three other suites that consume the shared harness (38 tests) — all green.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Review status: ready to mergeReviewed at head Fix for the reported issue: confirmed. The pane's bottom area is one column whose child order is the on-screen order. The question and approval cards had their own slot above the retry rows, the status text and the running-work strip, so when a card replaced the composer it landed above the strip instead of in the composer's place. This PR moves both cards into the composer's slot. That removes the cause rather than working around it, and it matches the question card's own intent ("docked in the bottom input region … directly above the text input"). Regressions: none found.
Performance: no new renders, effects, listeners or state. Only the element order changed. Test: the new test fails on main's order (both cases, on the position assertion) and passes here. Validation:
Known, out of scope: submitting a long free-text answer to a question shows "Invalid option id". That happens on main too, is not caused by this PR, and is tracked separately. |

ELI5
When an agent in a chat asks you a question, the question box replaces the message box at the bottom. The little bar that says what is still running ("1 agent · 1 shell") normally sits just above the message box, but with a question open it jumped below the question box. Now it stays above it.
What Changed
Before: with a question or approval card open, the order at the bottom of a structured chat was card, then the running-work bar, then nothing. The bar floated under the card, cut off from the message stream it describes.
After: the order is running-work bar, then card, which is the same place the message box sits when there is no question.
Mechanism:
NativeChatStructuredSessionrendered the approval and question cards before the status block (delivery retry, launch retry, status/background-task strip, goal banner). The cards now render in the composer's slot, after that block. Because the cards replace the composer, this also puts any status or error line above the card, exactly where it sits above the composer.Why
The cards are a stand-in for the composer, so they belong in the composer's position. Moving the cards is one ordering change with no new styling; restyling or docking the strip to the card would have added a second layout rule for the same slot.
Linked Issue
Reported directly (no issue filed).
Visual Proof
Same scenario on both builds: a real structured Claude chat that starts a background shell and a background subagent, then asks a question.
Before (main): the running-work bar is below the question card.
After (this branch): the bar is above the card.
Testing
Live: both builds launched from source in the background on macOS, driven over the DevTools protocol with a real Claude chat. The DOM order was checked as well as the picture (
stripBeforeCard: falseon main,truehere).Added a test that the running-work strip renders before both the question card and the approval card. It fails on main and passes here.
pnpm test src/renderer/src/components/native-chatpasses (190 files, 1893 tests); oxlint clean.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent 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
Renderer-only ordering change. There is no platform-specific code and no wire or host change, so SSH/remote and mobile are unaffected. The mobile app has its own prompt layout and is not touched.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)