Repository navigation
fix(terminal): keep the host's platform through an unverifiable probe - #21188
Conversation
There was a problem hiding this comment.
ℹ️ No critical issues — one minor coverage gap inline.
Reviewed changes
- Host platform held through an unverifiable probe: both
kind === 'runtime'reads inresolveTerminalInputHostPlatformnow go throughlastVerifiedRuntimeStatus(entry)?.hostPlatforminstead ofentry.status?.hostPlatform, which the store nulls for any non-verifiedprobe. Keeps a Windows host's platform (and thus keystroke quoting / path conventions) from collapsing to the client's OS while contact is lost.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| return ( | ||
| args.state.runtimeStatusByEnvironmentId.get(runtimeEnvironmentId)?.status?.hostPlatform ?? | ||
| args.clientPlatform | ||
| lastVerifiedRuntimeStatus(args.state.runtimeStatusByEnvironmentId.get(runtimeEnvironmentId)) |
There was a problem hiding this comment.
The new fixture only exercises the worktree-owner site below (line 102), so this active-PTY site has no regression coverage: the existing PTY-owner test uses a snapshotless { status: { hostPlatform } } entry, which the old read handled just as well. A companion case that sets transport.getRuntimeEnvironmentId (or a remote:<env>@@... PTY id) to windows-box with the same unverifiable fixture would pin both sites; mutation-testing only the second leaves this one free to regress silently.
The platform a host runs is a fact about the host, not about whether its last probe came back. Reading `entry.status` fell through to the client's platform the moment a probe went unverifiable, so a Windows host driven from a Mac silently started resolving keystrokes and paths with POSIX conventions mid-session -- and switched back on the next successful probe. Same conversion as the four sibling reads, using the same shared reader.
7b4a782 to
034d544
Compare
📝 WalkthroughWalkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to The current behavior is not protected against regressions in live runtime terminals when status probes are unavailable. Add the focused live-PTY test before merging. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the change, motivation, scope, implementation, testing, and linked stacked work. However, it does not follow several required template sections, including ELI5, What Changed, Why, Linked Issue with a Fixes reference, Visual Proof or an explicit N/A explanation, Review, Notes, and the required checklists. Resolution Add the required template sections and complete them. Include a direct issue-closing reference such as
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: bb19fabe-5d43-43a5-9559-1273131c7bff
📒 Files selected for processing (2)
src/renderer/src/components/terminal-pane/terminal-input-host-platform.test.tssrc/renderer/src/components/terminal-pane/terminal-input-host-platform.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.
| // A probe that did not come back says nothing about which OS the host runs. Falling through to | ||
| // the client's platform re-points every keystroke and every path at the wrong conventions -- | ||
| // a Windows host driven from a Mac silently starts speaking POSIX mid-session. | ||
| it('keeps the Windows host platform while its probe is unverifiable', () => { | ||
| const worktreeId = 'repo::C:\\repo' | ||
| expect( | ||
| resolveTerminalInputHostPlatform({ | ||
| clientPlatform: 'darwin', | ||
| state: state({ | ||
| repos: [ | ||
| { | ||
| id: 'repo', | ||
| path: 'C:\\repo', | ||
| displayName: 'repo', | ||
| badgeColor: '#000', | ||
| addedAt: 0, | ||
| executionHostId: 'runtime:windows-box' | ||
| } | ||
| ], | ||
| runtimeStatusByEnvironmentId: new Map([['windows-box', unverifiableWindowsHost()]]) | ||
| }), | ||
| worktreeId, | ||
| transport: null | ||
| }) | ||
| ).toBe('win32') | ||
| }) | ||
|
|
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '1,140p' src/renderer/src/components/terminal-pane/terminal-input-host-platform.ts
sed -n '1,380p' src/renderer/src/components/terminal-pane/terminal-input-host-platform.test.ts
rg -n "runtimeEnvironmentId|unverifiableWindowsHost|lastVerifiedRuntimeStatus|verification.*unavailable" src/renderer/src/components/terminal-pane/terminal-input-host-platform.test.tsRepository: stablyai/orca
Length of output: 15279
🏁 Script executed:
set -e
printf '%s\n' '--- helper and direct callers ---'
rg -n -C 5 "function lastVerifiedRuntimeStatus|lastVerifiedRuntimeStatus|resolveTerminalInputHostPlatform" src/renderer/src src/shared
printf '%s\n' '--- candidate test files ---'
rg -l "resolveTerminalInputHostPlatform|unverifiableWindowsHost|verification: 'unavailable'|lastVerifiedRuntimeStatus" src --glob '*.{test,spec}.{ts,tsx,js,jsx}'Repository: stablyai/orca
Length of output: 46204
Cover the live runtimeEnvironmentId branch. The new test passes transport: null, so it reaches the worktree-owner branch. Existing live-PTY tests provide status.hostPlatform directly and would still pass if the live branch reverted to reading status?.hostPlatform. Add a live PTY case with getRuntimeEnvironmentId() === 'windows-box', lastVerifiedRuntimeStatus containing hostPlatform: 'win32', status: null, and a darwin client. The test must assert win32; otherwise this regression returns darwin and applies the wrong terminal conventions.
…stablyai#21188) The platform a host runs is a fact about the host, not about whether its last probe came back. Reading `entry.status` fell through to the client's platform the moment a probe went unverifiable, so a Windows host driven from a Mac silently started resolving keystrokes and paths with POSIX conventions mid-session -- and switched back on the next successful probe. Same conversion as the four sibling reads, using the same shared reader.

Stacked on #20095.
The platform a host runs is a fact about the host. It does not stop being true because the host's last status probe did not come back.
resolveTerminalInputHostPlatformreadentry.status?.hostPlatform, which the store nulls for any non-verifiedprobe, and fell through toargs.clientPlatform. So a Windows host driven from a macOS client silently began resolving keystrokes and paths with POSIX conventions the moment a probe went unverifiable, and switched back on the next successful one. Two sites,terminal-input-host-platform.ts:75and:98— the active-PTY path and the worktree-owner path.This is the same conversion as the four sibling reads in #20095, using the same shared reader (
lastVerifiedRuntimeStatus) introduced in #20085. Governing rule:docs/reference/ssh-execution-boundary.md— loss of contact is never evidence, and it is certainly not evidence that the host changed operating system.Why this one is worth calling out separately
The other reads in this family degrade an affordance: a button greys out, a row shows the wrong badge, a capability is briefly unavailable. This one changes what the user's input means. Path separators, shell quoting and modifier handling all key off the resolved platform, so the failure is silent and the output is wrong rather than absent.
Verification
pnpm test src/renderer/src/components/terminal-pane/terminal-input-host-platform.test.ts—14 passed (14).?.status?.hostPlatformfails the new assertion (1 failed | 13 passed (14)); restoring it returns14 passed (14). The assertion is not inert.RuntimeStatusand a realRuntimeEnvironmentStatusrather than casting a partial, so it cannot drift out of the contract and cannot silently miss a field added later.pnpm tcexit 0, zeroerror TS.check:code-quality:changedagainst this PR's base — exit 0, zero findings.Scope
Two expressions and one test. No new predicate, no new helper, no behaviour change for a host whose probe is
verified—lastVerifiedRuntimeStatusreturnssnapshot.status ?? status, which for a verified entry is the same value it read before.Stacking
Based on
nwparker/status-reads-hold-unverifiable-host(#20095) because it reuseslastVerifiedRuntimeStatus, which arrives in #20085. It is the fifth member of the same family and belongs behind the same atomic unit: #20085 → #20095 → #20096 → #20359.