Skip to content

Keep unsent hand-off messages after restarting Orca - #34933

Merged
brennanb2025 merged 23 commits into
mainfrom
brennanb2025/sta-11573-draft
Oct 30, 2026
Merged

brennanb2025 merged 23 commits into
mainfrom
brennanb2025/sta-11573-draft

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • Terminal mirroring stays because terminal conversations have a separate existing consumer and input buffer; ordinary chat persistence cannot replace that copy.
  • Unsupported-host fallback stays because paired clients and servers update independently. The existing cancellation and late-child fences stay in place. A source chat with content remains beside the replacement terminal; an empty source can be replaced. This adds no minimum server version or claim that the prompt transferred.
  • Phone draft synchronization remains outside this change. Desktop ordinary drafts and the phone's existing scope stay separate; this adds no phone wire operation.

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 on cd2466a80fb5538f5e354b9556558688bbc8cb01: 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 471eff2713ed0c58d8161ffaafeb8e972d56d809 reproduced 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.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 28, 2026 09:41
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Recent 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: d20f0f26-736d-485a-9dec-264ee2c80d9f
Commits

Reviewing files that changed from the base of the PR and between 452a928 and 1a85e9d.

Files selected for processing: 2
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.retained-draft.test.tsx
  • src/renderer/src/lib/agent-session/structured-agent-session-ordinary-draft.test.tsx
Files skipped from review as they are similar to previous changes: 2
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.retained-draft.test.tsx
  • src/renderer/src/lib/agent-session/structured-agent-session-ordinary-draft.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

Structured launch prompts are stored as session-scoped composer drafts with workspace and execution-host ownership. Launch cancellation and tab closure no longer clear those drafts. The prompt editor places the caret at the document end when available. Declined-chat fallback revalidates launch ownership and tab placement around placement. Launch settlement clears visibility uncertainty.

Priority: Normal

Merge Risk: Minimal · up to 1a85e

The previously reported static-analysis blocker has been fixed. No actionable merge-blocking issue is established by these changes.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description provides detailed behavior changes, rationale, scope, testing results, QA evidence, and compatibility considerations. It does not follow the required template because it omits the Link… Add the missing template sections. Include an actual linked issue under “Fixes #” or explain the maintainer exception, provide before/after visuals or write N/A with a reason, complete AI Disclosure when applicable, confirm the Agent skil…
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: retaining unsent hand-off messages after an Orca restart.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 11 functions across 18 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Full details: Description check

Explanation

The description provides detailed behavior changes, rationale, scope, testing results, QA evidence, and compatibility considerations. It does not follow the required template because it omits the Linked Issue section with an actual issue link, Visual Proof or an explicit N/A statement, AI Disclosure, Agent skill upstream boundary, Notes, and Checklist sections.

Resolution

Add the missing template sections. Include an actual linked issue under “Fixes #” or explain the maintainer exception, provide before/after visuals or write N/A with a reason, complete AI Disclosure when applicable, confirm the Agent skill upstream boundary, address the Notes items, and complete the Checklist.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Commits

Reviewing files that changed from the base of the PR and between 31f3c52 and a560233.

Files selected for processing: 19
  • src/renderer/src/components/native-chat/NativeChatComposerPane.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
  • src/renderer/src/components/native-chat/native-chat-pending-attachment-cache.ts
  • src/renderer/src/components/native-chat/use-native-chat-launch-draft-adoption.ts
  • src/renderer/src/components/native-chat/use-structured-launch-draft-presentation.test.ts
  • src/renderer/src/components/native-chat/use-structured-launch-draft-presentation.ts
  • 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
  • src/renderer/src/lib/agent-session/structured-agent-session-provisional-tab.test.ts
  • src/renderer/src/lib/structured-agent-session-action-launch.ts
  • src/renderer/src/lib/structured-agent-session-launch-different-request.test.ts
  • src/renderer/src/lib/structured-agent-session-launch-draft.test.ts
  • src/renderer/src/lib/structured-agent-session-launch-draft.ts
  • src/renderer/src/lib/structured-agent-session-launch-join-delivery.test.ts
  • src/renderer/src/lib/structured-agent-session-launch.test-fixture.ts
  • src/renderer/src/lib/structured-agent-session-launch.test.ts
  • src/renderer/src/lib/structured-agent-session-launch.ts
  • src/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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

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 win

Preserve 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
Commits

Reviewing files that changed from the base of the PR and between a560233 and 860b405.

Files selected for processing: 2
  • config/flaky-test-pattern-baseline.txt
  • src/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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Commits

Reviewing files that changed from the base of the PR and between a151244 and 452a928.

Files selected for processing: 8
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.retained-draft.test.tsx
  • src/renderer/src/components/native-chat/native-chat-draft-retention.test.ts
  • 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
  • src/renderer/src/lib/agent-session/structured-agent-session-ordinary-draft.test.tsx
  • src/renderer/src/lib/agent-session/structured-agent-session-provisional-tab.test.ts
  • src/renderer/src/lib/structured-agent-session-action-launch.ts
  • src/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.

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The changes since the previous review appear safe to merge.

