Skip to content

Keep the floating workspace above a working native chat pane - #18692

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/fix-native-chat-floating
Sep 4, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/fix-native-chat-floating

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 4, 2026 •

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

Problem

With a floating workspace open, the panel disappears behind the native chat column while an agent is streaming — only the sliver sticking out past the chat's right edge stays visible.

main.css promotes the chat pane shell from z-10 to z-50 whenever an agent is working:

.native-chat-pane-shell:has([data-native-chat-working='true']) {
  z-index: 50;
}

The floating panel is position: fixed; z-index: 45 at the app root, and no ancestor of the chat pane creates a stacking context, so the two compete directly in the root stacking context. 50 wins and the chat column paints over the panel.

The panel's geometry was never wrong — 920px wide anchored 24px off the right edge puts its right edge exactly where it renders. It also correctly paints over the session-history sidebar, which rules out clipping. Because the rule is gated on the working state, an idle chat shows the panel fine, so this only reproduces mid-stream.

Fix

Lower the working-state rule to z-index: 44.

That preserves the intent it was added with in #16729 — keeping the interruption controls above the z-40 updater/onboarding chrome — and the 41–44 band was otherwise empty, so nothing else shifts.

Raising the floating panel instead was rejected: its own comment pins it under the z-50 Radix modal layer, so raising it would put the floating workspace over every dialog.

Tests

