Repository navigation
Fix Codex skill preview terminal artifacts - #6940
Conversation
Co-authored-by: Orca <[email protected]>
|
Ready to review this PR? Stage has broken it down into 6 individual chapters for you: Chapters generated by Stage for commit 9b2890e on Jun 30, 2026 10:15pm UTC. |
|
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)
📝 WalkthroughWalkthroughThis PR adds 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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: 2
🧹 Nitpick comments (1)
src/renderer/src/components/terminal-pane/terminal-startup-grid-settle.ts (1)
84-88: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument why the first stable grid waits until
maxFrames.This branch intentionally refuses to settle an unchanged initial grid and only falls back at the cap. That behavior is non-obvious enough to read like a bug without a short
Why:note here. 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: ce6e6653-17fd-4346-9280-6df8f49259f5
📒 Files selected for processing (4)
src/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/terminal-startup-grid-settle.test.tssrc/renderer/src/components/terminal-pane/terminal-startup-grid-settle.tstests/e2e/terminal-codex-skill-preview-artifact-repro.spec.ts
| const createdId = await page.evaluate((workspaceName) => { | ||
| const state = window.__store?.getState() | ||
| const worktree = Object.values(state?.worktreesByRepo ?? {}) | ||
| .flat() | ||
| .find( | ||
| (candidate) => | ||
| candidate.displayName === workspaceName || candidate.path.endsWith(workspaceName) | ||
| ) | ||
| return worktree?.id ?? null | ||
| }, workspaceName) | ||
| if (!createdId) { | ||
| throw new Error(`Workspace ${workspaceName} disappeared after creation`) | ||
| } | ||
| await expect | ||
| .poll(() => getActiveWorktreeId(page), { | ||
| timeout: 30_000, | ||
| message: 'Created real Orca workspace did not become active' | ||
| }) | ||
| .toBe(createdId) | ||
| expect(createdId).not.toBe(previousWorktreeId) | ||
| return createdId |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Register the created worktree for cleanup before later assertions can throw.
createdId is known by Line 211, but cleanup is only registered after createWorkspaceThroughComposer returns. If the active-worktree assertion on Lines 214-220 fails, this real repo worktree is left behind.
Suggested fix
-async function createWorkspaceThroughComposer(page: Page, workspaceName: string): Promise<string> {
+async function createWorkspaceThroughComposer(
+ page: Page,
+ workspaceName: string,
+ onCreated?: (worktreeId: string) => void
+): Promise<string> {
@@
if (!createdId) {
throw new Error(`Workspace ${workspaceName} disappeared after creation`)
}
+ onCreated?.(createdId)
await expect
@@
- const worktreeId = await createWorkspaceThroughComposer(orcaPage, workspaceName)
- createdWorktreeIds.push(worktreeId)
+ const worktreeId = await createWorkspaceThroughComposer(orcaPage, workspaceName, (id) => {
+ createdWorktreeIds.push(id)
+ })Also applies to: 551-553
| async function waitForPaneVisibleContentChanges( | ||
| page: Page, | ||
| pane: PaneDescriptor, | ||
| expectedChanges: number, | ||
| timeoutMs: number | ||
| ): Promise<number> { | ||
| const deadline = Date.now() + timeoutMs | ||
| let changes = 0 | ||
| let previous = await readPaneVisibleContent(page, pane.tabId, pane.ptyId) | ||
| while (Date.now() < deadline && changes < expectedChanges) { | ||
| await page.waitForTimeout(450) | ||
| const next = await readPaneVisibleContent(page, pane.tabId, pane.ptyId) | ||
| if (next !== previous) { | ||
| changes += 1 | ||
| previous = next | ||
| } | ||
| } | ||
| return changes | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Fail when the expected setup-pane activity never happens.
waitForPaneVisibleContentChanges silently returns too-low counts, so the repro can capture evidence even when the setup pane did not keep changing during preview.
Suggested fix
while (Date.now() < deadline && changes < expectedChanges) {
@@
}
+ if (changes < expectedChanges) {
+ throw new Error(
+ `Terminal pane changed ${changes} times before timeout; expected ${expectedChanges}`
+ )
+ }
return changes
}Also applies to: 583-599
Co-authored-by: Orca <[email protected]>
…ng-glitches # Conflicts: # src/renderer/src/components/terminal-pane/pty-connection.ts
There was a problem hiding this comment.
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/terminal-pane/pty-connection.ts (1)
2491-2547: 🩺 Stability & Availability | 🔴 Critical | 🏗️ Heavy liftGrid-settle wait has no timeout fallback — can hang local startup-command panes forever on broken-rAF environments.
shouldSettleStartupGridBeforeConnect()now gates every visible local startup-command pane (not just setup-split ones) intosettleStartupGridBeforeConnect, whosewaitForStableStartupGridis driven purely byrequestAnimationFrame. Entering this branch explicitly cancelsconnectFallbackTimer(the 250mssetTimeoutsafety net) without re-arming any timer-based fallback for the new wait. The comment a few lines below (connectFallbackTimer = setTimeout(...)) documents exactly why that fallback exists: Why: Wayland/CI compositors can keep timers and CDP responsive while the next rAF never arrives; the terminal must still start its PTY once. In that same scenario, the grid-settle wait now has no analogous escape hatch — if rAF never fires, the PTY never spawns for any visible local startup-command pane.🐛 Proposed fix: re-arm an independent timeout fallback for the settle wait
const settleStartupGridBeforeConnect = (connect: () => void): void => { startupGridSettleHandle?.cancel() let settledSynchronously = false + // Why: rAF can stall indefinitely on Wayland/CI compositors (see the + // connectFallbackTimer rationale below); without an independent timeout + // this wait can hang forever and the PTY never spawns. + const settleFallbackTimer = setTimeout(() => { + startupGridSettleHandle?.cancel() + startupGridSettleHandle = null + connect() + }, STARTUP_GRID_SETTLE_FALLBACK_MS) const handle = waitForStableStartupGrid({ isAlive: () => !disposed, isReadyToSettle: paneStartup?.waitForSetupSplitDirection ? isStartupGridReadyForConnect : undefined, measure: measureStartupGrid, onSettled: () => { + clearTimeout(settleFallbackTimer) settledSynchronously = true startupGridSettleHandle = null connect() }, requestFrame: (callback) => requestAnimationFrame(callback), cancelFrame: (handle) => { if (typeof cancelAnimationFrame === 'function') { cancelAnimationFrame(handle) } } }) if (!settledSynchronously) { startupGridSettleHandle = handle } }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 95cc7986-643f-47d1-8633-9bb127030e15
📒 Files selected for processing (6)
src/renderer/src/components/terminal-pane/pty-connection-types.tssrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/terminal-startup-grid-settle.test.tssrc/renderer/src/components/terminal-pane/terminal-startup-grid-settle.tssrc/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/renderer/src/components/terminal-pane/terminal-startup-grid-settle.ts
Co-authored-by: Orca <[email protected]>
Summary
Tests
pnpm exec oxlint src/renderer/src/components/terminal-pane/pty-connection.ts src/renderer/src/components/terminal-pane/terminal-startup-grid-settle.ts src/renderer/src/components/terminal-pane/terminal-startup-grid-settle.test.ts tests/e2e/terminal-codex-skill-preview-artifact-repro.spec.tspnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-connection.test.ts src/renderer/src/components/terminal-pane/pty-size-reconcile.test.ts src/renderer/src/components/terminal-pane/split-right-white-screen.test.ts src/renderer/src/components/terminal-pane/terminal-startup-grid-settle.test.tspnpm exec electron-vite build --mode e2eSKIP_BUILD=1 ORCA_E2E_CODEX_SKILL_PREVIEW_REPRO=1 ORCA_E2E_EXPECT_NO_CODEX_SKILL_PREVIEW_ARTIFACTS=1 pnpm run test:e2e:headful -- tests/e2e/terminal-codex-skill-preview-artifact-repro.spec.ts --grep "real Orca repo setup-split"Made with Orca 🐋