Summary

Hand-off text now uses the conversation’s ordinary saved draft, so it can survive a restart before the composer mounts.

  • Hand Off context stays in the conversation’s saved draft.
  • The composer places restored and launch drafts without taking over user input.
  • Terminal fallback placement rechecks that the failed launch still owns the chat.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Hand Off] --> B[Save ordinary conversation draft]
  B --> C[Open chat tab]
  B --> D[Existing draft storage]
  D --> E[Restart and restore draft]
  C --> F[Mount composer]
  E --> F
  F --> G[User sends or clears text]
Loading

Reviews (10) · Last reviewed commit: "test: use real tab owners for structured..." · Reviewed by Greptile

@brennanb2025

brennanb2025 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

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 cd2466a80fb5538f5e354b9556558688bbc8cb01: 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. The architecture challenger, independent correctness/consumer reviews, whole-mechanism reference comparison, performance and readiness checks completed; later fixture and merge repairs received scoped independent reviews. Final measured change against integrated main: 443 conservative production lines (including 11 erased type/name lines), one config line separately, and 4272 test lines, after only the approved relocation deductions.

For Brennan's review:

Flow Previous build Branch
Untouched Claude Hand Off after graceful restart Previous build Branch
Untouched Codex linked-PR workspace context after graceful restart Previous build Branch
Ordinary draft reopened from History Previous build Branch
Pending launch closed normally Previous build Branch
Claude: two replies, then final restart Unchanged control; branch only Branch
Codex: two replies, then final restart Unchanged control; branch only Branch
Ordinary draft: previous-build restart → branch upgrade Previous build Branch
Distinct explicit Clear Branch-only control Clear
Fresh addressed caret Unchanged control; branch only Branch

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.

Targeted genuine OpenCode 1.18.30 refusal Branch proof
Empty source replaced by useful terminal; original reply recovered after restart Empty fallback
Exact unsent ordinary draft retained beside terminal Retained draft
Separate content terminal completed its own real reply Terminal reply

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 .claude.json; the hardened relaunch preserved monitored hashes. All recorded test apps and drivers stopped, with graceful app stops. A throwaway pairing link exposed during an earlier finished driver run was revoked; it is not reproduced here.

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 471eff2713ed0c58d8161ffaafeb8e972d56d809. The main merges since that head are d5022dce94ec14b576557c477dc54dc857165325, a37531e233f2f48dca3effc9a8ea9623a90a95a5, 42a57a109687df911c04909ff7747bff6a7a2e3e, and cd2466a80fb5538f5e354b9556558688bbc8cb01. They preserve the accepted evidence under the main-merge policy. The preceding 42a57a109687df911c04909ff7747bff6a7a2e3e merge also repairs incoming test ownership and makes a type-only composer import/name change with identical erased runtime code. No newly broken user flow has been established; no additional real run is owed by the QA table for the main merges and test-only corrections. All first-parent commits since the QA head:

  • 76cd4b9b16d772869aa86a89b919e09b30c481ac — Document measured proxy property forwarding.

  • e60dc34b7ee323ea20a6dcc828215c45fa27d41a — Set workspace identity in draft retirement fixture.

  • 40f966d4fbe390ce1c1f778698e3a3930801e03f — test: complete structured launch guard store fixture.

  • 45d7497216a30ee021c2c5970630a0af3420aa87 — test: expect ordinary draft retention after launch cancellation.

  • d5022dce94ec14b576557c477dc54dc857165325 — Merge origin/main and preserve native draft positioning.

  • 804bc477d14c84ba5cbdf8883cdc45ba549c6142 — test: use real tab owners for structured launch fixtures.

  • 70728f31e81d903c881bc42a6e940d0a177bbeeb — test: construct complete launch scenario settings.

  • a37531e233f2f48dca3effc9a8ea9623a90a95a5 — Merge main into draft retention branch.

  • cae697e89b326a3cad3484e7aec39acd1fbf2026 — Update provisional selection lifetime regression.

  • 42a57a109687df911c04909ff7747bff6a7a2e3e — Merge main and align launch test ownership.

  • 30eb2dabcb6a61f4b22ad2030771d3114848e694 — Narrow initialized launch fixture settings reads; test-only conformance and erased type placement.

  • cd2466a80fb5538f5e354b9556558688bbc8cb01 — Merge main and compose structured launch test coverage; retains the shared fixture, all guard/parity cases, real tab ownership and provisional-selection lifetime. This sync has no manual shipped-code resolution.

@brennanb2025
brennanb2025 marked this pull request as draft October 30, 2026 18:16
@brennanb2025
brennanb2025 marked this pull request as ready for review October 30, 2026 18:16
@brennanb2025
brennanb2025 merged commit cc69f3d into main Oct 30, 2026
107 of 109 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/sta-11573-draft branch October 30, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant