Repository navigation
Split pty-connection.ts into focused modules under 400 lines - #15166
Conversation
|
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 change modularizes PTY connection setup across session contracts, deferred attachment, fresh spawning, reattachment, terminal restoration, hidden-output recovery, output scheduling, agent tracking, input handling, resizing, SSH recovery, E2E controls, serialization, and disposal. It adds UUID-linked cold-restore launch assertions, foreground-output budget tests, reattach payload tests, and a longer event-loop settling window for an updater test. It also removes the PTY connection file from the max-lines baseline allowlist. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
⚔️ Resolve merge conflicts 💡
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: 7
🧹 Nitpick comments (21)
src/renderer/src/components/terminal-pane/pty-connection/terminal-keydown-fit.ts (1)
5-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove or correct the two orphaned comments left by the file split.
Two comments no longer match this module:
- Lines 19-22 hold a JSDoc block describing PTY binding, input, output, title synchronization, and agent status tracking. An
import typestatement at line 24 separates it frominstallTerminalKeydownFit, so no tooling attaches it as the function doc. The text also describes the former monolithic module, not this installer.- Lines 5-6 explain a restored pane's stale-account prompt, but the import below is
parseAppSshPtyId, which this file uses only at line 247 to classify local Windows PTYs for inspection cost.Move the imports above the doc block, and rewrite the doc to describe what
installTerminalKeydownFitinstalls.As per coding guidelines: "Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code."
♻️ Proposed cleanup
-// Why: a restored pane's stale-account prompt can only be raised once a PTY is -// actually attached — nothing is inspectable while the session hydrates. import { parseAppSshPtyId } from '../../../../../shared/ssh-pty-id'import { isAgentTaskCompleteTrackingEnabled } from './agent-task-complete-settings' import { isRemoteRuntimePtyId } from './paired-parked-terminal-restore' +import type { ConnectPanePtySession } from './connect-pane-pty-session' -/** - * Establishes a binding between a terminal pane and its corresponding PTY stream, - * managing input, output, title synchronization, and agent status tracking. - */ - -import type { ConnectPanePtySession } from './connect-pane-pty-session' - +/** Installs terminal keydown intent handling, PTY fit binding, side-effect fact + * consumption, and the agent completion coordinator on the session. */ export function installTerminalKeydownFit(session: ConnectPanePtySession): void {Source: Coding guidelines
src/renderer/src/components/terminal-pane/pty-connection/agent-idle-working-handlers.ts (1)
9-11: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the misplaced "Why" comment above the import.
The comment describes a restored pane's stale-account prompt. The import below it resolves a runtime PTY environment id. The comment does not explain that import. The same comment block appears above unrelated imports in most new modules of this layer, which makes the extracted files harder to read.
src/renderer/src/components/terminal-pane/pty-connection/command-inferred-pane-agent.ts (1)
53-57: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdd parentheses to the mixed
||and ternary condition.The condition relies on
||binding tighter than?:. The current layout reads as ifisTuiAgent(registeredLaunchAgent) ? null : candidateAgentis the right operand of||. Parentheses make the intended grouping explicit and protect the behavior against future edits.♻️ Proposed clarification
- const nextAgent = - state.paneForegroundAgentByPaneKey[session.cacheKey]?.agent || - isTuiAgent(registeredLaunchAgent) - ? null - : candidateAgent + const nextAgent = + state.paneForegroundAgentByPaneKey[session.cacheKey]?.agent || + isTuiAgent(registeredLaunchAgent) + ? null + : candidateAgent + // grouping: (foregroundAgent || isTuiAgent(registeredLaunchAgent)) ? null : candidateAgentPrefer an explicit boolean:
const hasStrongerOwnership = Boolean( state.paneForegroundAgentByPaneKey[session.cacheKey]?.agent ) || isTuiAgent(registeredLaunchAgent) const nextAgent = hasStrongerOwnership ? null : candidateAgentsrc/renderer/src/components/terminal-pane/pty-connection/direct-ssh-retry-status.ts (1)
41-46: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winThe file split copied one docblock and one unrelated comment into every module. Each of these modules repeats the same "Establishes a binding between a terminal pane and its corresponding PTY stream" docblock, and most also carry a "restored pane's stale-account prompt" comment above an import that does not raise that prompt. Both are extraction artifacts, and they now misdescribe seven different installers.
src/renderer/src/components/terminal-pane/pty-connection/direct-ssh-retry-status.ts#L41-L46: replace the docblock with a one-line description ofinstallDirectSshRetryStatus, and delete the stale-account comment at lines 14-15.src/renderer/src/components/terminal-pane/pty-connection/pane-agent-identity.ts#L20-L25: replace the docblock with a one-line description ofinstallPaneAgentIdentity, and delete the stale-account comment at lines 6-7.src/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.ts#L16-L21: replace the docblock with a one-line description ofinstallPanePtyVisibilityBind, and delete the stale-account comment at lines 3-4.src/renderer/src/components/terminal-pane/pty-connection/pty-exit-hibernate.ts#L18-L23: replace the docblock with a one-line description ofinstallPtyExitHibernate, and delete the stale-account comment at lines 11-12.src/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.ts#L25-L30: replace the docblock with a one-line description ofinstallPtyInputRecovery, and delete the stale-account comment at lines 14-15.src/renderer/src/components/terminal-pane/pty-connection/transport-output-callbacks.ts#L7-L12: replace the docblock with a one-line description ofbindCaptureTransportOutputCallbacks, and delete the stale-account comment at lines 3-4.src/renderer/src/components/terminal-pane/pty-connection/write-pty-output-to-xterm.ts#L15-L20: replace the docblock with a one-line description ofbindWritePtyOutputToXterm, and delete the stale-account comment at lines 3-4.As per coding guidelines: "Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code."
Source: Coding guidelines
src/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.ts (1)
272-280: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider moving the grace window to
pty-connect-limits.ts.
TRANSPORT_CONNECT_SETTLE_GRACE_MSis a fixed policy value, but it is stored per session. The cohort already keeps such values inpty-connect-limits.ts(for exampleDIRECT_SSH_PANE_RETRY_SETTLEMENT_TIMEOUT_MS). A module constant removes one mutable field fromConnectPanePtySession. Keep the session field if a test overrides it at runtime.src/renderer/src/components/terminal-pane/pty-connection/connect-pane-pty-session.ts (1)
6-12: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueThe
[key: string]: anyindex signature disables type checking for all derivedPicktypes.Every member other than
pane,manager, anddepsresolves toany. This also affects consumers that narrow the bag. For example,ReattachPayloadSessioninreattach-payload-session.tsusesPick<ConnectPanePtySession, ...>; because of the index signature, each picked key resolves toany, and a misspelled key still compiles. The narrowing contract that the PR objectives describe as isolating "required capabilities" therefore provides documentation value only, not compile-time enforcement.This is acceptable for a mechanical extraction. Plan a follow-up that declares the real member types on the bag and then removes the index signature, so the
Pick-based session contracts start enforcing their members.src/renderer/src/components/terminal-pane/pty-connection/pane-serializer-register.ts (1)
4-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winTwo copied comment artifacts repeat across the extracted modules. The mechanical split duplicated a header comment block into each new module without re-scoping it, producing two misleading comments in seven files.
The first artifact is the comment "a restored pane's stale-account prompt can only be raised once a PTY is actually attached", which now sits above an unrelated import in each file. The second artifact is the docblock "Establishes a binding between a terminal pane and its corresponding PTY stream, managing input, output, title synchronization, and agent status tracking", which describes the former monolith rather than the module it heads. Both mislead a reader about what the module does, and the coding guidelines require comments to be non-obvious and to avoid explaining behavior that is not there.
src/renderer/src/components/terminal-pane/pty-connection/pane-serializer-register.ts#L4-L15: delete the stale-account comment above the output-scheduler import and replace the generic docblock with one describing serializer and title-source registration.src/renderer/src/components/terminal-pane/pty-connection/session-reconcile-dispose.ts#L9-L10: delete the stale-account comment above thediscardTerminalOutputimport.src/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-start.ts#L3-L20: delete the stale-account comment and replace the generic docblock with one describing fresh-spawn orchestration.src/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.ts#L4-L17: delete the stale-account comment and replace the generic docblock with one describing reattach-result handling.src/renderer/src/components/terminal-pane/pty-connection/reattach-live-data-deferral.ts#L3-L12: delete the stale-account comment and replace the generic docblock with one describing live-data deferral.src/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-follow-reset.ts#L10-L25: delete the stale-account comment and replace the generic docblock with one describing follow-output reset and replay writes.src/renderer/src/components/terminal-pane/pty-connection/hidden-startup-renderer-query-write.ts#L9-L22: delete the stale-account comment and replace the generic docblock with one describing hidden startup query extraction and salvage.As per coding guidelines: "Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code."
Source: Coding guidelines
src/renderer/src/components/terminal-pane/pty-connection/session-reconcile-dispose.ts (1)
174-300: 🩺 Stability & Availability | 🔵 Trivial | 🏗️ Heavy liftOne throwing teardown step aborts the rest of
dispose.
disposeruns about sixty teardown calls in a linear sequence with no error isolation. Many of these calls reach into xterm, the DOM, zustand subscriptions, and coordinator objects. If any one call throws, every later step is skipped. The pane then leaks the remaining timers, event listeners, subscriptions, and the hidden PTY delivery gate that line 213 releases.The behavior matches the previous monolithic implementation, so this is not a regression. The extraction is a good point to add isolation. Consider grouping the steps into small named teardown functions and invoking them through a helper that catches and logs per step, so a single failure cannot strand the pane.
src/renderer/src/components/terminal-pane/pty-connection/ssh-session-connect.ts (1)
90-118: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win
waitForSshConnectionshares one unbounded IPC call across all waiting panes.
window.api.ssh.connecthas no timeout. The promise is stored insshConnectPromisesand returned to every concurrent caller for the sameconnectionId. If the call never settles, all panes that await this connection stay pending, and thefinallyat line 112 never removes the entry, so new callers join the same stalled promise.The behavior is carried over from the previous implementation. Consider wrapping the call with an explicit timeout so a stalled SSH connect resolves to
{ connected: false, error }instead of blocking every pane that shares the connection.src/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-follow-reset.ts (1)
69-69: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMove
bindStartFreshSpawnto the composition root.
bindFreshSpawnFollowResetinstalls follow-reset, replay-write, and viewport-blanking behavior. Line 69 also installs the fresh-spawn starter from a different module, in the middle of unrelated assignments. This hides an installer dependency inside a sibling installer and makes the install order harder to read.Call
bindStartFreshSpawn(session)fromconnect-pane-pty.tsnext to the other installers instead. This aligns with the module-boundary goal of the refactor.src/renderer/src/components/terminal-pane/pty-connection/pane-serializer-settle.ts (1)
98-109: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the self-comparison in
getStartupDraftPtyId.Line 99 stores
session.transport.getPtyId()inptyId. Line 104 comparessession.transport.getPtyId()against that same value inside the same synchronous block, so the condition is always false. The check adds no protection and suggests a guard that does not exist. Keep the disposal and transport-identity checks only.♻️ Proposed simplification
const getStartupDraftPtyId = (): string | null => { const ptyId = session.transport.getPtyId() if ( !ptyId || session.disposed || - session.deps.paneTransportsRef.current.get(session.pane.id) !== session.transport || - session.transport.getPtyId() !== ptyId + session.deps.paneTransportsRef.current.get(session.pane.id) !== session.transport ) { return null } return ptyId }src/renderer/src/components/terminal-pane/pty-connection/deferred-session-attach.ts (3)
4-6: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove the stray comments carried over from the monolith.
The comment at Lines 4-6 describes a restored pane's stale-account prompt. It does not describe the
resolveSshPaneConnectGateimport below it. The JSDoc block at Lines 15-19 describes binding a pane to a PTY stream, but it is attached to no declaration and does not describerunDeferredSessionAttach. Both fragments also appear indeferred-session-reattach-choice.ts.Delete both fragments, or move the stale-account rationale to the code it explains.
As per coding guidelines: "Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code."
Also applies to: 15-19
Source: Coding guidelines
180-206: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueExtract the repeated pending-serializer cleanup.
The sequence that awaits
preSignalPromiseand then callswindow.api.pty.clearPendingPaneSerializer(session.cacheKey, gen)appears three times with an identical body (Lines 182-187, 201-206, 250-255). Extract one local helper inside the async block and call it from each site. This reduces the chance that a future change updates only some copies.♻️ Proposed helper
const clearPreSignaledSerializer = async (): Promise<void> => { const gen = await preSignalPromise if (typeof gen === 'number') { await window.api.pty.clearPendingPaneSerializer(session.cacheKey, gen).catch(() => {}) } }Also applies to: 248-255
4-19: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winComment fragments were copied during the file split without being re-anchored. Both modules carry the same stale-account "Why" note above an unrelated import and the same orphan JSDoc block about binding a pane to a PTY stream. Neither fragment describes the code it now precedes.
src/renderer/src/components/terminal-pane/pty-connection/deferred-session-attach.ts#L4-L19: delete the stale-account note above theresolveSshPaneConnectGateimport and the orphan JSDoc block above theConnectPanePtySessiontype import, or move the stale-account rationale to the code it explains.src/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-choice.ts#L3-L24: delete the duplicated stale-account note and the duplicated orphan JSDoc block, and reword the "inside the rAF" note at Line 24 so it names the caller's frame gap instead of arequestAnimationFramethat this module does not contain.As per coding guidelines: "Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code."
Source: Coding guidelines
src/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-choice.ts (1)
3-5: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winFix the comments carried over from the monolith.
Three comment fragments no longer match this module:
- Lines 3-5 describe a restored pane's stale-account prompt. They sit above the
isWebTerminalSurfaceTabIdimport and do not describe it.- Lines 16-20 form a JSDoc block about binding a pane to a PTY stream. It is attached to no declaration and does not describe
runDeferredSessionReattachChoice.- Line 24 says "re-read session IDs inside the rAF". This function contains no
requestAnimationFrame; the frame gap now lives in the caller.Delete the first two fragments. Reword Line 24 so it names the caller's frame gap.
As per coding guidelines: "Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code."
Also applies to: 16-20, 24-24
Source: Coding guidelines
src/renderer/src/components/terminal-pane/pty-connection/hidden-output-seq-and-skip.ts (2)
240-242: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMove the drain-outcome comment to the function it documents.
The comment at Line 240 explains the
'drained' | 'overflow' | 'refetch'return values.drainPendingLiveChunksAfterSnapshotis declared inhidden-output-restore-drain.tsat Lines 23-25. At this call site the comment documents only a bind call, so the meaning is lost.
12-23: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winComments were copied or detached during the file split. The extraction duplicated two module-level comment blocks into every new module, and it left three rationale comments separated from the code they describe. The shared root cause is comment provenance during the split, not the logic. Delete the copied blocks, and move each detached comment next to its declaration.
As per coding guidelines: "Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code."
src/renderer/src/components/terminal-pane/pty-connection/hidden-output-seq-and-skip.ts#L12-L23: delete the stale-account comment and the generic pane/PTY JSDoc; also move the drain-outcome comment at Line 240 todrainPendingLiveChunksAfterSnapshotinhidden-output-restore-drain.ts.src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-abandon.ts#L1-L11: delete the stale-account comment and the generic pane/PTY JSDoc.src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-chunk.ts#L1-L13: delete the stale-account comment and the generic pane/PTY JSDoc.src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-drain.ts#L4-L18: delete the stale-account comment and the generic pane/PTY JSDoc.src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-request.ts#L6-L27: delete the stale-account comment and the generic pane/PTY JSDoc.src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-snapshot.ts#L9-L30: delete the stale-account comment and the generic pane/PTY JSDoc.src/renderer/src/components/terminal-pane/pty-connection/hidden-output-snapshot-serialize.ts#L1-L12: delete the stale-account comment and the generic pane/PTY JSDoc; also move the suppression-window comment at Line 150 tonoteHiddenOutputRestoreFloodBackpressureinforeground-output-refresh.ts.src/renderer/src/components/terminal-pane/pty-connection/live-data-callback.ts#L4-L17: delete the stale-account comment and the generic pane/PTY JSDoc.src/renderer/src/components/terminal-pane/pty-connection/foreground-output-refresh.ts#L9-L10: delete the stale-account comment and the generic pane/PTY JSDoc at Lines 33-36; also move the DECSET 2031 comment at Lines 308-314 toobserveLiveMode2031Chunkinhidden-output-seq-and-skip.ts.Source: Coding guidelines
src/renderer/src/components/terminal-pane/pty-connection/hidden-output-snapshot-serialize.ts (2)
150-151: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMove or delete the orphaned trailing comment.
The comment at Line 150 describes how the suppression window is extended. The code it describes is
noteHiddenOutputRestoreFloodBackpressureinforeground-output-refresh.tsat Lines 41-57. Here it documents nothing.
17-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
HiddenOutputSnapshotResultis declared twice across a producer-consumer boundary.serializeHiddenOutputSnapshotreturns the union, andrequestHiddenOutputRestoreIfNeededswitches onkind. Two independent declarations can drift, and a new variant added on the producer side will not force the consumer to handle it.
src/renderer/src/components/terminal-pane/pty-connection/hidden-output-snapshot-serialize.ts#L17-L22: export the union as the single definition.src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-request.ts#L31-L36: delete the local declaration and import the exported type.src/renderer/src/components/terminal-pane/pty-connection/foreground-output-refresh.ts (2)
308-314: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMove or delete the orphaned trailing comment.
The comment at Lines 308-314 explains DECSET 2031 record-only handling. That behavior is
observeLiveMode2031Chunkinhidden-output-seq-and-skip.tsat Lines 35-57. At the end ofbindForegroundOutputRefreshit documents nothing.
203-214: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueThe rolling immediate-write budget is implemented twice. Both functions reset the window after
FOREGROUND_BUDGET_WINDOW_MS, compare accumulated chars against a cap, and accumulate on success. Only the state holder and the cap differ. Extract one helper that accepts the mutable state and the cap.
src/renderer/src/components/terminal-pane/pty-connection/foreground-output-refresh.ts#L203-L214: call the shared helper with the session-scoped state andFOREGROUND_IMMEDIATE_BUDGET_CHARS.src/renderer/src/components/terminal-pane/pty-connection/foreground-output-scan.ts#L118-L132: call the shared helper with the module-scoped state andINACTIVE_FOREGROUND_IMMEDIATE_BUDGET_CHARS.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 582c5118-0f93-4543-8226-cbba378c01fb
📥 Commits
Reviewing files that changed from the base of the PR and between 32ee3b0 and a018e7a1a04c5321d4bc88ad9dc23668add60b61.
📒 Files selected for processing (71)
config/max-lines-baseline.txtsrc/renderer/src/components/terminal-pane/pty-connection-agent-session-resume.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-connection/agent-done-started-at.tssrc/renderer/src/components/terminal-pane/pty-connection/agent-idle-working-handlers.tssrc/renderer/src/components/terminal-pane/pty-connection/agent-task-complete-notify.tssrc/renderer/src/components/terminal-pane/pty-connection/agent-task-complete-settings.tssrc/renderer/src/components/terminal-pane/pty-connection/apply-reattach-payload.tssrc/renderer/src/components/terminal-pane/pty-connection/codex-pane-stale.tssrc/renderer/src/components/terminal-pane/pty-connection/cold-restore-resume-startup.tssrc/renderer/src/components/terminal-pane/pty-connection/command-inferred-pane-agent.tssrc/renderer/src/components/terminal-pane/pty-connection/connect-pane-pty-session.tssrc/renderer/src/components/terminal-pane/pty-connection/connect-pane-pty.tssrc/renderer/src/components/terminal-pane/pty-connection/cursor-agent-reattach-screen.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-cold-restore-and-snapshot.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-session-attach.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-choice.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-connect.tssrc/renderer/src/components/terminal-pane/pty-connection/direct-ssh-retry-lease.tssrc/renderer/src/components/terminal-pane/pty-connection/direct-ssh-retry-status.tssrc/renderer/src/components/terminal-pane/pty-connection/e2e-terminal-pty-harness.tssrc/renderer/src/components/terminal-pane/pty-connection/foreground-output-budgets.tssrc/renderer/src/components/terminal-pane/pty-connection/foreground-output-refresh.tssrc/renderer/src/components/terminal-pane/pty-connection/foreground-output-scan.tssrc/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-follow-reset.tssrc/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-start.tssrc/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-types.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-abandon.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-chunk.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-drain.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-limits.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-request.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-snapshot.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-seq-and-skip.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-snapshot-serialize.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-restore-state-and-ssh-probe.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-startup-renderer-query-write.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-startup-renderer-query.tssrc/renderer/src/components/terminal-pane/pty-connection/interrupt-input-intent.tssrc/renderer/src/components/terminal-pane/pty-connection/live-data-callback.tssrc/renderer/src/components/terminal-pane/pty-connection/paired-parked-terminal-restore.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-agent-identity.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-pty-binding.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-serializer-register.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-serializer-settle.tssrc/renderer/src/components/terminal-pane/pty-connection/pending-hidden-output-restore-chunk.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-connect-limits.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-exit-hibernate.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-input-forward.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-resize-geometry.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-live-data-deferral.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-payload-context.test.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-payload-context.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-payload-session.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.tssrc/renderer/src/components/terminal-pane/pty-connection/replay-data-drain.tssrc/renderer/src/components/terminal-pane/pty-connection/retained-legacy-pty-attach.tssrc/renderer/src/components/terminal-pane/pty-connection/run-deferred-connect.tssrc/renderer/src/components/terminal-pane/pty-connection/session-reconcile-dispose.tssrc/renderer/src/components/terminal-pane/pty-connection/setup-split-geometry.tssrc/renderer/src/components/terminal-pane/pty-connection/shell-command-inference.tssrc/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.tssrc/renderer/src/components/terminal-pane/pty-connection/ssh-session-connect.tssrc/renderer/src/components/terminal-pane/pty-connection/ssh-snapshot-prepaint.tssrc/renderer/src/components/terminal-pane/pty-connection/startup-cwd-fallback-notice.tssrc/renderer/src/components/terminal-pane/pty-connection/terminal-keydown-fit.tssrc/renderer/src/components/terminal-pane/pty-connection/title-spawn-bell.tssrc/renderer/src/components/terminal-pane/pty-connection/transport-output-callbacks.tssrc/renderer/src/components/terminal-pane/pty-connection/write-pty-output-to-xterm.ts
💤 Files with no reviewable changes (1)
- config/max-lines-baseline.txt
Included review availability: Your plan includes up to 10 reviews per rolling hour; 8 remain after this review.
|
@coderabbitai Fixing. Will be in the next commit |
|
Tip For best results, initiate chat on the files or code changes.
You are interacting with an AI system. |
8c4e2b6 to
9761e45
Compare
|
@coderabbitai Fixing. Will be in the next commit |
|
Tip For best results, initiate chat on the files or code changes.
You are interacting with an AI system. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 22329f96-7a93-4755-97af-ae99458792b6
📒 Files selected for processing (48)
src/renderer/src/components/terminal-pane/pty-connection/agent-idle-working-handlers.tssrc/renderer/src/components/terminal-pane/pty-connection/agent-task-complete-notify.tssrc/renderer/src/components/terminal-pane/pty-connection/apply-reattach-payload.tssrc/renderer/src/components/terminal-pane/pty-connection/cold-restore-resume-startup.tssrc/renderer/src/components/terminal-pane/pty-connection/command-inferred-pane-agent.tssrc/renderer/src/components/terminal-pane/pty-connection/connect-pane-pty.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-cold-restore-and-snapshot.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-session-attach.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-choice.tssrc/renderer/src/components/terminal-pane/pty-connection/direct-ssh-retry-status.tssrc/renderer/src/components/terminal-pane/pty-connection/foreground-output-budgets.tssrc/renderer/src/components/terminal-pane/pty-connection/foreground-output-refresh.tssrc/renderer/src/components/terminal-pane/pty-connection/foreground-output-scan.tssrc/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-follow-reset.tssrc/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-start.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-abandon.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-chunk.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-drain.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-request.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-snapshot.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-seq-and-skip.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-snapshot-serialize.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-restore-state-and-ssh-probe.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-startup-renderer-query-write.tssrc/renderer/src/components/terminal-pane/pty-connection/interrupt-input-intent.tssrc/renderer/src/components/terminal-pane/pty-connection/live-data-callback.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-agent-identity.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-serializer-register.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-serializer-settle.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-connect-limits.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-exit-hibernate.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-input-forward.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-resize-geometry.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-live-data-deferral.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.tssrc/renderer/src/components/terminal-pane/pty-connection/replay-data-drain.tssrc/renderer/src/components/terminal-pane/pty-connection/retained-legacy-pty-attach.tssrc/renderer/src/components/terminal-pane/pty-connection/run-deferred-connect.tssrc/renderer/src/components/terminal-pane/pty-connection/session-reconcile-dispose.tssrc/renderer/src/components/terminal-pane/pty-connection/shell-command-inference.tssrc/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.tssrc/renderer/src/components/terminal-pane/pty-connection/ssh-snapshot-prepaint.tssrc/renderer/src/components/terminal-pane/pty-connection/terminal-keydown-fit.tssrc/renderer/src/components/terminal-pane/pty-connection/title-spawn-bell.tssrc/renderer/src/components/terminal-pane/pty-connection/transport-output-callbacks.tssrc/renderer/src/components/terminal-pane/pty-connection/write-pty-output-to-xterm.ts
💤 Files with no reviewable changes (22)
- src/renderer/src/components/terminal-pane/pty-connection/cold-restore-resume-startup.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-abandon.ts
- src/renderer/src/components/terminal-pane/pty-connection/retained-legacy-pty-attach.ts
- src/renderer/src/components/terminal-pane/pty-connection/agent-task-complete-notify.ts
- src/renderer/src/components/terminal-pane/pty-connection/replay-data-drain.ts
- src/renderer/src/components/terminal-pane/pty-connection/agent-idle-working-handlers.ts
- src/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.ts
- src/renderer/src/components/terminal-pane/pty-connection/session-reconcile-dispose.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-snapshot.ts
- src/renderer/src/components/terminal-pane/pty-connection/run-deferred-connect.ts
- src/renderer/src/components/terminal-pane/pty-connection/pty-input-forward.ts
- src/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-start.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-chunk.ts
- src/renderer/src/components/terminal-pane/pty-connection/live-data-callback.ts
- src/renderer/src/components/terminal-pane/pty-connection/shell-command-inference.ts
- src/renderer/src/components/terminal-pane/pty-connection/ssh-snapshot-prepaint.ts
- src/renderer/src/components/terminal-pane/pty-connection/pty-resize-geometry.ts
- src/renderer/src/components/terminal-pane/pty-connection/interrupt-input-intent.ts
- src/renderer/src/components/terminal-pane/pty-connection/title-spawn-bell.ts
- src/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.ts
- src/renderer/src/components/terminal-pane/pty-connection/reattach-live-data-deferral.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-restore-state-and-ssh-probe.ts
🚧 Files skipped from review as they are similar to previous changes (24)
- src/renderer/src/components/terminal-pane/pty-connection/pane-serializer-register.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-startup-renderer-query-write.ts
- src/renderer/src/components/terminal-pane/pty-connection/foreground-output-scan.ts
- src/renderer/src/components/terminal-pane/pty-connection/direct-ssh-retry-status.ts
- src/renderer/src/components/terminal-pane/pty-connection/transport-output-callbacks.ts
- src/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-choice.ts
- src/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-snapshot-serialize.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-request.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-drain.ts
- src/renderer/src/components/terminal-pane/pty-connection/deferred-session-attach.ts
- src/renderer/src/components/terminal-pane/pty-connection/terminal-keydown-fit.ts
- src/renderer/src/components/terminal-pane/pty-connection/pty-connect-limits.ts
- src/renderer/src/components/terminal-pane/pty-connection/pane-serializer-settle.ts
- src/renderer/src/components/terminal-pane/pty-connection/command-inferred-pane-agent.ts
- src/renderer/src/components/terminal-pane/pty-connection/write-pty-output-to-xterm.ts
- src/renderer/src/components/terminal-pane/pty-connection/apply-reattach-payload.ts
- src/renderer/src/components/terminal-pane/pty-connection/pty-exit-hibernate.ts
- src/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-follow-reset.ts
- src/renderer/src/components/terminal-pane/pty-connection/deferred-cold-restore-and-snapshot.ts
- src/renderer/src/components/terminal-pane/pty-connection/connect-pane-pty.ts
- src/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-seq-and-skip.ts
- src/renderer/src/components/terminal-pane/pty-connection/foreground-output-refresh.ts
Included review availability: Your plan includes up to 10 reviews per rolling hour; 5 remain after this review.
|
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. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/terminal-pane/pty-connection/paired-parked-terminal-restore.ts (1)
21-23: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCondense the new
Why:comments.Use one concise line for each non-obvious constraint. Remove implementation walkthroughs.
src/renderer/src/components/terminal-pane/pty-connection/paired-parked-terminal-restore.ts#L21-L23: reduce the session-ID format explanation to one line.src/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.ts#L50-L51: reduce the legacy-alias selection explanation to one line.src/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.ts#L84-L85: reduce the stale-alias cleanup explanation to one line.src/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.ts#L115-L117: reduce the launch-token delivery explanation to one line.src/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.ts#L140-L140: shorten the deferred-connect reservation explanation.src/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.ts#L160-L161: reduce the daemon-identity explanation to one line.src/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.ts#L169-L170: reduce the reattach-metadata explanation to one line.As per coding guidelines, “Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code.”
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 06268779-2ced-4c2c-bf86-88f1348b8103
📒 Files selected for processing (76)
config/max-lines-baseline.txtconfig/scripts/pr-e2e-gate-contract.test.mjssrc/main/persistence-native-chat-tab-view-mode.test.tssrc/main/updater.linux-root-package-install.test.tssrc/renderer/src/components/terminal-pane/pty-connection-agent-session-resume.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-connection/agent-done-started-at.tssrc/renderer/src/components/terminal-pane/pty-connection/agent-idle-working-handlers.tssrc/renderer/src/components/terminal-pane/pty-connection/agent-task-complete-notify.tssrc/renderer/src/components/terminal-pane/pty-connection/agent-task-complete-settings.tssrc/renderer/src/components/terminal-pane/pty-connection/apply-reattach-payload.tssrc/renderer/src/components/terminal-pane/pty-connection/codex-pane-stale.tssrc/renderer/src/components/terminal-pane/pty-connection/cold-restore-resume-startup.tssrc/renderer/src/components/terminal-pane/pty-connection/command-inferred-pane-agent.tssrc/renderer/src/components/terminal-pane/pty-connection/connect-pane-pty-session.tssrc/renderer/src/components/terminal-pane/pty-connection/connect-pane-pty.tssrc/renderer/src/components/terminal-pane/pty-connection/cursor-agent-reattach-screen.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-cold-restore-and-snapshot.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-session-attach.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-choice.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-connect.tssrc/renderer/src/components/terminal-pane/pty-connection/direct-ssh-retry-lease.tssrc/renderer/src/components/terminal-pane/pty-connection/direct-ssh-retry-status.tssrc/renderer/src/components/terminal-pane/pty-connection/e2e-terminal-pty-harness.tssrc/renderer/src/components/terminal-pane/pty-connection/foreground-output-budgets.tssrc/renderer/src/components/terminal-pane/pty-connection/foreground-output-refresh.tssrc/renderer/src/components/terminal-pane/pty-connection/foreground-output-scan.tssrc/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-follow-reset.tssrc/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-start.tssrc/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-types.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-abandon.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-chunk.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-drain.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-limits.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-request.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-snapshot.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-seq-and-skip.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-snapshot-serialize.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-restore-state-and-ssh-probe.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-startup-renderer-query-write.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-startup-renderer-query.tssrc/renderer/src/components/terminal-pane/pty-connection/interrupt-input-intent.tssrc/renderer/src/components/terminal-pane/pty-connection/live-data-callback.tssrc/renderer/src/components/terminal-pane/pty-connection/paired-parked-terminal-restore.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-agent-identity.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-pty-binding.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-serializer-register.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-serializer-settle.tssrc/renderer/src/components/terminal-pane/pty-connection/pending-hidden-output-restore-chunk.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-connect-limits.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-exit-hibernate.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-input-forward.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-resize-geometry.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-live-data-deferral.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-payload-context.test.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-payload-context.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-payload-session.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.tssrc/renderer/src/components/terminal-pane/pty-connection/replay-data-drain.tssrc/renderer/src/components/terminal-pane/pty-connection/retained-legacy-pty-attach.tssrc/renderer/src/components/terminal-pane/pty-connection/run-deferred-connect.tssrc/renderer/src/components/terminal-pane/pty-connection/session-reconcile-dispose.tssrc/renderer/src/components/terminal-pane/pty-connection/setup-split-geometry.tssrc/renderer/src/components/terminal-pane/pty-connection/shell-command-inference.tssrc/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.tssrc/renderer/src/components/terminal-pane/pty-connection/ssh-session-connect.tssrc/renderer/src/components/terminal-pane/pty-connection/ssh-snapshot-prepaint.tssrc/renderer/src/components/terminal-pane/pty-connection/startup-cwd-fallback-notice.tssrc/renderer/src/components/terminal-pane/pty-connection/terminal-keydown-fit.tssrc/renderer/src/components/terminal-pane/pty-connection/title-spawn-bell.tssrc/renderer/src/components/terminal-pane/pty-connection/transport-output-callbacks.tssrc/renderer/src/components/terminal-pane/pty-connection/write-pty-output-to-xterm.tssrc/renderer/src/store/slices/worktree-helpers.tssrc/renderer/src/store/slices/worktrees/teardown/removed-worktree-renderer-teardown.ts
💤 Files with no reviewable changes (2)
- config/max-lines-baseline.txt
- src/renderer/src/store/slices/worktree-helpers.ts
🚧 Files skipped from review as they are similar to previous changes (66)
- src/renderer/src/components/terminal-pane/pty-connection/reattach-payload-session.ts
- src/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-types.ts
- src/renderer/src/components/terminal-pane/pty-connection/pane-pty-binding.ts
- src/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-follow-reset.ts
- src/renderer/src/components/terminal-pane/pty-connection/retained-legacy-pty-attach.ts
- src/renderer/src/components/terminal-pane/pty-connection/direct-ssh-retry-lease.ts
- src/renderer/src/components/terminal-pane/pty-connection/cold-restore-resume-startup.ts
- src/renderer/src/components/terminal-pane/pty-connection/reattach-payload-context.test.ts
- src/renderer/src/components/terminal-pane/pty-connection/startup-cwd-fallback-notice.ts
- src/renderer/src/components/terminal-pane/pty-connection/foreground-output-scan.ts
- src/renderer/src/components/terminal-pane/pty-connection/setup-split-geometry.ts
- src/renderer/src/components/terminal-pane/pty-connection/replay-data-drain.ts
- src/renderer/src/components/terminal-pane/pty-connection/pane-serializer-register.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-abandon.ts
- src/renderer/src/components/terminal-pane/pty-connection/connect-pane-pty-session.ts
- src/renderer/src/components/terminal-pane/pty-connection/pending-hidden-output-restore-chunk.ts
- src/renderer/src/components/terminal-pane/pty-connection/reattach-payload-context.ts
- src/renderer/src/components/terminal-pane/pty-connection/run-deferred-connect.ts
- src/renderer/src/components/terminal-pane/pty-connection/terminal-keydown-fit.ts
- src/renderer/src/components/terminal-pane/pty-connection/pty-exit-hibernate.ts
- src/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.ts
- src/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-chunk.ts
- src/renderer/src/components/terminal-pane/pty-connection/pty-input-forward.ts
- src/renderer/src/components/terminal-pane/pty-connection/transport-output-callbacks.ts
- src/renderer/src/components/terminal-pane/pty-connection/agent-done-started-at.ts
- src/renderer/src/components/terminal-pane/pty-connection/pty-connect-limits.ts
- src/renderer/src/components/terminal-pane/pty-connection/ssh-session-connect.ts
- src/renderer/src/components/terminal-pane/pty-connection/codex-pane-stale.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-startup-renderer-query.ts
- src/renderer/src/components/terminal-pane/pty-connection/cursor-agent-reattach-screen.ts
- src/renderer/src/components/terminal-pane/pty-connection/foreground-output-budgets.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-limits.ts
- src/renderer/src/components/terminal-pane/pty-connection/direct-ssh-retry-status.ts
- src/renderer/src/components/terminal-pane/pty-connection/command-inferred-pane-agent.ts
- src/renderer/src/components/terminal-pane/pty-connection/agent-task-complete-notify.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-drain.ts
- src/renderer/src/components/terminal-pane/pty-connection/foreground-output-refresh.ts
- src/renderer/src/components/terminal-pane/pty-connection/pty-resize-geometry.ts
- src/renderer/src/components/terminal-pane/pty-connection/reattach-live-data-deferral.ts
- src/renderer/src/components/terminal-pane/pty-connection/agent-idle-working-handlers.ts
- src/renderer/src/components/terminal-pane/pty-connection/session-reconcile-dispose.ts
- src/renderer/src/components/terminal-pane/pty-connection/connect-pane-pty.ts
- src/renderer/src/components/terminal-pane/pty-connection/pane-agent-identity.ts
- src/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-choice.ts
- src/renderer/src/components/terminal-pane/pty-connection/deferred-cold-restore-and-snapshot.ts
- src/renderer/src/components/terminal-pane/pty-connection/agent-task-complete-settings.ts
- src/renderer/src/components/terminal-pane/pty-connection/shell-command-inference.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-snapshot.ts
- src/renderer/src/components/terminal-pane/pty-connection/deferred-session-attach.ts
- src/renderer/src/components/terminal-pane/pty-connection/ssh-snapshot-prepaint.ts
- src/renderer/src/components/terminal-pane/pty-connection/write-pty-output-to-xterm.ts
- src/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.ts
- src/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-connect.ts
- src/renderer/src/components/terminal-pane/pty-connection/pane-serializer-settle.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-restore-state-and-ssh-probe.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-startup-renderer-query-write.ts
- src/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-start.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-snapshot-serialize.ts
- src/renderer/src/components/terminal-pane/pty-connection/e2e-terminal-pty-harness.ts
- src/renderer/src/components/terminal-pane/pty-connection/interrupt-input-intent.ts
- src/renderer/src/components/terminal-pane/pty-connection/apply-reattach-payload.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-request.ts
- src/renderer/src/components/terminal-pane/pty-connection/title-spawn-bell.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-seq-and-skip.ts
- src/renderer/src/components/terminal-pane/pty-connection/live-data-callback.ts
Included review availability: Your plan includes up to 10 reviews per rolling hour; 8 remain after this review.
bbfbb60 to
bbc7108
Compare
|
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. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/terminal-pane/pty-connection/pane-agent-identity.ts (1)
29-56: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the shared launch-agent candidate ladder.
paneExpectsLaunchAgentandresolveExpectedLaunchTuiAgentread the same four sources in the same order:tab?.launchAgent,session.paneStartup?.launchAgent,session.paneStartup?.initialAgentStatus?.agent, andstate.agentLaunchConfigByPaneKey[session.cacheKey]?.identity.agentType. Only the return shape differs. The comment on lines 22-24 states the goal of deriving each signal once so callers cannot drift. Two copies of the ladder can drift.Extract one candidate resolver and derive both results from it.
♻️ Proposed refactor
+ const resolveLaunchAgentCandidate = ( + state: ReturnType<typeof useAppStore.getState> + ): string | undefined => { + const tab = (state.tabsByWorktree[session.deps.worktreeId] ?? []).find( + (candidate) => candidate.id === session.deps.tabId + ) + return ( + tab?.launchAgent ?? + session.paneStartup?.launchAgent ?? + session.paneStartup?.initialAgentStatus?.agent ?? + state.agentLaunchConfigByPaneKey[session.cacheKey]?.identity.agentType + ) + } session.paneExpectsLaunchAgent = (state: ReturnType<typeof useAppStore.getState>): boolean => { - const tab = (state.tabsByWorktree[session.deps.worktreeId] ?? []).find( - (candidate) => candidate.id === session.deps.tabId - ) - const registeredLaunchAgent = - state.agentLaunchConfigByPaneKey[session.cacheKey]?.identity.agentType - return Boolean( - tab?.launchAgent ?? - session.paneStartup?.launchAgent ?? - session.paneStartup?.initialAgentStatus?.agent ?? - (isTuiAgent(registeredLaunchAgent) ? registeredLaunchAgent : undefined) - ) + return Boolean(resolveLaunchAgentCandidate(state)) } session.resolveExpectedLaunchTuiAgent = (): TuiAgent | null => { - const state = useAppStore.getState() - const tab = (state.tabsByWorktree[session.deps.worktreeId] ?? []).find( - (candidate) => candidate.id === session.deps.tabId - ) - const candidate = - tab?.launchAgent ?? - session.paneStartup?.launchAgent ?? - session.paneStartup?.initialAgentStatus?.agent ?? - state.agentLaunchConfigByPaneKey[session.cacheKey]?.identity.agentType + const candidate = resolveLaunchAgentCandidate(useAppStore.getState()) return isTuiAgent(candidate) ? candidate : null }Note:
paneExpectsLaunchAgentcurrently appliesisTuiAgentonly to the registered launch agent, so this refactor also changes the last rung to an unfiltered candidate. Keep the filter on that rung if the current asymmetry is intentional.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 02cde25e-be7e-42f8-91dc-60aa9771b9e1
📒 Files selected for processing (73)
config/max-lines-baseline.txtsrc/main/updater.linux-root-package-install.test.tssrc/renderer/src/components/terminal-pane/pty-connection-agent-session-resume.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-connection/agent-done-started-at.tssrc/renderer/src/components/terminal-pane/pty-connection/agent-idle-working-handlers.tssrc/renderer/src/components/terminal-pane/pty-connection/agent-task-complete-notify.tssrc/renderer/src/components/terminal-pane/pty-connection/agent-task-complete-settings.tssrc/renderer/src/components/terminal-pane/pty-connection/apply-reattach-payload.tssrc/renderer/src/components/terminal-pane/pty-connection/codex-pane-stale.tssrc/renderer/src/components/terminal-pane/pty-connection/cold-restore-resume-startup.tssrc/renderer/src/components/terminal-pane/pty-connection/command-inferred-pane-agent.tssrc/renderer/src/components/terminal-pane/pty-connection/connect-pane-pty-session.tssrc/renderer/src/components/terminal-pane/pty-connection/connect-pane-pty.tssrc/renderer/src/components/terminal-pane/pty-connection/cursor-agent-reattach-screen.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-cold-restore-and-snapshot.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-session-attach.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-choice.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-connect.tssrc/renderer/src/components/terminal-pane/pty-connection/direct-ssh-retry-lease.tssrc/renderer/src/components/terminal-pane/pty-connection/direct-ssh-retry-status.tssrc/renderer/src/components/terminal-pane/pty-connection/e2e-terminal-pty-harness.tssrc/renderer/src/components/terminal-pane/pty-connection/foreground-output-budgets.test.tssrc/renderer/src/components/terminal-pane/pty-connection/foreground-output-budgets.tssrc/renderer/src/components/terminal-pane/pty-connection/foreground-output-refresh.tssrc/renderer/src/components/terminal-pane/pty-connection/foreground-output-scan.tssrc/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-follow-reset.tssrc/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-start.tssrc/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-types.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-abandon.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-chunk.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-drain.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-limits.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-request.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-snapshot.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-seq-and-skip.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-output-snapshot-serialize.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-restore-state-and-ssh-probe.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-startup-renderer-query-write.tssrc/renderer/src/components/terminal-pane/pty-connection/hidden-startup-renderer-query.tssrc/renderer/src/components/terminal-pane/pty-connection/interrupt-input-intent.tssrc/renderer/src/components/terminal-pane/pty-connection/live-data-callback.tssrc/renderer/src/components/terminal-pane/pty-connection/paired-parked-terminal-restore.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-agent-identity.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-pty-binding.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-serializer-register.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-serializer-settle.tssrc/renderer/src/components/terminal-pane/pty-connection/pending-hidden-output-restore-chunk.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-connect-limits.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-exit-hibernate.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-input-forward.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-resize-geometry.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-live-data-deferral.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-payload-context.test.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-payload-context.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-payload-session.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.tssrc/renderer/src/components/terminal-pane/pty-connection/replay-data-drain.tssrc/renderer/src/components/terminal-pane/pty-connection/retained-legacy-pty-attach.tssrc/renderer/src/components/terminal-pane/pty-connection/run-deferred-connect.tssrc/renderer/src/components/terminal-pane/pty-connection/session-reconcile-dispose.tssrc/renderer/src/components/terminal-pane/pty-connection/setup-split-geometry.tssrc/renderer/src/components/terminal-pane/pty-connection/shell-command-inference.tssrc/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.tssrc/renderer/src/components/terminal-pane/pty-connection/ssh-session-connect.tssrc/renderer/src/components/terminal-pane/pty-connection/ssh-snapshot-prepaint.tssrc/renderer/src/components/terminal-pane/pty-connection/startup-cwd-fallback-notice.tssrc/renderer/src/components/terminal-pane/pty-connection/terminal-keydown-fit.tssrc/renderer/src/components/terminal-pane/pty-connection/title-spawn-bell.tssrc/renderer/src/components/terminal-pane/pty-connection/transport-output-callbacks.tssrc/renderer/src/components/terminal-pane/pty-connection/write-pty-output-to-xterm.ts
💤 Files with no reviewable changes (1)
- config/max-lines-baseline.txt
🚧 Files skipped from review as they are similar to previous changes (62)
- src/renderer/src/components/terminal-pane/pty-connection/startup-cwd-fallback-notice.ts
- src/renderer/src/components/terminal-pane/pty-connection/direct-ssh-retry-lease.ts
- src/renderer/src/components/terminal-pane/pty-connection/foreground-output-budgets.ts
- src/renderer/src/components/terminal-pane/pty-connection/reattach-payload-session.ts
- src/renderer/src/components/terminal-pane/pty-connection/pending-hidden-output-restore-chunk.ts
- src/main/updater.linux-root-package-install.test.ts
- src/renderer/src/components/terminal-pane/pty-connection/codex-pane-stale.ts
- src/renderer/src/components/terminal-pane/pty-connection/connect-pane-pty-session.ts
- src/renderer/src/components/terminal-pane/pty-connection/pane-pty-binding.ts
- src/renderer/src/components/terminal-pane/pty-connection/reattach-payload-context.test.ts
- src/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-types.ts
- src/renderer/src/components/terminal-pane/pty-connection/pane-serializer-register.ts
- src/renderer/src/components/terminal-pane/pty-connection/direct-ssh-retry-status.ts
- src/renderer/src/components/terminal-pane/pty-connection/cold-restore-resume-startup.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-abandon.ts
- src/renderer/src/components/terminal-pane/pty-connection/agent-task-complete-settings.ts
- src/renderer/src/components/terminal-pane/pty-connection/setup-split-geometry.ts
- src/renderer/src/components/terminal-pane/pty-connection/reattach-payload-context.ts
- src/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-snapshot-serialize.ts
- src/renderer/src/components/terminal-pane/pty-connection/pty-connect-limits.ts
- src/renderer/src/components/terminal-pane/pty-connection/terminal-keydown-fit.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-chunk.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-startup-renderer-query-write.ts
- src/renderer/src/components/terminal-pane/pty-connection/apply-reattach-payload.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-limits.ts
- src/renderer/src/components/terminal-pane/pty-connection/replay-data-drain.ts
- src/renderer/src/components/terminal-pane/pty-connection/session-reconcile-dispose.ts
- src/renderer/src/components/terminal-pane/pty-connection/retained-legacy-pty-attach.ts
- src/renderer/src/components/terminal-pane/pty-connection/paired-parked-terminal-restore.ts
- src/renderer/src/components/terminal-pane/pty-connection/ssh-session-connect.ts
- src/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-follow-reset.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-snapshot.ts
- src/renderer/src/components/terminal-pane/pty-connection/live-data-callback.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-startup-renderer-query.ts
- src/renderer/src/components/terminal-pane/pty-connection/cursor-agent-reattach-screen.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-restore-state-and-ssh-probe.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-request.ts
- src/renderer/src/components/terminal-pane/pty-connection/pty-exit-hibernate.ts
- src/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.ts
- src/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.ts
- src/renderer/src/components/terminal-pane/pty-connection/deferred-cold-restore-and-snapshot.ts
- src/renderer/src/components/terminal-pane/pty-connection/title-spawn-bell.ts
- src/renderer/src/components/terminal-pane/pty-connection/pane-serializer-settle.ts
- src/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-connect.ts
- src/renderer/src/components/terminal-pane/pty-connection/agent-idle-working-handlers.ts
- src/renderer/src/components/terminal-pane/pty-connection/agent-task-complete-notify.ts
- src/renderer/src/components/terminal-pane/pty-connection/ssh-snapshot-prepaint.ts
- src/renderer/src/components/terminal-pane/pty-connection/shell-command-inference.ts
- src/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-choice.ts
- src/renderer/src/components/terminal-pane/pty-connection/reattach-live-data-deferral.ts
- src/renderer/src/components/terminal-pane/pty-connection/hidden-output-seq-and-skip.ts
- src/renderer/src/components/terminal-pane/pty-connection/foreground-output-scan.ts
- src/renderer/src/components/terminal-pane/pty-connection/pty-input-forward.ts
- src/renderer/src/components/terminal-pane/pty-connection/interrupt-input-intent.ts
- src/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-start.ts
- src/renderer/src/components/terminal-pane/pty-connection/run-deferred-connect.ts
- src/renderer/src/components/terminal-pane/pty-connection/write-pty-output-to-xterm.ts
- src/renderer/src/components/terminal-pane/pty-connection/e2e-terminal-pty-harness.ts
- src/renderer/src/components/terminal-pane/pty-connection/transport-output-callbacks.ts
- src/renderer/src/components/terminal-pane/pty-connection/foreground-output-refresh.ts
- src/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
|
@coderabbitai Fixing. Will be in the next commit |
bbc7108 to
ee93e71
Compare
|
Tip For best results, initiate chat on the files or code changes.
You are interacting with an AI system. |
- Replace bindApplyReattachPayload with createReattachPayloadHandlers factory that returns handlers instead of mutating session directly, enabling better composability and testing - Extract waitForUserInitiatedSshConnect as standalone function for reuse across deferred session attach flows - Create ReattachPayloadSession type to document and isolate required session capabilities - Add test coverage for overlapping reattach payload attempts - Clean up comments to remove redundant prefixes (session.pane → pane, session.transport → transport)
- Fix terminal tail slice to take prefix instead of suffix, preserving escape sequence markers needed by next scan - Clear pending pane serializer when direct SSH retry PTY is unclaimed - Initialize interrupt status baseline to undefined so first input advances sequence counter - Bump reattach generation only after confirming current attempt owns the stream, preventing superseded results from canceling in-flight prepaint
- Fix terminal tail slice to take prefix instead of suffix, preserving escape sequence markers needed by next scan - Clear pending pane serializer when direct SSH retry PTY is unclaimed - Initialize interrupt status baseline to undefined so first input advances sequence counter - Bump reattach generation only after confirming current attempt owns the stream, preventing superseded results from canceling in-flight prepaint
Increase event loop turns from 40 to 200 in the timer settlement loop. Node 26's libuv poll phase can briefly starve when concurrent workers transform tests, causing cleanup to leak into the next test. The higher iteration count ensures async operations complete before returning.
At the exact window boundary, the budget should roll over. Change the comparison from > to >= so the window resets when now equals windowStart + FOREGROUND_BUDGET_WINDOW_MS, not just after. Add tests to verify budget rejection and rollover behavior.
- Track agent status observations with origin and transition metadata - Separate interactive redraw input timing from general terminal input - Restore pane authority on bind and reattach - Refine routing trust and confirmation state handling - Invoke queued startup callbacks when PTY is bound - Resolve Windows shell overrides with user settings
Consolidate duplicated launch-agent resolution logic into a shared helper to prevent future divergence between paneExpectsLaunchAgent and resolveExpectedLaunchTuiAgent.
Direct SSH reconnects now restore from the full SSH model snapshot (complete scrollback) when dimensions are compatible, instead of the bounded relay tail. Falls back gracefully when incompatible or alternate-screen was exited.
75fac73 to
ed16b65
Compare
Preserve deferred SSH session IDs longer when they serve as the only retry binding, allowing the system to attempt recovery through direct SSH retries or PTY remounts when reattach fails in an unverifiable way. Simplify reconnect model restoration by removing the conditional model snapshot probe and using relay replay directly.
# Conflicts: # src/renderer/src/components/terminal-pane/pty-connection.ts
Retry the terminal list assertion with polling to account for timing delays in PTY state reporting from the runtime.
Rebased onto the pty-connection.ts module split (stablyai#15166), which merged after this fix and reintroduced the pre-fix onAgentExited body at its new home in agent-idle-working-handlers.ts. Ports the same retire-on-confirmed-exit logic onto the session.* API the split introduced.
* refactor: split pty-connection.ts under 400 lines * rm design doc * refactor(pty-connection): extract reattach payload handlers as factories - Replace bindApplyReattachPayload with createReattachPayloadHandlers factory that returns handlers instead of mutating session directly, enabling better composability and testing - Extract waitForUserInitiatedSshConnect as standalone function for reuse across deferred session attach flows - Create ReattachPayloadSession type to document and isolate required session capabilities - Add test coverage for overlapping reattach payload attempts - Clean up comments to remove redundant prefixes (session.pane → pane, session.transport → transport) * fix(pty-connection): correct sequencing and state bugs in spawn and reat - Fix terminal tail slice to take prefix instead of suffix, preserving escape sequence markers needed by next scan - Clear pending pane serializer when direct SSH retry PTY is unclaimed - Initialize interrupt status baseline to undefined so first input advances sequence counter - Bump reattach generation only after confirming current attempt owns the stream, preventing superseded results from canceling in-flight prepaint * fix(pty-connection): correct sequencing and state bugs in spawn and reat - Fix terminal tail slice to take prefix instead of suffix, preserving escape sequence markers needed by next scan - Clear pending pane serializer when direct SSH retry PTY is unclaimed - Initialize interrupt status baseline to undefined so first input advances sequence counter - Bump reattach generation only after confirming current attempt owns the stream, preventing superseded results from canceling in-flight prepaint * fix(test): increase poll iterations to prevent Node 26 test leakage Increase event loop turns from 40 to 200 in the timer settlement loop. Node 26's libuv poll phase can briefly starve when concurrent workers transform tests, causing cleanup to leak into the next test. The higher iteration count ensures async operations complete before returning. * fix(foreground-output-budgets): use >= for budget window boundary check At the exact window boundary, the budget should roll over. Change the comparison from > to >= so the window resets when now equals windowStart + FOREGROUND_BUDGET_WINDOW_MS, not just after. Add tests to verify budget rejection and rollover behavior. * refactor(pty-connection): add status observations and routing improvemen - Track agent status observations with origin and transition metadata - Separate interactive redraw input timing from general terminal input - Restore pane authority on bind and reattach - Refine routing trust and confirmation state handling - Invoke queued startup callbacks when PTY is bound - Resolve Windows shell overrides with user settings * refactor: extract resolveLaunchAgentCandidate helper Consolidate duplicated launch-agent resolution logic into a shared helper to prevent future divergence between paneExpectsLaunchAgent and resolveExpectedLaunchTuiAgent. * refactor(pty-connection): use model snapshot for direct SSH reconnects Direct SSH reconnects now restore from the full SSH model snapshot (complete scrollback) when dimensions are compatible, instead of the bounded relay tail. Falls back gracefully when incompatible or alternate-screen was exited. * refactor(pty): retry unverifiable SSH reattaches via preserved bindings Preserve deferred SSH session IDs longer when they serve as the only retry binding, allowing the system to attempt recovery through direct SSH retries or PTY remounts when reattach fails in an unverifiable way. Simplify reconnect model restoration by removing the conditional model snapshot probe and using relay replay directly. * test: poll terminal readiness in expectSingleOwningPty Retry the terminal list assertion with polling to account for timing delays in PTY state reporting from the runtime.
…iation #15172's split modules pass providerExitObserved to onPtyExit, but the option was declared by #15212, which this release deliberately does not carry — it is only reachable via #15166, whose split silently drops the SSH reconnect model-paint gate from #14844 (STA-5395). Widen the option type so the split typechecks, and take #15212's assertion updates for the three test files that observe the call shape. The behaviour #15212 adds — reconciling agent status on a certified process death — is NOT included; the option is accepted and unused.
…16361) * fix(ssh): restore the reconnect model-paint gate dropped by #15166 #15166 split pty-connection.ts and dropped the "paint from main's model on SSH reconnect" half of the reattach gate that shipped in v1.4.188 (#14844), leaving only the park-reveal half. A non-park SSH reconnect has repainted from the ~100KiB relay tail ever since, which cannot rebuild a full-screen frame whose start it no longer holds. Restores followsDirectSshReconnect (PENDING-only retry read), reconnectMayUseModel, the exited-transition veto computed before the probe, and the kitty scanReplay layered after the snapshot baseline. Adds a call-site test over createReattachPayloadHandlers, because the surviving pure-function test stayed green through the entire removal. Fixes STA-5395 * fix(ssh): restore empty-tail reconnect snapshots
…i#15166) * refactor: split pty-connection.ts under 400 lines * rm design doc * refactor(pty-connection): extract reattach payload handlers as factories - Replace bindApplyReattachPayload with createReattachPayloadHandlers factory that returns handlers instead of mutating session directly, enabling better composability and testing - Extract waitForUserInitiatedSshConnect as standalone function for reuse across deferred session attach flows - Create ReattachPayloadSession type to document and isolate required session capabilities - Add test coverage for overlapping reattach payload attempts - Clean up comments to remove redundant prefixes (session.pane → pane, session.transport → transport) * fix(pty-connection): correct sequencing and state bugs in spawn and reat - Fix terminal tail slice to take prefix instead of suffix, preserving escape sequence markers needed by next scan - Clear pending pane serializer when direct SSH retry PTY is unclaimed - Initialize interrupt status baseline to undefined so first input advances sequence counter - Bump reattach generation only after confirming current attempt owns the stream, preventing superseded results from canceling in-flight prepaint * fix(pty-connection): correct sequencing and state bugs in spawn and reat - Fix terminal tail slice to take prefix instead of suffix, preserving escape sequence markers needed by next scan - Clear pending pane serializer when direct SSH retry PTY is unclaimed - Initialize interrupt status baseline to undefined so first input advances sequence counter - Bump reattach generation only after confirming current attempt owns the stream, preventing superseded results from canceling in-flight prepaint * fix(test): increase poll iterations to prevent Node 26 test leakage Increase event loop turns from 40 to 200 in the timer settlement loop. Node 26's libuv poll phase can briefly starve when concurrent workers transform tests, causing cleanup to leak into the next test. The higher iteration count ensures async operations complete before returning. * fix(foreground-output-budgets): use >= for budget window boundary check At the exact window boundary, the budget should roll over. Change the comparison from > to >= so the window resets when now equals windowStart + FOREGROUND_BUDGET_WINDOW_MS, not just after. Add tests to verify budget rejection and rollover behavior. * refactor(pty-connection): add status observations and routing improvemen - Track agent status observations with origin and transition metadata - Separate interactive redraw input timing from general terminal input - Restore pane authority on bind and reattach - Refine routing trust and confirmation state handling - Invoke queued startup callbacks when PTY is bound - Resolve Windows shell overrides with user settings * refactor: extract resolveLaunchAgentCandidate helper Consolidate duplicated launch-agent resolution logic into a shared helper to prevent future divergence between paneExpectsLaunchAgent and resolveExpectedLaunchTuiAgent. * refactor(pty-connection): use model snapshot for direct SSH reconnects Direct SSH reconnects now restore from the full SSH model snapshot (complete scrollback) when dimensions are compatible, instead of the bounded relay tail. Falls back gracefully when incompatible or alternate-screen was exited. * refactor(pty): retry unverifiable SSH reattaches via preserved bindings Preserve deferred SSH session IDs longer when they serve as the only retry binding, allowing the system to attempt recovery through direct SSH retries or PTY remounts when reattach fails in an unverifiable way. Simplify reconnect model restoration by removing the conditional model snapshot probe and using relay replay directly. * test: poll terminal readiness in expectSingleOwningPty Retry the terminal list assertion with polling to account for timing delays in PTY state reporting from the runtime. (cherry picked from commit 7a72f34)
…15166 (stablyai#16361) * fix(ssh): restore the reconnect model-paint gate dropped by stablyai#15166 stablyai#15166 split pty-connection.ts and dropped the "paint from main's model on SSH reconnect" half of the reattach gate that shipped in v1.4.188 (stablyai#14844), leaving only the park-reveal half. A non-park SSH reconnect has repainted from the ~100KiB relay tail ever since, which cannot rebuild a full-screen frame whose start it no longer holds. Restores followsDirectSshReconnect (PENDING-only retry read), reconnectMayUseModel, the exited-transition veto computed before the probe, and the kitty scanReplay layered after the snapshot baseline. Adds a call-site test over createReattachPayloadHandlers, because the surviving pure-function test stayed green through the entire removal. Fixes STA-5395 * fix(ssh): restore empty-tail reconnect snapshots (cherry picked from commit 656e489)
…i#15166) * refactor: split pty-connection.ts under 400 lines * rm design doc * refactor(pty-connection): extract reattach payload handlers as factories - Replace bindApplyReattachPayload with createReattachPayloadHandlers factory that returns handlers instead of mutating session directly, enabling better composability and testing - Extract waitForUserInitiatedSshConnect as standalone function for reuse across deferred session attach flows - Create ReattachPayloadSession type to document and isolate required session capabilities - Add test coverage for overlapping reattach payload attempts - Clean up comments to remove redundant prefixes (session.pane → pane, session.transport → transport) * fix(pty-connection): correct sequencing and state bugs in spawn and reat - Fix terminal tail slice to take prefix instead of suffix, preserving escape sequence markers needed by next scan - Clear pending pane serializer when direct SSH retry PTY is unclaimed - Initialize interrupt status baseline to undefined so first input advances sequence counter - Bump reattach generation only after confirming current attempt owns the stream, preventing superseded results from canceling in-flight prepaint * fix(pty-connection): correct sequencing and state bugs in spawn and reat - Fix terminal tail slice to take prefix instead of suffix, preserving escape sequence markers needed by next scan - Clear pending pane serializer when direct SSH retry PTY is unclaimed - Initialize interrupt status baseline to undefined so first input advances sequence counter - Bump reattach generation only after confirming current attempt owns the stream, preventing superseded results from canceling in-flight prepaint * fix(test): increase poll iterations to prevent Node 26 test leakage Increase event loop turns from 40 to 200 in the timer settlement loop. Node 26's libuv poll phase can briefly starve when concurrent workers transform tests, causing cleanup to leak into the next test. The higher iteration count ensures async operations complete before returning. * fix(foreground-output-budgets): use >= for budget window boundary check At the exact window boundary, the budget should roll over. Change the comparison from > to >= so the window resets when now equals windowStart + FOREGROUND_BUDGET_WINDOW_MS, not just after. Add tests to verify budget rejection and rollover behavior. * refactor(pty-connection): add status observations and routing improvemen - Track agent status observations with origin and transition metadata - Separate interactive redraw input timing from general terminal input - Restore pane authority on bind and reattach - Refine routing trust and confirmation state handling - Invoke queued startup callbacks when PTY is bound - Resolve Windows shell overrides with user settings * refactor: extract resolveLaunchAgentCandidate helper Consolidate duplicated launch-agent resolution logic into a shared helper to prevent future divergence between paneExpectsLaunchAgent and resolveExpectedLaunchTuiAgent. * refactor(pty-connection): use model snapshot for direct SSH reconnects Direct SSH reconnects now restore from the full SSH model snapshot (complete scrollback) when dimensions are compatible, instead of the bounded relay tail. Falls back gracefully when incompatible or alternate-screen was exited. * refactor(pty): retry unverifiable SSH reattaches via preserved bindings Preserve deferred SSH session IDs longer when they serve as the only retry binding, allowing the system to attempt recovery through direct SSH retries or PTY remounts when reattach fails in an unverifiable way. Simplify reconnect model restoration by removing the conditional model snapshot probe and using relay replay directly. * test: poll terminal readiness in expectSingleOwningPty Retry the terminal list assertion with polling to account for timing delays in PTY state reporting from the runtime.
…15166 (stablyai#16361) * fix(ssh): restore the reconnect model-paint gate dropped by stablyai#15166 stablyai#15166 split pty-connection.ts and dropped the "paint from main's model on SSH reconnect" half of the reattach gate that shipped in v1.4.188 (stablyai#14844), leaving only the park-reveal half. A non-park SSH reconnect has repainted from the ~100KiB relay tail ever since, which cannot rebuild a full-screen frame whose start it no longer holds. Restores followsDirectSshReconnect (PENDING-only retry read), reconnectMayUseModel, the exited-transition veto computed before the probe, and the kitty scanReplay layered after the snapshot baseline. Adds a call-site test over createReattachPayloadHandlers, because the surviving pure-function test stayed green through the entire removal. Fixes STA-5395 * fix(ssh): restore empty-tail reconnect snapshots
…i#15166) * refactor: split pty-connection.ts under 400 lines * rm design doc * refactor(pty-connection): extract reattach payload handlers as factories - Replace bindApplyReattachPayload with createReattachPayloadHandlers factory that returns handlers instead of mutating session directly, enabling better composability and testing - Extract waitForUserInitiatedSshConnect as standalone function for reuse across deferred session attach flows - Create ReattachPayloadSession type to document and isolate required session capabilities - Add test coverage for overlapping reattach payload attempts - Clean up comments to remove redundant prefixes (session.pane → pane, session.transport → transport) * fix(pty-connection): correct sequencing and state bugs in spawn and reat - Fix terminal tail slice to take prefix instead of suffix, preserving escape sequence markers needed by next scan - Clear pending pane serializer when direct SSH retry PTY is unclaimed - Initialize interrupt status baseline to undefined so first input advances sequence counter - Bump reattach generation only after confirming current attempt owns the stream, preventing superseded results from canceling in-flight prepaint * fix(pty-connection): correct sequencing and state bugs in spawn and reat - Fix terminal tail slice to take prefix instead of suffix, preserving escape sequence markers needed by next scan - Clear pending pane serializer when direct SSH retry PTY is unclaimed - Initialize interrupt status baseline to undefined so first input advances sequence counter - Bump reattach generation only after confirming current attempt owns the stream, preventing superseded results from canceling in-flight prepaint * fix(test): increase poll iterations to prevent Node 26 test leakage Increase event loop turns from 40 to 200 in the timer settlement loop. Node 26's libuv poll phase can briefly starve when concurrent workers transform tests, causing cleanup to leak into the next test. The higher iteration count ensures async operations complete before returning. * fix(foreground-output-budgets): use >= for budget window boundary check At the exact window boundary, the budget should roll over. Change the comparison from > to >= so the window resets when now equals windowStart + FOREGROUND_BUDGET_WINDOW_MS, not just after. Add tests to verify budget rejection and rollover behavior. * refactor(pty-connection): add status observations and routing improvemen - Track agent status observations with origin and transition metadata - Separate interactive redraw input timing from general terminal input - Restore pane authority on bind and reattach - Refine routing trust and confirmation state handling - Invoke queued startup callbacks when PTY is bound - Resolve Windows shell overrides with user settings * refactor: extract resolveLaunchAgentCandidate helper Consolidate duplicated launch-agent resolution logic into a shared helper to prevent future divergence between paneExpectsLaunchAgent and resolveExpectedLaunchTuiAgent. * refactor(pty-connection): use model snapshot for direct SSH reconnects Direct SSH reconnects now restore from the full SSH model snapshot (complete scrollback) when dimensions are compatible, instead of the bounded relay tail. Falls back gracefully when incompatible or alternate-screen was exited. * refactor(pty): retry unverifiable SSH reattaches via preserved bindings Preserve deferred SSH session IDs longer when they serve as the only retry binding, allowing the system to attempt recovery through direct SSH retries or PTY remounts when reattach fails in an unverifiable way. Simplify reconnect model restoration by removing the conditional model snapshot probe and using relay replay directly. * test: poll terminal readiness in expectSingleOwningPty Retry the terminal list assertion with polling to account for timing delays in PTY state reporting from the runtime.
…15166 (stablyai#16361) * fix(ssh): restore the reconnect model-paint gate dropped by stablyai#15166 stablyai#15166 split pty-connection.ts and dropped the "paint from main's model on SSH reconnect" half of the reattach gate that shipped in v1.4.188 (stablyai#14844), leaving only the park-reveal half. A non-park SSH reconnect has repainted from the ~100KiB relay tail ever since, which cannot rebuild a full-screen frame whose start it no longer holds. Restores followsDirectSshReconnect (PENDING-only retry read), reconnectMayUseModel, the exited-transition veto computed before the probe, and the kitty scanReplay layered after the snapshot baseline. Adds a call-site test over createReattachPayloadHandlers, because the surviving pure-function test stayed green through the entire removal. Fixes STA-5395 * fix(ssh): restore empty-tail reconnect snapshots
Problem
The
pty-connection.tsfile had grown to 9490 lines, making it unmaintainable and requiring anoxlint-disable max-linesexemption. Developers struggle to locate and modify specific concerns, and the file's sheer size inhibits testing and understanding.Solution
Extracted the monolithic file into 79 focused modules organized under
src/renderer/src/components/terminal-pane/pty-connection/. Each module now owns a discrete concern:Shared state is passed through a
ConnectPanePtySessiontype that each installer function mutates, avoiding circular dependencies. The split improves discoverability, testability, and code review surface without changing behavior.Testing
Test assertions in
pty-connection-agent-session-resume.test.tsimproved to extract and reuse the launch token, eliminating duplicate regex matchers.Notes