diff --git a/src/renderer/src/components/orca-cloud/offline/CloudAsleepTerminalNotice.tsx b/src/renderer/src/components/orca-cloud/offline/CloudAsleepTerminalNotice.tsx
index 800afd8b7e8..752dfe959c7 100644
--- a/src/renderer/src/components/orca-cloud/offline/CloudAsleepTerminalNotice.tsx
+++ b/src/renderer/src/components/orca-cloud/offline/CloudAsleepTerminalNotice.tsx
@@ -23,10 +23,13 @@ export function formatAsleepSince(at: number, now = Date.now()): string {
*/
export function CloudAsleepTerminalNotice({
workspaceId,
- asleepSince
+ asleepSince,
+ waking = false
}: {
workspaceId: string
asleepSince: number | null
+ /** Waking: the waking pill speaks; keep only the greyed history and its divider. */
+ waking?: boolean
}): React.JSX.Element {
const t = useTranslate()
return (
@@ -55,21 +58,27 @@ export function CloudAsleepTerminalNotice({
) : null}
-
-
- {t(
- 'orcaCloudWorkspace.terminal.asleepHistoryKept',
- 'This workspace is asleep. Your terminal history is kept.'
- )}
-
-
-
+ {waking ? null : (
+
+
+ {t(
+ 'orcaCloudWorkspace.terminal.asleepHistoryKept',
+ 'This workspace is asleep. Your terminal history is kept.'
+ )}
+
+
+
+ )}
)
diff --git a/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/recovery/TerminalPaneRecoveryPortals.tsx b/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/recovery/TerminalPaneRecoveryPortals.tsx
index 7dcef37ba69..b7bac4f15c1 100644
--- a/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/recovery/TerminalPaneRecoveryPortals.tsx
+++ b/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/recovery/TerminalPaneRecoveryPortals.tsx
@@ -27,6 +27,7 @@ import {
getWakeProcessHint,
readTerminalTail,
resetWakeProcessCapture,
+ wakeShowsStaleHistory,
useWakeProcessHintsVersion
} from '@/lib/orca-cloud/cloud-wake-process-hints'
import { paneShowsWslHostStoppedCard } from '@/runtime/hosts/wsl/wsl-host-stopped-status'
@@ -232,6 +233,18 @@ export function TerminalPaneRecoveryPortals({
`cloud-asleep-${pane.id}`
)
}
+ // Waking: the pre-sleep scrollback is still there and must not read as live (JA-15).
+ if (cloudWaking && wakeShowsStaleHistory(pane.leafId)) {
+ return createPortal(
+ ,
+ pane.container,
+ `cloud-waking-history-${pane.id}`
+ )
+ }
// Up again after a sleep: the process that was running is gone; say so once, never rerun it.
const wokeHint = cloudAwake ? getWakeProcessHint(pane.leafId) : null
if (wokeHint) {
diff --git a/src/renderer/src/lib/orca-cloud/cloud-wake-process-hints.ts b/src/renderer/src/lib/orca-cloud/cloud-wake-process-hints.ts
index ff054555997..80245a52520 100644
--- a/src/renderer/src/lib/orca-cloud/cloud-wake-process-hints.ts
+++ b/src/renderer/src/lib/orca-cloud/cloud-wake-process-hints.ts
@@ -69,6 +69,8 @@ export function readTerminalTail(terminal: TailSource, count = 200): string[] {
const hints = new Map()
// Panes already looked at in this sleep: the first look sees the pre-sleep scrollback.
const captured = new Set()
+// Panes whose pre-sleep scrollback had any text: greyed while waking until the new terminal attaches.
+const withHistory = new Set()
const listeners = new Set<() => void>()
let version = 0
@@ -85,9 +87,15 @@ export function captureWakeProcessHint(leafId: string, lines: readonly string[])
return
}
captured.add(leafId)
+ const hasHistory = lines.some((line) => line.trim() !== '')
+ if (hasHistory) {
+ withHistory.add(leafId)
+ }
const hint = detectForegroundCommand(lines)
if (hint) {
hints.set(leafId, hint)
+ }
+ if (hasHistory || hint) {
emit()
}
}
@@ -96,9 +104,15 @@ export function captureWakeProcessHint(leafId: string, lines: readonly string[])
export function resetWakeProcessCapture(leafIds: readonly string[]): void {
for (const id of leafIds) {
captured.delete(id)
+ withHistory.delete(id)
}
}
+/** The pane still shows output from before the sleep (looked at during this sleep, with any text). */
+export function wakeShowsStaleHistory(leafId: string): boolean {
+ return withHistory.has(leafId)
+}
+
export function dismissWakeProcessHint(leafId: string): void {
if (hints.delete(leafId)) {
emit()
@@ -123,5 +137,6 @@ export function useWakeProcessHintsVersion(): number {
export function resetWakeProcessHintsForTests(): void {
hints.clear()
captured.clear()
+ withHistory.clear()
version = 0
}
diff --git a/src/renderer/src/lib/orca-cloud/use-cloud-recovery-context.ts b/src/renderer/src/lib/orca-cloud/use-cloud-recovery-context.ts
index 8f44d212ad0..ba899d77fc0 100644
--- a/src/renderer/src/lib/orca-cloud/use-cloud-recovery-context.ts
+++ b/src/renderer/src/lib/orca-cloud/use-cloud-recovery-context.ts
@@ -9,7 +9,7 @@ export type CloudRecoveryContext = {
asleep: boolean
/** What the person calls it (never the sandbox's server name or id). */
workspaceName: string | null
- /** When this computer last saw it go to sleep (the local record's suspend time); null if unknown. */
+ /** While asleep or waking: when it went to sleep (the local record's suspend time); null if unknown. */
asleepSince: number | null
}
@@ -42,5 +42,5 @@ export function useCloudRecoveryContext(
const asleep =
!waking &&
(reported === 'sleeping' || reported === 'stopping' || reported === 'archived' || vmSuspended)
- return { waking, asleep, workspaceName, asleepSince: asleep ? suspendedAt : null }
+ return { waking, asleep, workspaceName, asleepSince: asleep || waking ? suspendedAt : null }
}