Repository navigation
Gate the Gemini GPU fallback on pane-owner evidence instead of raw title text (title evidence plan, PR 1) - #7458
Conversation
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
…hase 2 baseline Co-authored-by: Orca <[email protected]>
Introduce the terminal-title evidence/renderer-policy resolver types and wire pty-connection's onTitleChange through one owner-aware decision. Raw title text can no longer disable GPU when stronger owner evidence attributes the pane to another agent (e.g. OMP/Pi with a gemini-like cwd), and the Gemini compatibility fallback now honors the user GPU setting precedence (off > on > auto). Co-authored-by: Orca <[email protected]>
The renderer Gemini-fallback veto now consumes pane-scoped, current ownership (foreground command inference, live hook row, this pane's initial status) instead of getAuthoritativePaneAgent, whose shared tab.launchAgent and never-cleared paneStartup.launchAgent could keep WebGL for a genuine Gemini sibling or reused pane. Display-label normalization still uses getAuthoritativePaneAgent. Also make the off-mode confidence match auto for identical inputs, and drop the hot-path conditional-spread allocations in resolvePaneTitleDecision. Co-authored-by: Orca <[email protected]>
Close the reused-pane residual: the renderer veto now ignores stale or `done` explicit rows (shared isFreshActivePaneAgentEntry predicate, reused by hasFreshPaneAgentSurface) and no longer reads the never-clearing paneStartup.initialAgentStatus seed. Only live command inference and a fresh, active hook row can veto the Gemini DOM fallback; genuine OMP/Pi panes stay protected by the isPiAgentTitle guard inside isGeminiTerminalTitle. Co-authored-by: Orca <[email protected]>
…-title-evidence-resolver # Conflicts: # src/renderer/src/components/terminal-pane/pty-connection.ts
|
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 (3)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds two new modules for terminal-pane title/renderer handling: a renderer policy resolver ( Changes
Sequence Diagram(s)sequenceDiagram
participant Pty as pty-connection
participant Decision as resolvePaneTitleDecision
participant Policy as resolvePaneRendererPolicy
participant Manager
participant Coordinator as agentCompletionCoordinator
Pty->>Pty: getAuthoritativePaneAgent()
Pty->>Pty: getPaneScopedRendererOwner()
Pty->>Decision: title, rawTitle, displayOwner, rendererOwner, gpuMode
Decision->>Policy: rawTitle, rendererOwnerAgentType, gpuMode, flags
Policy-->>Decision: RendererPolicyDecision
Decision-->>Pty: PaneTitleDecision
Pty->>Manager: setPaneGpuRendering(decision.rendererPolicy.gpuEnabled)
Pty->>Coordinator: observeTitle(decision.rawTitle)
Related issues: None referenced in the provided change data. Related PRs: None referenced in the provided change data. Suggested labels: terminal-pane, refactor, tests Suggested reviewers: None specified. Poem 🚥 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.
🧹 Nitpick comments (1)
src/renderer/src/components/terminal-pane/pty-connection.test.ts (1)
1010-1224: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract repeated
onTitleChangeretrieval boilerplate into a helper.The
createdTransportOptions[N]?.onTitleChangecast + null-check pattern is duplicated identically across 7 tests. A small helper would reduce duplication and centralize the error message.♻️ Proposed helper
+function getOnTitleChangeCallback(index: number): (title: string, rawTitle: string) => void { + const onTitleChange = createdTransportOptions[index]?.onTitleChange as + | ((title: string, rawTitle: string) => void) + | undefined + if (!onTitleChange) { + throw new Error(`missing title callback at index ${index}`) + } + return onTitleChange +}Then each test simplifies to
const onTitleChange = getOnTitleChangeCallback(0).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0f73c3b9-4e3c-4088-bd26-72d118e86149
📒 Files selected for processing (10)
docs/reference/terminal-title-evidence-plan.mdsrc/renderer/src/components/native-chat/native-chat-runtime-owner.tssrc/renderer/src/components/native-chat/native-chat-session-transport.test.tssrc/renderer/src/components/native-chat/use-native-chat-live-session.test.tssrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/terminal-renderer-policy.test.tssrc/renderer/src/components/terminal-pane/terminal-renderer-policy.tssrc/renderer/src/components/terminal-pane/terminal-title-evidence.test.tssrc/renderer/src/components/terminal-pane/terminal-title-evidence.ts
Co-authored-by: Orca <[email protected]>
…m settings Review follow-up: terminal-title-evidence.ts shipped TerminalTitleEvidence, AgentOwnerDecision, AgentActivityDecision, and the identity resolveTerminalTitleEvidence with zero production consumers after the plan doc left this PR; they now land in Phase 2 with their first consumer. TerminalGpuAccelerationMode now derives from GlobalSettings['terminalGpuAcceleration'] instead of hand-copying the union. Co-authored-by: Orca <[email protected]>
Brings in 9 commits: deferred remote catalogs at startup (#7087), owner-aware pane title decision gating the Gemini GPU fallback (#7458), incremental transcript parsing for JSONL agents (#7593), gh rate-limit and git-status spawn-churn fixes (#7595), WSL Codex session bridging (#7477), jump-palette subscription gating (#7558), and the IDE font dropdown fix. Conflict resolutions (our structure, main's semantics): - pty-connection.ts onTitleChange: kept this branch's third parameter and stale-derived-title guard (staleWorkingTitleClear must never feed completion tracking), grafted main's resolvePaneTitleDecision so the display label, GPU policy, and observeTitle all ride the owner-aware decision (#7428/#7447). - App.tsx startup: kept this branch's publishTerminalViewAttributesAtAppStart (hidden-at-launch OSC 10/11 replies) ahead of main's restructured local-first startup; dropped this branch's early ui.get() overlap — main's #7087 now awaits ui.get at effectively the same point, making it redundant. Gates: typecheck clean; 4298 tests across src/main/ipc, src/main/daemon, terminal-pane, pane-manager. The delivery path (ipc/pty.ts, dispatcher, scheduler, snapshots) had no conflicts and no incoming changes. Co-authored-by: Orca <[email protected]>
…tle text (title evidence plan, PR 1) (stablyai#7458) Co-authored-by: Orca <[email protected]>
Rollout PR 1 of the terminal title evidence plan: Phase 1 — name and fence the current behavior. The plan's Phases 2-4 are follow-up PRs. (The plan document itself is no longer part of this PR: the standalone docs PR #7452 was closed, and the in-repo copy was dropped from this branch — the phase framing lives in this description.)
Invariant statement
Raw OSC title text may provide display text and weak status evidence, but it can no longer decide renderer (GPU/WebGL) policy when stronger, pane-scoped owner evidence exists. Display labels, runtime pane titles, and completion tracking now derive from one resolved title decision per frame instead of re-interpreting the title independently.
What changed
terminal-renderer-policy.ts(renderer precedence resolver) andterminal-title-evidence.ts(unifiedresolvePaneTitleDecision: one owner-aware display label + renderer decision per title frame) in the terminal-pane domain.pty-connection.tsonTitleChangenow derives the display label and the per-pane GPU gate from a single resolver call; the raw!isGeminiTerminalTitle(rawTitle)toggle is gone.off>on(agent-compat exclusions cannot override expliciton) >auto(Gemini compatibility fallback fires only when no current pane-scoped non-Gemini owner exists).done) hook row for that pane. Tab-shared launch identity and never-clearing startup seeds are deliberately excluded so a genuine Gemini pane in a split or reused pane keeps its DOM fallback.Intended behavior changes (everything else is behavior-preserving)
geminikeeps WebGL — the#7428regression class. This also removes per-frame WebGL dispose churn those panes previously suffered.on, a genuine Gemini pane now keeps WebGL (previously title-forced to DOM even underon). Plan-sanctioned (renderer precedence rule 2). Risk is cosmetic: the original Gemini DOM fallback addressed flicker, not crashes. Defaultautobehavior for genuine Gemini is unchanged (still DOM).Review evidence
Three independent adversarial reviews (precedence correctness, perf hot path, reliability gates) + two fix rounds, re-verified by the original finder:
offproven unable to reach WebGL through any ordering (all attach paths gate onshouldUseTerminalWebgl);#7447string shapes replayed. Found the tab-scoped-owner P2 → fixed (pane-scoped veto) → re-reviewed, residual staleness path also closed (freshness + not-donegate, shared predicate withhasFreshPaneAgentSurface).getStateread and a few short-lived allocations per title frame; no new polling/IPC/timers/writes; WebGL churn strictly reduced. Store-write dedupe paths still hit (byte-identical display strings).TerminalTitleEvidence,AgentOwnerDecision,AgentActivityDecision, identityresolveTerminalTitleEvidence) were trimmed from this slice — they land in Phase 2 with their first consumer — andTerminalGpuAccelerationModenow derives fromGlobalSettings['terminalGpuAcceleration']instead of hand-copying the union.Consumer intents touched / deferred
Touched: renderer policy, display (label), transport hand-off to completion tracking (same values, same frequency). Deferred to Phase 2/3 per plan: aggregate status consumers,
AgentOwnerDecision/AgentActivityDecisionproduction (the types now ship with their first consumer rather than unwired here), module split.webglUnavailable/inContextLossContainmentresolver inputs are typed and unit-tested but intentionally unwired — the pane manager's downstream capability/context-loss latches remain authoritative.Tests
terminal-renderer-policy.test.ts,terminal-title-evidence.test.ts,pty-connection.test.ts,agent-detection.test.ts,use-tab-agent.test.ts;pnpm typecheck(node+cli+web), oxlint, oxfmt clean.tab.launchAgent; reused pane with stale launch/done/stale hook rows DOM-gates; one split pane's title cannot change another pane's GPU state; per-token cwd matrix (gemini/claude/codex/opencode/cursor/omp/pi); userauto/on/off, WebGL-unavailable, context-loss.Manual validation (desktop + SSH, run 2026-07-05)
Live dev build of this branch (fresh profile), driven via CDP; renderer state probed per pane (WebGL = canvas layers present, DOM = populated
.xterm-rows), with screenshots. All passed:gemini-classified title keeps WebGL (command-inferredclaudewrapper emitting a baregeminiOSC title; display title showed "Gemini CLI" while GPU stayed on — the exact#7428class, live).autoDOM-gates, and a reused pane whose prior command inference wasclaudedid not stick as a stale veto.offforces DOM on a WebGL-eligible pane; back toautore-attaches WebGL for the shell pane while the Gemini pane correctly stays DOM. Tab label follows the focused pane; sidebar status row agrees ("Gemini CLI - Idle").geminititle DOM-gates with no crash and no local foreground-process dependency; when the bash prompt title returns, the pane re-attaches WebGL.Remaining gap (known residual, deliberate boundary): in a shell without OSC 133 integration, a prior agent's still-fresh (<30 min, non-
done) pane-scoped hook row — or a command inference that neither 133;D nor a shell-title reversion has cleared — can keep WebGL on a genuine Gemini CLI launched in-place in the same PTY until the row goes stale. Failure direction is cosmetic (the flicker class the fallback targets; a real context loss still self-latches to DOM). Tightening the veto to process-verified ownership is Phase 2 scope. (Sleep/wake status aggregation is also Phase 2 scope and unchanged here.)