Repository navigation
fix(mobile): unblock targeted SSH session tab refresh - #17486
Conversation
Greptile SummaryThe PR separates targeted mobile session-tab refreshes from fleet-wide PTY/worktree inventory so an unrelated stalled SSH scan cannot block opening a session.
Confidence Score: 5/5The PR appears safe to merge with no concrete changed-code defect established. Targeted refreshes retain explicit host resolution, provider-scoped liveness checks, fail-closed runtime ownership, and bounded stale-generation recovery without an established tab-loss or publication regression.
|
| Filename | Overview |
|---|---|
| src/main/runtime/orca-runtime.ts | Separates targeted and aggregate PTY refreshes, adds explicit target resolution and provider scoping, and retries one stale targeted generation. |
| src/main/runtime/orca-runtime.test.ts | Adds a deterministic regression test proving targeted SSH tab listing does not invoke or wait for an unrelated worktree scan. |
| src/main/runtime/session-tabs-inventory-publication.test.ts | Updates inventory concurrency coverage to assert independent targeted and aggregate refresh operations. |
Sequence Diagram
sequenceDiagram
participant M as Mobile client
participant R as Orca runtime
participant W as Target resolver
participant P as Owning PTY provider
M->>R: List tabs for explicit worktree
R->>W: Resolve cached or persisted target
W-->>R: Execution host
alt Local or SSH target
R->>P: List processes for owning provider
P-->>R: Scoped PTY inventory
R-->>M: Target session-tab snapshot
else Paired runtime-owned target
R-->>M: Inventory unavailable (fail closed)
end
Reviews (1): Last reviewed commit: "Strengthen SSH session refresh oracle" | Re-trigger Greptile
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This PR decouples targeted (explicit worktree-id) mobile session-tab refreshes from the fleet-wide PTY/worktree census so a stalled unrelated SSH Git scan can no longer leave an SSH session open spinning. Fleet-wide and floating paths are unchanged, and no RPC/wire schema changes.
- Targeted refresh bypasses the aggregate census —
refreshMobileSessionPtyInventoryroutes non-floating targets straight toperformMobileSessionPtyRecordsRefreshinstead of coalescing behindpendingMobileSessionPtyAggregateInventoryRefresh. - Explicit-target worktree resolution — new
listResolvedWorktreesForExplicitTargetresolves the target from the warmresolvedWorktreeCacheor persisted folder/repo metadata (buildResolvedWorktreeFromId), never triggering a Git/SSH worktree scan. - Owner-scoped provider query —
performMobileSessionPtyRecordsRefreshderives the execution host, fails closed (return null) forruntime-owned/paired hosts, and scopes the PTY list to the owning SSH provider (connectionId) or local provider. - Stale-generation retry —
refreshPtyWorktreeRecordsWithControllerInventorygains aretryStaleflag; when a concurrent fleet census fences out a targeted poll, it re-queries once so a user-driven open never returns empty. - Fail-open folder/repo resolution —
buildResolvedWorktreeFromIdreadsgetRepos?.(), andlistKnownResolvedWorktreesForExplicitTargetreturns the folder-workspace row (previously[]). - Tests — a deterministic never-settling-
listWorktreesSSH fixture inorca-runtime.test.ts, plus the updatedsession-tabs-inventory-publication.test.tsasserting targeted and aggregate refreshes run independently.
I traced the host-resolution chain (parseExecutionHostId, getRepoExecutionHostId, tryGetWorkspaceSessionHostIdForWorktree), the provider routing in src/main/ipc/pty/provider/registry.ts and src/main/ipc/pty/runtime/operations.ts (listProcesses(null) = local, listProcesses(id) = scoped SSH, host-scope = fleet), and the generation fencing around ptyControllerAggregateInventoryGeneration / ptyControllerInventoryGenerationByProvider. The parsedTargetHost.kind === 'runtime' fail-closed guard and the one-shot retryStale bound both behave as documented, and the floating-terminal sentinel still resolves to the local provider rather than tripping the runtime guard. No correctness, coverage, or wire-compatibility concerns.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…-refactor main advanced 45 commits, six of them landing inside the orca-runtime.ts this branch splits apart. Git resolves that as a plain "take one side", and either side silently loses work, so each was ported into the module that now owns the code: - stablyai#17655 bound ref and worktree scans -> runtime-repository-ref-queries - stablyai#17448 preserve user-set workspace names -> the worktree-create modules - stablyai#17667 cut cold worktree-switch attach latency -> the mutation lock, including the deletion half (worktree-terminal-mutation-wait.ts is gone) - stablyai#17718 preserve large agent prompt pastes -> the agent-prompt write path - stablyai#17486 unblock targeted SSH session tab refresh -> the mobile refresh modules - stablyai#17159 close readiness gaps -> 34 runtime hunks and 5 test hunks Every added line of the six was checked against the merged tree; the unmatched ones are all renames or line splits, verified individually. Two defects surfaced while porting, both predating this merge: - isMobileSessionSurfaceMembershipAllowed read a session accessor that answers null where main's answers undefined, so main's `session !== undefined` guard was always true and the fence stopped fencing. Three clauses found in neither main nor the split base had been added ahead of it to compensate, and one of them dropped a freshly published split leaf out of syncWindowGraph. Restored to main's control flow with the sentinel normalized; stablyai#17159's two new tests cover it from both directions. - retiredMobileSessionPtyIds was write-only state this branch invented. Its only reader was the clause above, and it exists in neither main nor the split base. - RuntimeTerminalWriter.writeAgentPrompt had no callers and still carried the chunked-paste shape stablyai#17718 replaced.
* Fix targeted mobile SSH session tab refresh * Preserve fail-open explicit workspace resolution * Strengthen SSH session refresh oracle

Summary
Mobile SSH session opens could spin forever because the host-side targeted session-tab RPC waited on a fleet-wide PTY/worktree census. A stalled unrelated SSH Git scan prevented the authoritative snapshot from reaching the client.
This change keeps targeted refreshes independent, resolves explicit Git/folder targets from cache or persisted metadata, scopes PTY inventory to the owning SSH provider, fails closed for paired/runtime-owned hosts, and retries one stale generation race. Aggregate fleet inventory remains coalesced.
Evidence
listWorktrees, persisted remote tab, live SSH PTY identity.nullafter bounded fake deadline).orca-runtime.test.ts: 1,216 passed, 1 skipped.pnpm tc:node, changed-code quality, oxlint, formatting, and diff checks pass.Review notes
Three independent gpt-5.6-sol architecture reviews completed. Two concrete issues found in the first candidate (fail-open repo inventory and folder-workspace target loss) were fixed before this PR; final review found no blockers.
No RPC/wire schema changes; local, SSH/relay, paired, folder-workspace, WSL, and mixed-version paths retain their existing contracts. No Linear or production/cloud state was changed.