Repository navigation
Keep unsent hand-off messages after restarting Orca - #34933
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
069256ec-29df-4b20-82d8-3cd997142d46
Files selected for processing: 19-
src/renderer/src/components/native-chat/NativeChatComposerPane.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.tsxsrc/renderer/src/components/native-chat/native-chat-pending-attachment-cache.tssrc/renderer/src/components/native-chat/use-native-chat-launch-draft-adoption.tssrc/renderer/src/components/native-chat/use-structured-launch-draft-presentation.test.tssrc/renderer/src/components/native-chat/use-structured-launch-draft-presentation.tssrc/renderer/src/lib/agent-session/launch/structured-agent-session-launch-cancel.tssrc/renderer/src/lib/agent-session/launch/structured-agent-session-launch-registry.tssrc/renderer/src/lib/agent-session/structured-agent-session-provisional-tab.test.tssrc/renderer/src/lib/structured-agent-session-action-launch.tssrc/renderer/src/lib/structured-agent-session-launch-different-request.test.tssrc/renderer/src/lib/structured-agent-session-launch-draft.test.tssrc/renderer/src/lib/structured-agent-session-launch-draft.tssrc/renderer/src/lib/structured-agent-session-launch-join-delivery.test.tssrc/renderer/src/lib/structured-agent-session-launch.test-fixture.tssrc/renderer/src/lib/structured-agent-session-launch.test.tssrc/renderer/src/lib/structured-agent-session-launch.tssrc/renderer/src/store/slices/tabs/tabs-close-actions.ts
Files with no reviewable changes: 3-
- src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
- src/renderer/src/components/native-chat/native-chat-pending-attachment-cache.ts
- src/renderer/src/store/slices/tabs/tabs-close-actions.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Minor · Preserve the draft after host publication. · structured-agent-session-launch-cancel.ts:62-64
src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-cancel.ts:62-64
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winPreserve the draft after host publication.
A pending launch can become host-listed before settlement. Closing its tab still enters provisional cancellation, which clears an unchanged launch receipt. This removes the unsent hand-off draft that History should retain.
Keep cancellation and slot cleanup, but skip receipt clearing when the matching launch state is already host-listed.
Suggested fix
- if (owner) { + if (owner && !matchingState?.hostListed) { clearStructuredAgentLaunchDraft(draftReceipt) }

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
55ced775-0d5d-4f73-92fb-18244b57aefc
Files selected for processing: 2-
config/flaky-test-pattern-baseline.txtsrc/renderer/src/lib/structured-agent-session-launch.test-fixture.ts
Files with no reviewable changes: 1-
- config/flaky-test-pattern-baseline.txt
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
-
There was a problem hiding this comment.
Actionable comments posted: 3

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
86908aa1-f868-4a9f-a77b-50f1f9d777fc
Files selected for processing: 8-
src/renderer/src/components/native-chat/NativeChatStructuredSession.retained-draft.test.tsxsrc/renderer/src/components/native-chat/native-chat-draft-retention.test.tssrc/renderer/src/lib/agent-session/launch/structured-agent-session-launch-cancel.tssrc/renderer/src/lib/agent-session/launch/structured-agent-session-launch-registry.tssrc/renderer/src/lib/agent-session/structured-agent-session-ordinary-draft.test.tsxsrc/renderer/src/lib/agent-session/structured-agent-session-provisional-tab.test.tssrc/renderer/src/lib/structured-agent-session-action-launch.tssrc/renderer/src/lib/structured-agent-session-launch-draft.ts
Files with no reviewable changes: 2-
- src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-cancel.ts
- src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-registry.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
[Medium impact] The changes since the previous review appear safe to merge. SummaryHand-off text now uses the conversation’s ordinary saved draft, so it can survive a restart before the composer mounts.
|
|
Hand Off could display an unsent message in a new chat and lose it when Orca restarted because only a temporary terminal mirror held the context. The generated context now becomes the conversation's ordinary draft before the composer opens. The review fixed launch cancellation deleting ordinary drafts and made cursor positioning follow the installed draft: fresh addressed context starts at the end, saved/reopened drafts at the start, and later user selection wins. Existing cancellation and late-host fences remain. The separate attachment-spacing investigation is deferred and excluded from this PR. Intended differences from the common pattern: terminal mirroring remains for its existing terminal input consumer; unsupported-host fallback remains because paired clients and servers update independently (retain a content-bearing chat beside the terminal, replace only a blank chat, and do not claim prompt transfer); phone draft synchronization keeps its existing separate scope because this desktop persistence change adds no phone wire operation. Verified: the previous build lost both untouched generated drafts after graceful restart. Claude used Hand Off; Codex used New workspace with linked PR34933 and an Advanced Note, then Codex Chat → Create. Codex Hand Off auto-submit was excluded. The branch carried previous-build ordinary drafts through upgrade, retained both untouched generated drafts exactly through graceful restart, then completed two normal sends and two real replies per original Claude/Codex conversation. Normal message-bearing History reopened the same conversations with their transcripts and empty drafts. Genuine pending-close schedules retained current ordinary bytes without resurrecting tabs. Fresh/restored caret and distinct Clear controls passed. The shared final restart preserved transcripts, kept sent/Clear drafts empty, retained ordinary controls, and did not resurrect pending-closed tabs. Both targeted OpenCode fallback controls passed with real terminal replies; independent review checked the original refusal, exact draft records, binary integrity, screenshots and cleanup. CI passed on For Brennan's review: Pending-close screenshots show the state before Close; the retained-byte and late-result assertions are recorded in the QA evidence. Empty closed host records were absent from History; no recovery claim is made for those records. Actual History recovery used message-bearing conversations. The older paired-host attempts routed directly to terminal before provisional creation and remain unexercised for this fallback path. The two genuine OpenCode version refusals exercised the shared empty/content decisions; shared lifecycle was already exercised with Claude and Codex. No prompt transfer is claimed. Native host turn counters and held-time internal launch-attempt comparison were not captured. The first M4 segment changed the hash of its real Source spots for review: ordinary draft seeding, launch cancellation authority, and unsupported-host content preservation. QA carry: actual lifecycle and targeted fallback evidence is from
|

















Hand Off could show context in a new chat and then lose that unsent message after Orca restarted. The context was treated as a temporary terminal mirror even though the chat had no other copy. This saves it as the conversation's ordinary draft before the composer opens, so an untouched message survives restart and reopening an existing conversation from History.
Launch cancellation and late host replies no longer delete ordinary drafts. Explicit Send, Clear, and confirmed workspace deletion keep their existing roles. A fresh Hand Off keeps its end cursor; an ordinary draft restored after restart or reopened later keeps its existing start cursor. Retained bytes from a conversation closed before the host ever created it do not imply a new History recovery feature.
Intended adaptations:
Review path: full, because this changes saved native-chat drafts and restart/recovery. Image-spacing work is excluded; existing attachment behavior stays outside this fix.
Validation: final independently reviewed head
cd2466a80fb5538f5e354b9556558688bbc8cb01; CI passed oncd2466a80fb5538f5e354b9556558688bbc8cb01: run41105467236, including static analysis/typecheck, all 12 unit shards, packaging and the exercised end-to-end jobs. Independent review accepted this conflict sync: main’s shared fixture structure and picker coverage, all 17 guard cases, all 12 parity scenarios, complete settings, real tab ownership and provisional-selection lifetime were preserved. The two focused test files passed all 29 tests, and the required merge hook passed. Targeted gated tests: both shared-fixture importer files, 29 tests passing. Full review and QA evidence are detailed in the review status comment.Real lifecycle QA at
471eff2713ed0c58d8161ffaafeb8e972d56d809reproduced untouched generated-context loss on the previous build: Claude through Hand Off; Codex through New workspace with linked PR34933 and an Advanced Note, then Codex Chat → Create. Codex Hand Off auto-submit was excluded. The branch preserved previous-build ordinary drafts through upgrade and untouched generated drafts through restart, completed two sends and two real replies per original conversation, reopened message-bearing conversations through History, and verified pending-close retention, cursor behavior, distinct Clear and a final shared restart. Genuine OpenCode 1.18.30 version refusals verified blank-source replacement and exact typed-source retention beside useful terminals with real replies. Screenshots and limits are in the review status comment.The four older-host fallback attempts remain unexercised for the provisional path: those hosts route directly to terminal before provisional creation. Genuine OpenCode refusals cover the shared fallback decisions. Native host turn counters and held-time internal-attempt comparison were not captured. The first M4 QA segment changed the hash of a real
.claude.json; the hardened relaunch preserved monitored hashes. Recorded QA apps and drivers stopped. A throwaway pairing link exposed in an earlier completed driver run was revoked.QA evidence carries across the main merges and non-shipped corrections listed in the review status comment. No additional real run is owed by the QA table for the main merges and test-only corrections. Conservative change count against integrated main: 443 conservative production lines after approved relocation (432 runtime-cut lines plus 11 erased type/name lines), one config line separately, and 4272 test lines after approved relocation.