Cloud chat: typing in a chat whose machine is paused wakes it before the send

Merged
TE
3d ago
+71-5

Leo, 2026-11-04: "Like as the user’s selected cloud/is typing in it… that’s when we can do an optimistic resume"

Leo-ask: ask-15a4c808fc

Picking a paused Cloud machine in the composer already resumes it (ComposerContext pickCloudMachine, #34286). A chat already on a paused machine woke it only on send (#33281). Now it wakes as the person starts typing.

What changes (agent pane, Cloud chats only)

  • When the person types in a Cloud chat whose machine reads paused, the pane resumes the machine right away. "Paused" comes from the recovery read or the account's list. The resume goes through the same useCloudChatRecovery.resume → cloudMachine.attach path a send uses.
  • It spends that keystroke's scope credit, so the Enter that sends later keeps its own credits.
  • It runs once per sleep, not once per key. The machine coming back or another chat being shown resets it.
  • If the person sends while the machine wakes, the prompt joins the wake already in flight. resume runs one at a time, and the prompt is held under "Waking the machine…" as before (#34624's 1.5 s threshold still applies).
  • If the wake fails, it is not retried on the next key. A send still wakes the machine.
  • Typing does not wake a link that is only connecting (the machine not read as paused). Typing in a live chat, a non-Cloud chat, a deleted machine's chat or a watched chat wakes nothing.
  • Composer gets onPromptEdit: the person's own edit in any chat. Paused chats that acpmux no longer lists have no session id, so onTyping never fires for them.

Files

  • cloudWake.ts: cloudTypingWakes, a pure helper.
  • App.tsx: cloudTypeWaking keeps the recovery active while a typing wake waits; wakeOnTyping is wired to Composer onEdit.
  • Composer.tsx: the onPromptEdit prop.
  • test/cloud-chat-send-wakes.test.tsx: unit cases for cloudTypingWakes.

Timers: none added. The recovery's existing one-minute deadline and cleanup bound the wake.

Risk: small and contained. It adds one more trigger for the existing resume path, gated on a machine that reads paused.

Prior art acknowledged: #33281, #34284, #34286, #34624, #34365 and the rest of wt new's list. None does this.
Agent session: agent session

🤖 Generated with Claude Code