Repository navigation
Split local PTY provider responsibilities - #17206
Conversation
Greptile SummaryThis PR decomposes the local PTY provider into focused modules while preserving its facade and lifecycle behavior.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/main/providers/local-pty-provider.ts | Reduced to a facade that delegates the former monolithic responsibilities while retaining the public provider API. |
| src/main/providers/local-pty-spawn.ts | Coordinates launch planning, cancelable environment preparation, native spawning, and session activation. |
| src/main/providers/local-pty-provider-state.ts | Centralizes PTY identity, lifecycle, listener, cleanup, and load-generation state. |
| src/main/providers/local-pty-termination.ts | Encapsulates graceful and forced shutdown, descendant cleanup, physical-exit tracking, and timer ownership guards. |
| src/main/providers/local-pty-finalize-environment.ts | Preserves platform finalization, history isolation, shell wrapper configuration, and startup-delivery environment ordering. |
| src/main/providers/local-pty-launch-plan.ts | Encapsulates platform-specific shell selection, working-directory validation, WSL intent, and PowerShell fallback planning. |
| src/main/providers/local-pty-shell-readiness-session.ts | Owns readiness scanning and deferred startup-command delivery for an activated local PTY. |
| src/main/providers/local-pty-foreground-inspection.ts | Moves foreground process detection and cached Windows agent revalidation behind focused functions. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
F[LocalPtyProvider facade] --> P[Launch plan]
P --> E[Build and finalize environment]
E --> S[Spawn with platform fallback]
S --> A[Activate PTY session]
A --> R[Shell readiness and startup delivery]
A --> O[Session operations]
A --> I[Foreground inspection]
O --> T[Termination and cleanup]
I --> ST[Shared PTY state]
T --> ST
A --> ST
Reviews (4): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile
01df2ce to
277fce6
Compare
…om-3-mobile-browser
…-bottom-4-prune-resolved
…-bottom-5-pane-tree-ops
…bottom-6-mobile-troubleshoot
…lines-bottom-7-external-manager
…es-bottom-8-attach-services
…s-bottom-9-hosted-review-creation
…ax-lines-bottom-10-automation-dispatch-events
… ra/max-lines-bottom-11-settings-navigation
…-lines-bottom-12-daemon-init
…ottom-13-gitlab-item-dialog
…lines-bottom-14-relay-dispatcher
…nes-bottom-15-mobile-host-screen
…lines-bottom-16-runtime-file-client
…-lines-bottom-17-ports-panel
…ottom-18-runtime-environments-pane
…ra/max-lines-bottom-19-local-pty-provider
…9-local-pty-provider # Conflicts: # src/renderer/src/hooks/automation-dispatch-completion.ts
|
Warning Review limit reachedNext included review available in 16 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (21)
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 |
… observation onto the split modules main (#17206) cut local-pty-provider.ts from 1584 to 194 lines, moving getForegroundProcess into local-pty-foreground-inspection.ts. This branch had rewritten that same method into an observing form, so neither merge side was resolvable on its own. Ported rather than resolved: - local-pty-foreground-inspection.ts now exports observeLocalPtyForegroundProcess returning LocalForegroundObservation. getLocalPtyForegroundProcess stays as the collapsing wrapper, so every existing caller keeps the exact legacy value. - inspectProcess moves onto LocalPtyProvider and consumes the observation, which keeps the evidence type in local-pty-process-evidence.ts and out of the inspection module's import cycle. The verdict vocabulary crosses the new module boundary unchanged: foreground reads answer observed / unverifiable, children answer live / unverifiable / exited, and a degraded or thrown read stays unverifiable rather than collapsing into an exit.
…o the split modules main (#17206) split local-pty-provider.ts across 17 modules, so this branch's six tombstone hooks no longer had a file to sit in. Distributed to where the state they guard now lives: - ptyObservedExits declared beside ptyPhysicalExits in local-pty-provider-state.ts - cleared on spawn and recorded on exit in local-pty-session-activation.ts - recorded on the app-quit path in local-pty-termination.ts - ptyAbsenceVerdict and the test reset stay on local-pty-provider.ts The tombstone deliberately does NOT clear in clearPtyState: app quit records the exit and then clears per-id state, so erasing it there would destroy the very verdict it just observed. Absence stays two-valued and asymmetric. Only an id whose exit this provider watched answers exited; an unknown id, an evicted entry, or a provider that cannot answer degrades to unverifiable. Loss of contact is never exit evidence.
* Split speech session lifecycle * Split terminal output scheduler pipeline * Split mobile browser pane modules * Prune resolved max-lines suppressions * Split pane tree equalization logic * Extract mobile troubleshoot screen styles * Split external automation manager * Split main window service attachments * Split hosted review creation checks * Split automation dispatch event handling * Split settings navigation metadata * Split daemon initialization lifecycle * Split GitLab item dialog * Split relay dispatcher layers * Split mobile host screen * Retarget mobile view settings source test * Split runtime file client layers * Split ports panel layers * Split runtime environments pane layers * Split local PTY provider responsibilities * Fix F3-speech for stablyai#17123 * Fix F1-cycle for stablyai#17131 * Fix F4-navtest for stablyai#17157 * Fix F2-allowlist for stablyai#17161
Summary
local-pty-provider.tsfrom 1,584 lines to a 194-line facadeValidation
pnpm tcpnpm tc:nodelocal-pty-*.test.tsfiles — 187 passedLocalPtyProvider— 684 passedpnpm run check:code-quality:changed— zero new findingspnpm check:max-lines-ratchet— 67 entriespnpm run check:runtime-electron-ratchetgit diff --checkStacked on #17198.