Skip to content

fix(native-chat): keep the running-work strip above a pending question card - #22779

Merged
brennanb2025 merged 1 commit into
mainfrom
brennanb2025/fix-subagent-shell-option
Sep 25, 2026
Merged

brennanb2025 merged 1 commit into
mainfrom
brennanb2025/fix-subagent-shell-option

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​50 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​50
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​35 $\color{#cf222e}{\Huge{\mathbf{−}}}$​34 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1

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: NativeChatStructuredSession rendered 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.

before

After (this branch): the bar is above the card.

after

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: false on main, true here).

  • 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-chat passes (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

  • 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

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

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • 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)

…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]>
@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

The 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 e3923

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 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 main change: keeping the running-work strip above a pending question card in native chat.
Description check ✅ Passed The description is mostly complete and clearly explains the user impact, implementation, rationale, visual proof, testing, scope, and checklist status. It does not provide a linked issue despite the t…
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 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 win

Connect the pending question input to pane-level Paste.

When prompt is pending, NativeChatStructuredSession unmounts NativeChatComposer. useStructuredNativeChatPaneCommands passes only composerRef to useNativeChatPasteBridge, so pane-level Paste has no target. Pass answerInputRef through the command hook and attach it to NativeChatQuestionCard.

🐛 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

📥 Commits

Reviewing files that changed from the base of the PR and between e0144a9 and e3923ec.

📒 Files selected for processing (3)
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.goal-dock.test.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.test-harness.tsx
  • src/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.

@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

  • Prompt cards moved below the status dock — NativeChatStructuredSession.tsx now 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.tsx returns <div data-native-chat-*-card-mock /> from the mocked cards instead of null, letting the ordering test locate them.
  • Ordering test added — NativeChatStructuredSession.goal-dock.test.tsx pins strip.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.

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status: ready to merge

Reviewed at head e3923ec54b. No changes were needed, so the head is unchanged.

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.

  • Each sibling keeps a fixed position in the element list, and the cards keep their keys, so nothing remounts: a half-typed answer and the strip's expanded state both survive a card appearing.
  • The approval card's auto-focus is unchanged.
  • The retry rows and the error or "starting" text now sit above the card, the same place they sit above the composer.
  • The total height is unchanged, so the message list's scroll position is unaffected.
  • The card wrapper used by the older chat view and the mobile app have no running-work strip, so neither is affected.

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:

  • Local: the 10 native-chat test files around this component (80 tests), oxlint, the changed-lines quality gate and the web typecheck all pass. A trial merge with current main is clean and its tests pass.
  • CI: all checks green.
  • Live: Electron QA from source, before and after, at this exact commit. Screenshots and the DOM order check are in the PR body.
  • Readiness checklist: passed with no findings, both at the start and at the end of the review.

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.

@brennanb2025
brennanb2025 merged commit f5d2ce5 into main Sep 25, 2026
31 checks passed
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