Repository navigation
Fix 6 e2e test flakes: worktree teardown, window focus, and terminal cleanup - #9625
Conversation
Tolerate selector_not_found during destructive worktree removal, retry transient window reopens with bounded attempts, collapse dead split leaves in parked tabs, stabilize tab-close persistence and diff-scroll assertions, and forward app logs for visibility into failures. Each fix addresses a root cause—not a test workaround —and includes a verification pass confirming no regressions. Fixes identified in shard-10 CI failure (oracle #29710852934).
This smoke-evidence file was used to track adversarial verification of the 6 e2e fixes during development. Now that the fixes are committed and tested, the temporary verification notes can be removed.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe changes make destructive worktree teardown tolerate unresolved runtime selectors, add bounded main-window reopen retries, and prioritize dead split-leaf cleanup for parked terminal watchers. E2E coverage is updated for timer behavior, window retries, watcher cleanup, scroll-height changes, activation-process logging, and durable split-tab closure after restart. Shared Electron log forwarding is exported for reuse by the activation test. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/window/focus-existing-window.test.ts (1)
232-256: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winTest doesn't actually prove "no 4th attempt" after exhaustion.
The inline comment claims "a further run() call must not schedule or fire a 4th attempt," but the test only calls
timer.run(300)twice before asserting. Since the exhausted attempt returns without scheduling a new timer, the assertions currently pass without ever confirming that a thirdrun(300)call fires nothing — a boundary regression (e.g.attempt > REOPEN_MAX_ATTEMPTSinstead of>=) that adds one extra scheduled retry wouldn't be caught here.✅ Suggested addition
timer.run(300) timer.run(300) // Why: REOPEN_MAX_ATTEMPTS caps total tries at 3 (1 initial + 2 retries); // a further run() call must not schedule or fire a 4th attempt. expect(openWindow).toHaveBeenCalledTimes(3) expect(warn).toHaveBeenCalledTimes(3) + timer.run(300) + expect(openWindow).toHaveBeenCalledTimes(3) + expect(warn).toHaveBeenCalledTimes(3) })
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7da071e8-d180-49c3-99d4-8bdcd8419e9a
📒 Files selected for processing (10)
src/main/runtime/worktree-teardown.test.tssrc/main/runtime/worktree-teardown.tssrc/main/window/focus-existing-window.test.tssrc/main/window/focus-existing-window.tssrc/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.test.tssrc/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.tstests/e2e/combined-diff-scroll-restore.spec.tstests/e2e/headless-serve-desktop-activation.spec.tstests/e2e/helpers/orca-app.tstests/e2e/terminal-tab-close-restart-persistence.spec.ts
Extract activateWindow to prevent drift between sync and async paths on win32 reinforcement (moveTop, pulseAlwaysOnTop, retry focus). Adds test coverage for window recovery on retry.
…cleanup (stablyai#9625) * Fix 6 e2e flakes: worktree teardown, window focus, and terminal cleanup Tolerate selector_not_found during destructive worktree removal, retry transient window reopens with bounded attempts, collapse dead split leaves in parked tabs, stabilize tab-close persistence and diff-scroll assertions, and forward app logs for visibility into failures. Each fix addresses a root cause—not a test workaround —and includes a verification pass confirming no regressions. Fixes identified in shard-10 CI failure (oracle #29710852934). * Remove E2E fix verification document This smoke-evidence file was used to track adversarial verification of the 6 e2e fixes during development. Now that the fixes are committed and tested, the temporary verification notes can be removed. * Unify win32 window activation for sync and retry paths Extract activateWindow to prevent drift between sync and async paths on win32 reinforcement (moveTop, pulseAlwaysOnTop, retry focus). Adds test coverage for window recovery on retry.
Summary
Fixes six e2e test flakes across worktree lifecycle, window management, terminal cleanup, scroll anchoring, and CI diagnostics:
selector_not_founderrors when tearing down just-created/removed worktrees that haven't resolved in the runtime graph yetORCA_E2E_FORWARD_APP_LOGS=1for CI failure investigationScreenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildAI Review Report
Changes focus on defensive error handling and race condition mitigation in lifecycle-critical paths. All additions tolerate transient state changes and missing resources. Cross-platform verified: window focus uses platform-agnostic setTimeout, terminal handlers work across all shell backends, scroll fix applies uniformly to Chromium rendering, e2e improvements are CI-neutral.
Security Audit
No security concerns. Changes affect only error handling and test assertions: safe resource tolerance (worktree teardown), Electron-only APIs (window retry), pure state mutations (terminal handlers), env-gated log output (e2e forwarding).
Notes
Window focus retry caps at 3 attempts with 300ms delay; terminal handler reordering fixes multi-pane collapse since destroyed parked PaneManager cannot modify persisted layout; scroll anchor check is conservative—only caps assertion when height stable since Chromium's native anchoring is legitimate on height changes.