{"record":{"id":"218ae21821b2eb1c","repo":"stablyai/orca","slug":"waiting-for-desktop-218ae2","errorCode":null,"errorMessage":"Waiting for desktop...","messagePattern":"Waiting for desktop\\.\\.\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"mobile/src/session/use-mobile-diff-review-send-actions.ts","lineNumber":76,"sourceCode":"  const markNotesSent = useCallback(\n    async (comments: readonly DiffComment[]) => {\n      if (screenState.kind !== 'ready') {\n        return\n      }\n      const next = markMobileDiffCommentsSent(\n        screenState.comments,\n        new Set(comments.map((comment) => comment.id)),\n        Date.now()\n      )\n      await saveCommentsAndReviewState(next, screenState.reviewState)\n    },\n    [saveCommentsAndReviewState, screenState]\n  )\n\n  const sendPromptToTerminal = useCallback(\n    async (terminal: string, comments: readonly DiffComment[]) => {\n      if (!client || connState !== 'connected') {\n        throw new Error('Waiting for desktop...')\n      }\n      // Marked by terminal handle, not by surface, so a paste orphaned here by native\n      // chat would ride along with these notes (#10228). Diff review carries no device token.\n      if (!(await healMobileNativeChatStaleInput({ client, terminal, deviceToken: null }))) {\n        throw new Error('Failed to send notes')\n      }\n      const response = await client.sendRequest('terminal.send', {\n        terminal,\n        text: formatMobileDiffReviewPrompt(comments),\n        enter: true\n      })\n      if (!response.ok) {\n        throw new Error(response.error?.message || 'Failed to send notes')\n      }\n      if (!readMobileReviewTerminalSendAccepted(response.result)) {\n        throw new Error('Terminal input is locked')\n      }\n      await markNotesSent(comments)","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/mobile/src/session/use-mobile-diff-review-send-actions.ts#L58-L94","documentation":"Guard thrown by `sendPromptToTerminal` (send review notes to an existing terminal) when client is null or connState !== 'connected'. It blocks the terminal.send of formatted review notes.","triggerScenarios":"Sending notes during a non-connected transport state. Triggered from the send-sheet's 'send to existing terminal' action while connecting/handshaking/reconnecting/auth-failed/disconnected.","commonSituations":"Relay drop while the send sheet is open; selecting a terminal just as the connection drops; reconnect window.","solutions":["Wait for 'connected'.","Re-open the send sheet after reconnect.","Re-pair if auth-failed."],"exampleFix":"// before\nif (!client || connState !== 'connected') {\n  throw new Error('Waiting for desktop...')\n}\n// after - surface as sheet error instead of throwing\nif (!client || connState !== 'connected') {\n  setActionError('Waiting for desktop...')\n  return\n}","handlingStrategy":"validation","validationCode":"if (!client || connState !== 'connected') {\n  setActionError('Waiting for desktop...')\n  return\n}","typeGuard":null,"tryCatchPattern":"try {\n  await sendPromptToTerminal(terminal, comments)\n} catch (err) {\n  if ((err as Error).message !== 'Waiting for desktop...') throw err\n  setActionError('Reconnecting...')\n}","preventionTips":["Disable the send button until connected.","Close the send sheet on disconnect and reopen on connect.","Heal stale input before retrying after reconnect."],"tags":["connection","guard","diff-review","send-notes","mobile"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}