Repository navigation
Fix flaky e2e tests - #5680
Fix flaky e2e tests#5680
Conversation
|
Ready to review this PR? Stage has broken it down into 6 individual chapters for you: Chapters generated by Stage for commit 48ea6ce on Jun 18, 2026 6:55am UTC. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR migrates commit-message AI generation in 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/renderer/src/components/right-sidebar/SourceControl.tsx (2)
1914-1930:⚠️ Potential issue | 🟠 Major | ⚡ Quick winGate draft hydration on the current generation request.
Line 1914 routes through the request-scoped store resolver, but Lines 1924-1930 still write
result.messageeven if the record was canceled or replaced before the runtime returned. A cancel race/failure can therefore populate the textarea after the user pressed Stop.Proposed fix
updateCommitMessageGenerationRecord(activeCommitMessageGenerationKey, (record) => resolveCommitMessageGenerationSuccess({ record, requestId, message: result.message }) ) + const currentCommitMessageGenerationRecord = + useAppStore.getState().commitMessageGenerationRecords[activeCommitMessageGenerationKey] + if ( + !currentCommitMessageGenerationRecord || + currentCommitMessageGenerationRecord.context.requestId !== requestId || + currentCommitMessageGenerationRecord.status !== 'succeeded' + ) { + return + } // Why: race protection — the user may have started typing into the // textarea while the agent was running. In that case we silently drop // the generated message rather than overwrite their in-progress edits. updateCommitDrafts((prev) => {
2031-2058:⚠️ Potential issue | 🟠 Major | ⚡ Quick winCancel using the store record instead of the local in-flight ref.
Line 2035 makes cancellation impossible after a Source Control remount: the UI can show Stop from the running store record, but the component-local
generateInFlightRefis reset tofalse. UseactiveCommitMessageGenerationRecordas the source of truth and cancel the original runtime context from the record.Proposed fix
const handleCancelGenerate = useCallback((): void => { - if (!activeWorktreeId || !worktreePath || !activeCommitMessageGenerationKey) { + if ( + !activeCommitMessageGenerationKey || + activeCommitMessageGenerationRecord?.status !== 'running' + ) { return } - if (!generateInFlightRef.current[activeWorktreeId]) { - return - } + const { context } = activeCommitMessageGenerationRecord updateCommitMessageGenerationRecord(activeCommitMessageGenerationKey, (record) => - resolveCommitMessageGenerationCancel(record) + !record || record.context.requestId !== context.requestId + ? null + : resolveCommitMessageGenerationCancel(record) ) - const connectionId = getConnectionId(activeWorktreeId) ?? undefined // Why: fire-and-forget — the in-flight generateCommitMessage promise // resolves with `{canceled: true}` once the kill propagates, which is // where the spinner is cleared. Awaiting here would just delay UI feedback. void cancelRuntimeGenerateCommitMessage({ // Why: route the cancel by the repo OWNER host, not the focused runtime. - settings: activeRepoSettings, - worktreeId: activeWorktreeId, - worktreePath, - connectionId + settings: context.runtimeTargetSettings, + worktreeId: context.worktreeId, + worktreePath: context.worktreePath, + connectionId: context.connectionId }) }, [ activeCommitMessageGenerationKey, - activeRepoSettings, - activeWorktreeId, + activeCommitMessageGenerationRecord, updateCommitMessageGenerationRecord, - worktreePath ])tests/e2e/tasks-page.spec.ts (1)
11-16:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd explicit error handling for missing store.
The optional chaining
store?.getState()will silently do nothing ifwindow.__storeis unavailable, making test failures harder to diagnose. Fail fast with a clear error message instead.🛡️ Proposed fix to add explicit error handling
async function openTasksPage(page: Parameters<typeof getStoreState>[0]): Promise<void> { await page.evaluate(() => { const store = window.__store - store?.getState().openTaskPage() + if (!store) { + throw new Error('window.__store is not available — is the app in dev mode?') + } + store.getState().openTaskPage() }) }
🧹 Nitpick comments (3)
tests/e2e/terminal-attention.spec.ts (1)
451-454: ⚡ Quick winPrefer a settle-based poll over a fixed 100ms delay.
A fixed wait can miss late-arriving focus escape bytes under CI contention and produce false passes. Poll for a short “no-new-bytes” quiet window before asserting captured output.
Also applies to: 456-458
tests/e2e/artificial-opencode-terminal-load.spec.ts (1)
279-297: ⚡ Quick winConsolidate PTY-content lookup with the shared readiness helper.
This duplicates the same pane-manager traversal logic already centralized in
terminal-pty-readiness.ts, which can drift over time.♻️ Proposed consolidation
+import { getTerminalContentForPtyId } from './terminal-pty-readiness' - -async function getTerminalContentForPtyId( - page: Page, - ptyId: string, - charLimit = 12_000 -): Promise<string> { - return page.evaluate( - ({ ptyId, charLimit }) => { - for (const manager of window.__paneManagers?.values() ?? []) { - for (const pane of manager.getPanes?.() ?? []) { - if (pane.container?.dataset?.ptyId === ptyId) { - return (pane.serializeAddon?.serialize?.() ?? '').slice(-charLimit) - } - } - } - return '' - }, - { ptyId, charLimit } - ) -} async function waitForTerminalOutputForPtyId( page: Page, ptyId: string, expected: string, timeoutMs: number ): Promise<void> { await expect - .poll(async () => (await getTerminalContentForPtyId(page, ptyId)).includes(expected), { + .poll(async () => (await getTerminalContentForPtyId(page, ptyId, 12_000)).includes(expected), { timeout: timeoutMs, message: `Terminal PTY ${ptyId} did not contain "${expected}"` }) .toBe(true) }Also applies to: 299-311
tests/e2e/worktree-row-locators.ts (1)
3-14: ⚡ Quick winAdd a short
Why:comment above the XPath literal escaping helper.Line 3 implements non-obvious escaping rules for mixed quote inputs; a one-line rationale will prevent accidental regressions during future test locator updates.
Suggested update
function xpathLiteral(value: string): string { + // Why: worktree IDs can include quotes; XPath needs safe literal construction (concat for mixed quotes). if (!value.includes("'")) { return `'${value}'` }As per coding guidelines, “When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does.”
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 72dea869-ab54-4994-97af-75d1ba53adf9
📥 Commits
Reviewing files that changed from the base of the PR and between c9bd613 and 2d64b9cd1945e6bdea43dfb6d56c456a7047e7eb.
📒 Files selected for processing (16)
src/renderer/src/components/right-sidebar/SourceControl.tsxsrc/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.tstests/e2e/artificial-opencode-terminal-load.spec.tstests/e2e/settings-display-name-ime.spec.tstests/e2e/source-control-pr-generation-switch.spec.tstests/e2e/tasks-page.spec.tstests/e2e/terminal-attention.spec.tstests/e2e/terminal-column-probes.tstests/e2e/terminal-long-table-scroll-restore.spec.tstests/e2e/terminal-pty-readiness.tstests/e2e/workspace-back-forward-navigation.spec.tstests/e2e/worktree-lineage.spec.tstests/e2e/worktree-row-locators.tstests/e2e/worktree-scroll-to-current.spec.tstests/e2e/worktree-smart-sort.spec.tstests/e2e/worktree-switch-responsiveness.spec.ts
2d64b9c to
726fb82
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 5ca5bf17-b4e9-48be-83dd-2de90d2bca21
📥 Commits
Reviewing files that changed from the base of the PR and between 2d64b9cd1945e6bdea43dfb6d56c456a7047e7eb and 726fb82f920347ca98f8d67e1e25ee61b0c1fc12.
📒 Files selected for processing (16)
src/renderer/src/components/right-sidebar/SourceControl.tsxsrc/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.tstests/e2e/artificial-opencode-terminal-load.spec.tstests/e2e/settings-display-name-ime.spec.tstests/e2e/source-control-pr-generation-switch.spec.tstests/e2e/tasks-page.spec.tstests/e2e/terminal-attention.spec.tstests/e2e/terminal-column-probes.tstests/e2e/terminal-long-table-scroll-restore.spec.tstests/e2e/terminal-pty-readiness.tstests/e2e/workspace-back-forward-navigation.spec.tstests/e2e/worktree-lineage.spec.tstests/e2e/worktree-row-locators.tstests/e2e/worktree-scroll-to-current.spec.tstests/e2e/worktree-smart-sort.spec.tstests/e2e/worktree-switch-responsiveness.spec.ts
🚧 Files skipped from review as they are similar to previous changes (14)
- tests/e2e/workspace-back-forward-navigation.spec.ts
- tests/e2e/worktree-switch-responsiveness.spec.ts
- tests/e2e/worktree-lineage.spec.ts
- tests/e2e/terminal-long-table-scroll-restore.spec.ts
- tests/e2e/worktree-row-locators.ts
- tests/e2e/terminal-pty-readiness.ts
- tests/e2e/tasks-page.spec.ts
- tests/e2e/worktree-scroll-to-current.spec.ts
- tests/e2e/terminal-column-probes.ts
- tests/e2e/artificial-opencode-terminal-load.spec.ts
- tests/e2e/terminal-attention.spec.ts
- src/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.ts
- tests/e2e/source-control-pr-generation-switch.spec.ts
- src/renderer/src/components/right-sidebar/SourceControl.tsx
ceb4127 to
d846573
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 30e7d544-0e4a-45a8-b9c0-dc22fb11ebd5
📥 Commits
Reviewing files that changed from the base of the PR and between 726fb82f920347ca98f8d67e1e25ee61b0c1fc12 and ceb4127a8e89c66c38217839759bb40e4bbbb1db.
📒 Files selected for processing (16)
src/renderer/src/components/right-sidebar/SourceControl.tsxsrc/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.tstests/e2e/artificial-opencode-terminal-load.spec.tstests/e2e/settings-display-name-ime.spec.tstests/e2e/source-control-pr-generation-switch.spec.tstests/e2e/tasks-page.spec.tstests/e2e/terminal-attention.spec.tstests/e2e/terminal-column-probes.tstests/e2e/terminal-long-table-scroll-restore.spec.tstests/e2e/terminal-pty-readiness.tstests/e2e/workspace-back-forward-navigation.spec.tstests/e2e/worktree-lineage.spec.tstests/e2e/worktree-row-locators.tstests/e2e/worktree-scroll-to-current.spec.tstests/e2e/worktree-smart-sort.spec.tstests/e2e/worktree-switch-responsiveness.spec.ts
🚧 Files skipped from review as they are similar to previous changes (15)
- tests/e2e/workspace-back-forward-navigation.spec.ts
- tests/e2e/worktree-switch-responsiveness.spec.ts
- tests/e2e/terminal-long-table-scroll-restore.spec.ts
- tests/e2e/settings-display-name-ime.spec.ts
- tests/e2e/worktree-scroll-to-current.spec.ts
- tests/e2e/worktree-smart-sort.spec.ts
- tests/e2e/artificial-opencode-terminal-load.spec.ts
- tests/e2e/terminal-column-probes.ts
- tests/e2e/worktree-row-locators.ts
- tests/e2e/worktree-lineage.spec.ts
- tests/e2e/source-control-pr-generation-switch.spec.ts
- tests/e2e/terminal-pty-readiness.ts
- tests/e2e/terminal-attention.spec.ts
- src/renderer/src/components/right-sidebar/SourceControl.tsx
- src/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.ts
d846573 to
1906a76
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: fedfdd40-4826-4aa1-9e9a-12a8e6007b32
📥 Commits
Reviewing files that changed from the base of the PR and between d846573dba4c68433180aaf95a6c42b13ad2b8a8 and 1906a76e9fba85546badba64a7a8a55b4143cde5.
📒 Files selected for processing (17)
src/renderer/src/components/TaskPage.tsxsrc/renderer/src/components/right-sidebar/SourceControl.tsxsrc/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.tstests/e2e/artificial-opencode-terminal-load.spec.tstests/e2e/settings-display-name-ime.spec.tstests/e2e/source-control-pr-generation-switch.spec.tstests/e2e/tasks-page.spec.tstests/e2e/terminal-attention.spec.tstests/e2e/terminal-column-probes.tstests/e2e/terminal-long-table-scroll-restore.spec.tstests/e2e/terminal-pty-readiness.tstests/e2e/workspace-back-forward-navigation.spec.tstests/e2e/worktree-lineage.spec.tstests/e2e/worktree-row-locators.tstests/e2e/worktree-scroll-to-current.spec.tstests/e2e/worktree-smart-sort.spec.tstests/e2e/worktree-switch-responsiveness.spec.ts
🚧 Files skipped from review as they are similar to previous changes (15)
- tests/e2e/terminal-long-table-scroll-restore.spec.ts
- tests/e2e/worktree-switch-responsiveness.spec.ts
- tests/e2e/worktree-row-locators.ts
- tests/e2e/settings-display-name-ime.spec.ts
- tests/e2e/terminal-column-probes.ts
- tests/e2e/workspace-back-forward-navigation.spec.ts
- tests/e2e/worktree-lineage.spec.ts
- tests/e2e/artificial-opencode-terminal-load.spec.ts
- tests/e2e/worktree-scroll-to-current.spec.ts
- src/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.ts
- tests/e2e/terminal-pty-readiness.ts
- tests/e2e/source-control-pr-generation-switch.spec.ts
- tests/e2e/terminal-attention.spec.ts
- tests/e2e/worktree-smart-sort.spec.ts
- src/renderer/src/components/right-sidebar/SourceControl.tsx
1906a76 to
48ea6ce
Compare
* upstream/main: (220 commits) Show and Filter Automation-Created Workspaces (stablyai#5697) Fix premature project header truncation Send review notes to any running agent of a worktree (stablyai#5654) Fix workspace sidebar appearance setting (stablyai#5725) Highlight the open file in the Source Control sidebar (stablyai#5667) release: v1.4.80-rc.1 Fix premature Codex completion notifications (stablyai#5682) Improve Codex startup prompt reliability (stablyai#5686) Keep hibernated agent completions visible (stablyai#5689) Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691) release: v1.4.80-rc.0 Skip GitHub CLI preflight checks if no GitHub projects exist fix: restore font family keyboard navigation in settings Update README downloads badge fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688) Fix nested workspace card indentation (stablyai#5684) Fix flaky e2e tests (stablyai#5680) Replace plus icon with play button on quick command entry (stablyai#5674) Use managed Pi and OMP extensions (stablyai#5681) Narrow computer-use e2e trigger (stablyai#5685) ... # Conflicts: # mobile/src/terminal/TerminalWebView.tsx # mobile/src/terminal/terminal-webview-text-zoom.test.ts
* upstream/main: (78 commits) Show and Filter Automation-Created Workspaces (stablyai#5697) Fix premature project header truncation Send review notes to any running agent of a worktree (stablyai#5654) Fix workspace sidebar appearance setting (stablyai#5725) Highlight the open file in the Source Control sidebar (stablyai#5667) release: v1.4.80-rc.1 Fix premature Codex completion notifications (stablyai#5682) Improve Codex startup prompt reliability (stablyai#5686) Keep hibernated agent completions visible (stablyai#5689) Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691) release: v1.4.80-rc.0 Skip GitHub CLI preflight checks if no GitHub projects exist fix: restore font family keyboard navigation in settings Update README downloads badge fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688) Fix nested workspace card indentation (stablyai#5684) Fix flaky e2e tests (stablyai#5680) Replace plus icon with play button on quick command entry (stablyai#5674) Use managed Pi and OMP extensions (stablyai#5681) Narrow computer-use e2e trigger (stablyai#5685) ... # Conflicts: # mobile/app/h/[hostId]/session/[worktreeId].tsx # mobile/src/terminal/TerminalWebView.tsx # mobile/src/terminal/terminal-webview-html.ts
* upstream/main: (220 commits) Show and Filter Automation-Created Workspaces (stablyai#5697) Fix premature project header truncation Send review notes to any running agent of a worktree (stablyai#5654) Fix workspace sidebar appearance setting (stablyai#5725) Highlight the open file in the Source Control sidebar (stablyai#5667) release: v1.4.80-rc.1 Fix premature Codex completion notifications (stablyai#5682) Improve Codex startup prompt reliability (stablyai#5686) Keep hibernated agent completions visible (stablyai#5689) Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691) release: v1.4.80-rc.0 Skip GitHub CLI preflight checks if no GitHub projects exist fix: restore font family keyboard navigation in settings Update README downloads badge fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688) Fix nested workspace card indentation (stablyai#5684) Fix flaky e2e tests (stablyai#5680) Replace plus icon with play button on quick command entry (stablyai#5674) Use managed Pi and OMP extensions (stablyai#5681) Narrow computer-use e2e trigger (stablyai#5685) ... # Conflicts: # src/renderer/src/i18n/locales/en.json # src/renderer/src/i18n/locales/es.json # src/renderer/src/i18n/locales/ja.json # src/renderer/src/i18n/locales/ko.json # src/renderer/src/i18n/locales/zh.json
* upstream/main: (341 commits) Show and Filter Automation-Created Workspaces (stablyai#5697) Fix premature project header truncation Send review notes to any running agent of a worktree (stablyai#5654) Fix workspace sidebar appearance setting (stablyai#5725) Highlight the open file in the Source Control sidebar (stablyai#5667) release: v1.4.80-rc.1 Fix premature Codex completion notifications (stablyai#5682) Improve Codex startup prompt reliability (stablyai#5686) Keep hibernated agent completions visible (stablyai#5689) Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691) release: v1.4.80-rc.0 Skip GitHub CLI preflight checks if no GitHub projects exist fix: restore font family keyboard navigation in settings Update README downloads badge fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688) Fix nested workspace card indentation (stablyai#5684) Fix flaky e2e tests (stablyai#5680) Replace plus icon with play button on quick command entry (stablyai#5674) Use managed Pi and OMP extensions (stablyai#5681) Narrow computer-use e2e trigger (stablyai#5685) ... # Conflicts: # src/main/text-generation/commit-message-text-generation.test.ts # src/main/text-generation/commit-message-text-generation.ts
Summary
Validation
Fixes the e2e failures from actions run 27735787935.