Repository navigation
test: confirm running-command prompts when closing tabs - #18965
Conversation
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe end-to-end tab tests use a shared helper to close tabs. The helper handles the running-command confirmation dialog and waits for tab removal. Test setup verifies active-tab visibility. New Terminal and New Markdown menu-item clicks use normal actionability checks. The Markdown menu-item visibility assertion runs after the editor becomes visible. Merge Risk: 🔵 Low · up to The tab E2E updates improve synchronization around closing busy terminals, but the confirmation-close path may still race subsequent assertions with tab removal. This is a bounded test-reliability risk that should be addressed before relying on these checks. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the test changes, motivation, preserved assertions, and validation status. However, it omits most required template sections, including the Linked Issue, Visual Proof, Testing checklist, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist. Resolution Complete the required PR template sections. Add the linked issue after
✨ 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 critical issues — one minor robustness note inline.
Reviewed changes — a single-file E2E deflake that teaches the two tab-close specs to accept the running-command confirmation dialog instead of assuming an immediate close.
- New
closeTabFromTabBarhelper — hovers the tab, clicks its close button, then waits for either theStop running command?dialog or the tab's removal, confirming via the scopedStop and Closebutton when prompted. - Two call sites updated —
closing a tab removes it from the tab barandclosing the active tab activates a neighbor tabnow route through the helper; their final DOM assertions (tab count drops, a neighbor takesdata-active) are unchanged.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| const tab = tabLocator(page, tabId) | ||
| await tab.hover() | ||
| await tab.getByRole('button', { name: /^Close tab /i }).click() | ||
| const confirmation = page.getByRole('dialog', { name: 'Stop running command?' }) |
There was a problem hiding this comment.
This hardcodes the command copy variant, whereas the sibling specs (terminal-tab-close-running-confirm.spec.ts, terminal-tab-close-running-confirm-mouse.spec.ts) match both Stop running command?|Stop this agent? via a closeDialogTitle regex. Correct for the two call sites here (both create plain terminal tabs), but a future agent-tab close routed through this helper would time out rather than match. Consider matching the canonical regex.
def04a4 to
3f606c5
Compare
There was a problem hiding this comment.
ℹ️ No new issues in this delta — the render-readiness fix is correct. One minor nit from the prior review remains open.
Reviewed changes — since the prior review (def04a4), this commit adds a render-readiness guard to the Tabs beforeEach.
beforeEachrender-readiness wait — afterensureTerminalVisible, the block now reads the active tab id from the store and asserts its[data-testid="sortable-tab"]element is visible before any test body runs. This closes the flake where tab-count specs counted zero tabs before the initial terminal rendered and then mistook the late-rendering initial tab for a duplicate created byCmd/Ctrl+Tor+→ New Terminal.
The closeTabFromTabBar helper and its two call sites are unchanged. The previously flagged nit (the helper hardcodes the Stop running command? dialog copy rather than the canonical Stop running command?|Stop this agent? regex its sibling specs use) still stands and is the only outstanding item; it does not block merge.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 60c7e0d2-2c36-4017-8f1c-a8739f7b2cae
📒 Files selected for processing (1)
tests/e2e/tabs.spec.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.
| }) | ||
| .toBe(true) | ||
| if (await confirmation.isVisible()) { | ||
| await confirmation.getByRole('button', { name: 'Stop and Close', exact: true }).click() |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Wait for tab removal after the confirmation click.
When the confirmation is visible, the poll stops before the tab is removed. After Stop and Close is clicked, this helper returns without waiting for tab.count() === 0. The callers can then measure stale tab state during the close animation. Add a second poll after the confirmation click.
Proposed fix
if (await confirmation.isVisible()) {
await confirmation.getByRole('button', { name: 'Stop and Close', exact: true }).click()
}
+ await expect.poll(async () => (await tab.count()) === 0, {
+ timeout: 5_000,
+ }).toBe(true)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| await confirmation.getByRole('button', { name: 'Stop and Close', exact: true }).click() | |
| await confirmation.getByRole('button', { name: 'Stop and Close', exact: true }).click() | |
| } | |
| await expect.poll(async () => (await tab.count()) === 0, { | |
| timeout: 5_000, | |
| }).toBe(true) |
There was a problem hiding this comment.
ℹ️ No new issues in this delta — the forced-click removal is the right deflake.
Reviewed changes — since the prior review (3f606c5), this commit swaps the two menu-item click({ force: true }) calls for Playwright's normal actionability-checked click().
New Terminalmenu item — now uses a plainclick(), so Playwright waits for the menu item to settle instead of clicking mid-animation.New Markdownmenu item — same change, resolving the Linux CI flake during the menu entrance animation.
The closeTabFromTabBar helper, the beforeEach render-readiness guard, and the two close call sites are unchanged. The prior minor nit (the helper hardcodes the Stop running command? dialog copy) remains the only open item and does not block merge.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No new issues in this delta — the startup-focus settle is the right deflake.
Reviewed changes — since the prior review (97dcdf6), this commit adds a single startup-focus settle wait to the shared Tabs beforeEach.
- Initial-terminal focus settle — after
ensureTerminalVisibleand the existing tab-visibility assertion, the block now polls until the initial terminal tab holds keyboard focus (getFocusedTerminalTabId), so theNew tabmenu opens into a state focus can't dismiss.
The closeTabFromTabBar helper, its two call sites, and the forced-click removal are unchanged. The previously flagged nit (the helper hardcodes the Stop running command? dialog copy) remains the only open item and does not block merge.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Important
The focus-event capture in this delta is diagnostic scaffolding for the Linux CI flake and should be stripped before the PR merges.
Reviewed changes — since the prior review (b11d6b8), this commit adds temporary focus-event instrumentation to the Tabs beforeEach to diagnose the remaining Linux CI menu-dismiss flake.
beforeEachfocus-event recorder — installs awindow.__deflakeMenuEventsring buffer (150 entries) that capturesfocus/blur/focusin/focusout/pointerdownevents plusHTMLElement.prototype.focuscalls, recording stacks on focus calls.afterEachfailure dump — when a test does not reach its expected status, logs the captured events under a[deflake-menu-events]prefix for CI diagnosis.
⚠️ Diagnostic instrumentation is not for merge
The recorder monkey-patches HTMLElement.prototype.focus and installs capture-phase listeners for every Tabs test. That is the right tool for the diagnosis in flight, and it is per-test safe (the orcaPage/electronApp fixture launches a fresh Electron instance per test, so the patch and listeners do not accumulate). But it is debug scaffolding — the __deflakeMenuEvents capture, the focus patch, and the afterEach dump should be removed once Linux CI confirms the fix, not shipped in the merged suite.
Technical details
# Remove diagnostic focus capture before merge
## Affected sites
- tests/e2e/tabs.spec.ts:92-121 — `beforeEach` installs the `__deflakeMenuEvents` recorder and patches `HTMLElement.prototype.focus`
- tests/e2e/tabs.spec.ts:128-139 — `afterEach` dumps captured events on failure
## Required outcome
- Once the flake root cause is confirmed on Linux CI, the `Tabs` suite runs without any temporary focus capture: no `__deflakeMenuEvents`, no focus monkey-patch, no `[deflake-menu-events]` dump.
## Open questions for the human
- Is the plan to keep the instrumentation only until Linux CI is green, then revert it in this same PR, or will it live a few more commits?DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No new issues in this delta — the diagnostic removal is the correct cleanup.
Reviewed changes — since the prior review (decb380), this commit strips the temporary focus-event instrumentation the prior review flagged as debug-only, and also drops the startup focus-settle poll.
- Removed
__deflakeMenuEventsdiagnostic recorder — thewindow.__deflakeMenuEventsring buffer, theHTMLElement.prototype.focusmonkey-patch, and the[deflake-menu-events]afterEachfailure dump are gone, resolving the prior⚠️that the instrumentation must not ship. - Removed the
beforeEachfocus-settle poll — the initial-terminal focus gate is gone after the root cause was identified as deferred layout focus; the actionability-based menu-itemclick()s and the render-readiness assertion are the retained deflakes. The menu-created-terminal focus assertion (tabs.spec.ts:135) is unchanged.
The one previously flagged minor nit (the closeTabFromTabBar helper hardcodes the Stop running command? dialog copy rather than the canonical Stop running command?|Stop this agent? regex its sibling specs use) remains open and unchanged; it does not block merge.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No new issues in this delta — the assertion relocation is correct. One pre-existing minor nit remains open.
Reviewed changes — since the prior review (50ab6c9), commit 7c2976b relocates the New Markdown menu-dismissal assertion to after editor readiness.
- Menu-dismissal assertion relocated — in
clicking "+" then "New Markdown" focuses the editor,expect(newMarkdownMenuItem).toBeHidden({ timeout: 3_000 })now runs after the file-creation and editor-visibility barriers instead of immediately after the menu-item click. This matches the Linux CI finding that the Radix menu stays mounted (visually closed) while the file is created and the editor is focused; the 3-second timeout and the focus/typing assertions are unchanged.
ℹ️ Nitpicks
- The
closeTabFromTabBarhelper still hardcodes theStop running command?dialog copy rather than the sibling specs'Stop running command?|Stop this agent?regex. Correct for the two current plain-terminal call sites, so it does not block merge.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
@pullfrog Please review the current head |
There was a problem hiding this comment.
✅ No new issues introduced by this merge. The
tests/e2e/tabs.spec.tsdiff is unchanged, and the changed E2E job passed (https://github.com/stablyai/orca/actions/runs/34074706619).
Reviewed changes — since the prior review (7c2976b), the branch merged current main (c71729e6f); the PR's own test diff is unchanged.
- Merged current
main— a clean two-parent merge (7c2976b+af5918a) that pulls the reviewed application prerequisites (including#18982) onto the branch. The PR diff againstmainis still a single file,tests/e2e/tabs.spec.ts, byte-identical to what prior reviews covered.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
* test: wait for rendered tabs and handle busy close confirmation * test: wait for create-menu item click actionability * test: settle initial terminal focus before create-menu actions * test: capture menu focus events for Linux CI diagnosis * test: remove menu diagnostics after identifying deferred layout focus * test: check Markdown menu dismissal after editor readiness

Tab tests can count before the first tab mounts and close a busy terminal without accepting its Stop and Close confirmation. Wait for the first rendered tab and handle that confirmation. Use normal menu-item clicks and check Markdown menu dismissal after editor readiness. Preserve tab-count, focus, keyboard-typing, and menu-hidden assertions.
Validation: all nine cases previously passed in Linux CI with #18982. That application fix is now merged; the branch includes current main and awaits final E2E, CI, and review.