native-chat-stop-layering.test.ts already guarded this rule but asserted z-index: 50 as a literal with no upper bound — that one-sided assertion is what let the regression in. It now derives both bounds from source (reading the panel's z-[45] out of the component) so neither side can drift silently.

Ablation on the real head: reverting the CSS to 50 fails the new assertion (expected 50 to be less than 45) while the other three tests still pass, confirming the prior suite had no coverage here.

  • Target test: 4/4 pass
  • native-chat + floating-terminal suites: 113 files / 1115 tests pass
  • pnpm tc clean, oxlint clean, oxfmt no reflow

While an agent is streaming, `data-native-chat-working='true'` promoted the
native chat pane shell from z-10 to z-50, above the floating workspace panel's
z-45. Both compete in the root stacking context, so the chat column painted
over a summoned floating workspace and only the sliver past the chat's right
edge stayed visible.

Lower the working-state rule to z-44. It still clears the z-40 updater and
onboarding chrome the rule was added for (#16729) and the 41-44 band was
otherwise empty. Raising the panel instead would put it over the z-50 modal
layer it deliberately sits under.

The existing layering test pinned z-index 50 with no upper bound, which is
what let this through; it now derives both bounds from source.
@coderabbitai

coderabbitai Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The working native chat pane z-index changed from 50 to 44. The CSS comment now documents its position above updater/onboarding chrome and below the floating workspace panel. Tests parse the CSS z-index and verify both stacking relationships.

Merge Risk: 🔵 Low · up to 38f75

The chat pane now sits below the floating workspace panel while remaining above lower-priority chrome. The intended visual behavior is addressed, but the layering test can miss future changes to either referenced layer until its source matching and lower-bound derivation are tightened.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, fix, rationale, and test results, but it does not follow the required template. It omits the required Linked Issue, Visual Proof, ELI5, explicit What Changed and … Update the description to include every required template section. Add a linked issue after "Fixes #", provide visual proof or write "N/A" with a reason, add ELI5, What Changed, and Why sections, complete the Testing and checklist items, an…
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: keeping the floating workspace above a working native chat pane.
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.
Full details: Description check

Explanation

The description explains the problem, fix, rationale, and test results, but it does not follow the required template. It omits the required Linked Issue, Visual Proof, ELI5, explicit What Changed and Why sections, checklist confirmations, and platform or manual-testing details.

Resolution

Update the description to include every required template section. Add a linked issue after "Fixes #", provide visual proof or write "N/A" with a reason, add ELI5, What Changed, and Why sections, complete the Testing and checklist items, and document AI disclosure and cross-platform or SSH considerations as applicable.

  • Fix all pre-merge checks with AI
✨ 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

  • Working chat layering lowered below the floating panel — main.css moves .native-chat-pane-shell:has([data-native-chat-working='true']) from z-index: 50 to z-index: 44, keeping it above the z-40 updater/onboarding chrome but below the floating workspace's z-[45].
  • Both layering bounds now pinned in the ratchet test — native-chat-stop-layering.test.ts replaces the one-sided z-index: 50 literal with a workingChatZIndex() helper (parsed from source) and asserts it is > 40 and < the panel's source-derived z-[45] (itself asserted exactly 45).

The fix is sound: the working pane's intent (above z-40 chrome) is preserved, the 41–43 band is empty, and the 44 < 45 < 46 < 50 ordering (chat pane, floating panel, floating toggle, modal layer) is correct. The new assertion closes the one-sided gap that let this regression in, and I confirmed it can fail in both directions (revert to 50 → toBeLessThan(45) fails; drop to 39 → toBeGreaterThan(40) fails).

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Visual proof

Captured on an isolated dev instance of this branch (private CDP port 9350 / renderer 5183; /@fs returned 200 for this worktree and 403 for a peer, so the instance is provably serving this checkout).

The floating workspace panel is the real product surface — opened via the real orca-toggle-floating-terminal event, rendering at its real default bounds (920×560, z-index: 45). The differential flips the real CSS rule in main.css between the pre-fix 50 and the shipped 44.

Before — working chat pane at z-index: 50

before

The panel is buried. Only the sliver past the chat column's right edge survives — the maximize/minimize buttons and the orphaned T M O B W shortcut badges, with their labels cut off. This reproduces the reported symptom exactly.

After — working chat pane at z-index: 44

after

The panel sits fully above the working chat pane, and the chat column's own text is now correctly truncated behind it.

Hit-test at the panel's center point (1244, 641)

chat z-index top element is panel top element is chat
50 (pre-fix) ❌ false ✅ true
44 (shipped) ✅ true ❌ false

Disclosed gap

The chat column here is a stand-in div carrying the exact class and attribute the CSS rule keys on (class="native-chat-pane-shell" wrapping data-native-chat-working="true"), not a live agent session. A fresh dev profile launched with --use-mock-keychain has no agent credentials, so a genuinely streaming native chat could not be started in it.

What that does and does not establish: the real floating panel, the real main.css rule, and the real root-stacking-context interaction are all exercised. What is not exercised is a real chat pane mounting through TerminalPaneNativeChatPortal / StructuredAgentSessionPaneOverlayLayer. Both mount with the same native-chat-pane-shell z-10 root, so the cascade is identical, but that last step is inferred from source rather than observed here.

The panel's z-index was read with a lazy match from the data attribute to the
first `z-[NN]`. Nearby comments cite bare tiers (the toggle button's own note
mentions z-[45]), so a reworded comment landing after the attribute would be
read as the class. Strip comments and anchor to `className=`.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review loop

An independent adversarial pass came back correct, ship it, with one test issue worth fixing and one follow-up out of scope here.

Additional symptom this also fixes

FloatingTerminalToggleButton.tsx:200 renders the floating workspace toggle/minimize control at fixed z-[46], with a comment saying it must stay above the z-[45] panel "so it stays clickable where the two overlap."

At z-50 the working chat buried that control too — so while an agent was streaming, the toggle was not just hidden but unclickable. 44 restores it. That's a second user-visible symptom beyond the one originally reported.

Test hardening (38f7565a080)

The reviewer flagged the panel z-index regex as brittle: it matched lazily from data-floating-terminal-panel to the first z-[NN], and nearby comments cite bare tiers — FloatingTerminalToggleButton.tsx:198 literally contains z-[45] in prose. A reworded comment landing after the attribute would be read as the class.

Fixed by stripping comments and anchoring to className=. Verified by injecting the exact failure — a z-[50] comment placed after the data attribute — and confirming the test still reads 45 and passes; the old regex would have grabbed the comment.

Full 41–49 census

Only three occupants: this rule at 44, the panel at 45, the toggle at 46. The one nominal inversion is rich-markdown-editor.css:253 (.rich-markdown-review-rail-actions, z-45), but its host shell lives in a different pane that never geometrically overlaps the chat column, so it is inert.

Also confirmed: the shell is positioned and gets a z-index at both 50 and 44, so it creates a stacking context either way — in-pane z-50 descendants (TerminalSearch, CodexRestartChip, MobileDriverOverlay) were already contained by it and are unaffected.

Follow-up, deliberately not in this PR

There is no z-index scale. The ladder — 40 chrome / 44 chat / 45 panel / 46 toggle / 50 modal / 60 popover / 70 menu — is scattered across raw CSS and Tailwind arbitrary values, and docs/STYLEGUIDE.md documents none of it. This PR is a targeted fix for a specific occlusion bug; introducing --z-* tokens plus a STYLEGUIDE section is a separate change and is filed here as a recommendation rather than bundled in.

Gates

  • native-chat + floating-terminal: 113 files / 1115 tests pass
  • Scope: 2 files, no lockfile/config/stray edits

@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

  • Hardened the panel-z extraction in the layering ratchet — native-chat-stop-layering.test.ts now strips /* */ and // comments from the source before matching, and anchors the z-[N] capture to className=, so a reworded layering comment citing bare z-40/z-50 tiers can no longer be misread as the panel's own class.

The change is sound: the reference comment (FloatingTerminalPanel.bounds.test.tsx:182 pins z-[45] via a real render) is accurate, the extracted value still resolves to 45, and the test suite passes (4/4). No production behavior changed.

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

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

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (1)
src/renderer/src/components/native-chat/native-chat-stop-layering.test.ts (1)

27-31: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Derive the lower bound from main.css.

The assertion still compares the working chat z-index with literal 40. If the updater or onboarding chrome changes to a value above 44, this test can pass while the chat pane paints below that chrome. Extract the [data-sonner-toaster] z-index from css and compare against that value.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 45d03971-8b87-4f89-be44-02b3ff8037cd

📥 Commits

Reviewing files that changed from the base of the PR and between 3fc9a7b and 38f7565.

📒 Files selected for processing (1)
  • src/renderer/src/components/native-chat/native-chat-stop-layering.test.ts

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

'src/renderer/src/components/floating-terminal/FloatingTerminalPanelSurface.tsx'
).replace(/\/\*[\s\S]*?\*\/|\/\/[^\n]*/g, '')
const panelZIndex = Number(
/data-floating-terminal-panel[\s\S]*?className=[\s\S]*?z-\[(\d+)\]/.exec(panel)?.[1]

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Scope the panel match to one opening tag.

The [\s\S]*? parts can cross element boundaries. If data-floating-terminal-panel remains on a wrapper while a nested or later className contains z-[45], the test can extract that unrelated value. Extract the opening tag containing the data attribute, then inspect only its className or parse the TSX structure.

🧰 Tools
🪛 OpenGrep (1.27.1)

[ERROR] 39-39: Dynamic command passed to child_process.exec/execSync. Use child_process.execFile or spawn with an argument array instead.

(coderabbit.command-injection.exec-js)

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron QA — live native chat (not a stand-in)

Validated reviewed head 38f7565a080 in this worktree (shearwater @ brennanb2025/fix-native-chat-floating). Isolated disposable profile, CDP 9335 / renderer 5176. /@fs for this checkout returned 200; a peer checkout returned 403. Playwright CDP only.

This pass used the real product surfaces:

  • Native chat: a real Grok tab from the New tab menu, with experimentalNativeChat on. data-native-chat-working="true" came from NativeChatView during a live streaming turn (stop control visible, streaming markdown, tool call read_file on README.md).
  • Floating workspace: opened with the real Show floating workspace control. Panel at default bounds 920×560, (784, 359), position: fixed; z-index: 45.

The z-50 “before” is a runtime override of the same CSS rule on that live session (not a rebuild of main).

Before — working chat pane forced to z-index: 50

before

The panel is buried. Only the sliver past the chat column’s right edge survives — maximize/minimize and the orphaned T M O B W badges, labels cut off. This is the reported symptom on a live working Grok pane.

After — shipped z-index: 44 on the same live turn

after

The panel sits fully above the working chat. Chat text is truncated behind it. Removing the override restored the same stacking (confirmed with a third shot).

Hit-test at the panel center (1244, 639) while data-native-chat-working="true"

chat z-index top element is panel top element is chat
50 (override of the real rule) ❌ false ✅ true (<p class="my-2 first:mt-0 last:mb-0">)
44 (shipped) ✅ true (panel empty-state column) ❌ false

Computed styles on the real nodes: shell .native-chat-pane-shell.absolute.inset-0.z-10 → 44 or 50; panel [data-floating-terminal-panel].fixed.z-[45] → 45. Overlap 594×560. Panel lives under app-layout with no ancestor z-index; chat-shell ancestors are positioned with z-index: auto, so the two compete directly.

Idle (working=false) keeps the shell at z-index: 10; the promotion only fires while the agent is working.

Gap

The before state is a runtime z-index: 50 !important on the real rule, not a checkout of pre-fix main.css. The live Grok session, real portal shell, and real floating panel are otherwise the product path. Structured-session overlay and z-40 updater/onboarding chrome were not re-shot. A small Playwright comment-toolbar remnant can appear at the bottom of the screenshots; it is automation chrome.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Final review status — ready to land

  • Same-model review-until-clean: clean on round 1; no meaningful in-scope issues, so no code edits or superseding rewrite were warranted.
  • Readiness checklist: PASS at the start and end; no P0, P1, or P2 findings.
  • Scope: still limited to the two intended files; worktree is clean and local/remote head match 38f7565a080.
  • Correctness: the enforced ladder is product chrome 40 < working native chat 44 < floating workspace 45 < toggle 46 < modals 50.
  • Performance: numeric change to the existing rule only; no added render work, polling, listeners, allocations, IPC, or cleanup risk.
  • Verification: targeted layering + panel tests 19/19, target rerun 4/4, changed-code quality clean, git diff --check clean.
  • CI: all required jobs complete and green, including typecheck, static analysis, package, Windows package, all eight test shards, verify, and review checks.
  • Electron: validated with Playwright CDP on the exact worktree using a real live Grok native-chat pane and the real floating workspace. Shipped z-index: 44 keeps the panel visible and hit-testable; a runtime 50 override on the same live turn reproduces the original occlusion. Uncropped before/after screenshots and measurements are in the preceding Electron QA comment.

Remaining evidence gaps are non-blocking: the before state is a runtime override rather than a historical checkout, and the structured overlay plus neighboring z-40/z-50 chrome were not separately re-shot; source and ratchet tests cover those boundaries.

Verdict: ready to land.

@brennanb2025
brennanb2025 merged commit d9e44a6 into main Sep 4, 2026
28 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…i#18692)

* Keep the floating workspace above a working native chat pane

While an agent is streaming, `data-native-chat-working='true'` promoted the
native chat pane shell from z-10 to z-50, above the floating workspace panel's
z-45. Both compete in the root stacking context, so the chat column painted
over a summoned floating workspace and only the sliver past the chat's right
edge stayed visible.

Lower the working-state rule to z-44. It still clears the z-40 updater and
onboarding chrome the rule was added for (stablyai#16729) and the 41-44 band was
otherwise empty. Raising the panel instead would put it over the z-50 modal
layer it deliberately sits under.

The existing layering test pinned z-index 50 with no upper bound, which is
what let this through; it now derives both bounds from source.

* Stop the layering test reading a comment as the panel class

The panel's z-index was read with a lazy match from the data attribute to the
first `z-[NN]`. Nearby comments cite bare tiers (the toggle button's own note
mentions z-[45]), so a reworded comment landing after the attribute would be
read as the class. Strip comments and anchor to `className=`.

---------

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