fix(cloud): a paired cloud workspace's terminal recovery knows it is asleep or waking (ASLEEP-SR-RECONNECTING) (#724)

useCloudRecoveryContext counted only owned workspaces as cloud, so for a
paired one its asleep and waking states were unknown to the recovery
notices: the remote-server outage notice ('Reconnecting to ... (cloud)',
role=status, aria-live=polite) stayed up under the asleep view, where a
screen reader would announce it (n56 DOM dump). Paired rows count as cloud
there too, so the notice stays silent while asleep or waking.
This commit is contained in:
Neil
2026-11-13 08:43:00 -08:00
committed by GitHub
parent 060e47ba0f
commit ea5bc46199
2 changed files with 26 additions and 1 deletions
@@ -100,3 +100,23 @@ describe('terminal recovery for an asleep Orca Cloud workspace (RA-12)', () => {
expect(result.current).toBeNull()
})
})
describe('a paired cloud workspace (ASLEEP-SR-RECONNECTING)', () => {
it('is cloud and asleep, so the outage notice stays silent under the asleep view', () => {
act(() =>
seedCloudWorkspaceSnapshot({
paired: { ws: 'env-paired' },
idsLoaded: true,
status: { ws: { status: status('sleeping'), loading: false, error: null, fetchedAt: T0 } }
})
)
const { result } = renderHook(() => useCloudRecoveryContext('ws'))
expect(result.current).toMatchObject({ asleep: true, waking: false })
})
it('a workspace that is neither owned nor paired is still not cloud', () => {
act(() => seedCloudWorkspaceSnapshot({ idsLoaded: true }))
const { result } = renderHook(() => useCloudRecoveryContext('ws'))
expect(result.current).toBeNull()
})
})
@@ -19,7 +19,12 @@ export type CloudRecoveryContext = {
export function useCloudRecoveryContext(
worktreeId: string | null | undefined
): CloudRecoveryContext | null {
const isCloud = useIsCloudWorkspace(worktreeId)
// ASLEEP-SR-RECONNECTING: a paired cloud workspace is cloud here too. Owned-only left its asleep
// and waking states unknown to the recovery notices, so the outage notice ("Reconnecting to …",
// a polite live region) stayed up under the asleep view and a screen reader announced it.
const owned = useIsCloudWorkspace(worktreeId)
const paired = useCloudWorkspace((s) => Boolean(worktreeId && worktreeId in s.paired))
const isCloud = owned || paired
const wake = useCloudWorkspace((s) => (worktreeId ? s.wake[worktreeId] : undefined))
const phase = wake?.phase
const status = useCloudWorkspace((s) => (worktreeId ? s.status[worktreeId]?.status : undefined))