Skip to content

fix(native-chat): send launch prompts and worker tasks through the retrying start - #33832

Merged
brennanb2025 merged 7 commits into
mainfrom
brennanb2025/launch-prompt-retry
Oct 26, 2026
Merged

brennanb2025 merged 7 commits into
mainfrom
brennanb2025/launch-prompt-retry

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​538 $\color{#cf222e}{\Huge{\mathbf{−}}}$​266 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​272
Prod 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​71 $\color{#cf222e}{\Huge{\mathbf{−}}}$​119 $\color{#cf222e}{\Huge{\mathbf{−}}}$​48

When a chat started with a prompt fails to start once, the prompt is no longer lost: it now goes through the same start retry as a message typed into the composer.

What broke. Since #33045, a native chat whose first message comes from the desktop composer gets up to five start attempts. Chats created by a launch carrying a prompt did not. The chat was created with its agent starting at once, and the prompt was sent afterwards as a separate message, so a single transient failure while that first agent started (a crash during the handshake, a transient spawn error) wrote " couldn't start" and the prompt read "Your message was not sent." Affected, with the Chat UI on or --surface chat:

  • orca agent launch <agent> --prompt … and orca worktree create --agent <agent> --prompt …;
  • the phone's launches with a prompt, including its Source Control actions;
  • local orchestration chat workers, whose task message was sent after an eager start.

What changes.

  • A launch whose prompt is submitted creates the chat with that prompt as its first message, in one step, without starting the agent. The prompt then starts the agent through the retrying start. The separate second send is removed. Launches with no prompt or a draft prompt behave exactly as before.
  • Local chat workers are created without starting the agent; their task message starts it, with retries. Remote workers are terminal-only and unchanged.
  • Launch options the target agent cannot hold (for example a saved fastMode on a Codex launch) are dropped before the chat is created, so launches that work today are not refused.
  • No saved field, wire change or setting. Older clients' own create and attach paths are unchanged.

What a launch reply means now. A successful prompted launch means the chat and its prompt are saved; it no longer implies the agent has started. If the agent cannot start after five attempts, the failure shows on that prompt in the chat. Today a spawn failure before the agent was published failed the launch call itself; that failure now appears in the chat instead.

Differences from the common pattern.

  • Intended: the common pattern also creates a thread with its first message and reports acceptance before the provider starts. Orca keeps an eager start for launches with no prompt, because older clients that cannot create a resting chat rely on it.

Follow-up to #33045 and #33685. Tracked in STA-11117.

Author: @BrennanKB5

@brennanb2025
brennanb2025 marked this pull request as ready for review October 26, 2026 07:55
@coderabbitai

coderabbitai Bot commented Oct 26, 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: 56591bc4-b64b-46c6-8bfc-4eca4daf7171
Commits

Reviewing files that changed from the base of the PR and between 7d12bb8 and 9f1a5d6.

Files selected for processing: 2
  • src/main/runtime/rpc/methods/agent-launch-at-rest.test.ts
  • src/main/runtime/rpc/methods/agent-launch-surfaces.ts
Files skipped from review as they are similar to previous changes: 2
  • src/main/runtime/rpc/methods/agent-launch-surfaces.ts
  • src/main/runtime/rpc/methods/agent-launch-at-rest.test.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.

Walkthrough

Structured launch prompts now enter session creation as first messages. The creation result carries the committed message ID used to settle the prompt, replacing separate post-creation delivery. Launch tests cover prompt outcomes, retries, replay, cancellation, and publication failures. Structured worker sessions are created at rest, and tests cover dispatch after a transient adapter-open failure and handling repeated startup failures.

Priority: Normal

Merge Risk: Minimal · up to 9f1a5

The stale test-hook concern appears resolved, and the launch-option fix preserves supported options. No actionable merge-blocking risk remains after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 15.79% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 11 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: routing launch prompts and worker tasks through the retrying start path.
Description check Passed The description is mostly complete. It explains the problem, behavior changes, scope, linked issues, compatibility impact, testing, and QA results. It does not reproduce every template heading or chec…
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: Description check

Explanation

The description is mostly complete. It explains the problem, behavior changes, scope, linked issues, compatibility impact, testing, and QA results. It does not reproduce every template heading or checklist item, but the required core information is present.

Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • 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: 2d6a1784-e2b2-454e-96dd-dd50637df1c9
Commits

Reviewing files that changed from the base of the PR and between b252aef and 7631e7b.

Files selected for processing: 14
  • src/main/agent-launch/agent-launch-executor-cancel.test.ts
  • src/main/agent-launch/agent-launch-executor.test.ts
  • src/main/agent-launch/agent-launch-executor.ts
  • src/main/agent-launch/agent-launch-prompt-delivery.ts
  • src/main/agent-launch/agent-launch-surface-factories.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-launch-send-after-create.test.ts
  • src/main/runtime/rpc/methods/agent-launch-at-rest.test.ts
  • src/main/runtime/rpc/methods/agent-launch-caller-selection.test.ts
  • src/main/runtime/rpc/methods/agent-launch-structured-prompt.test.ts
  • src/main/runtime/rpc/methods/agent-launch-structured-prompt.ts
  • src/main/runtime/rpc/methods/agent-launch-surfaces.ts
  • src/main/runtime/rpc/methods/orchestration-structured-worker-retry.test.ts
  • src/main/runtime/rpc/methods/orchestration-structured-worker-session.ts
  • src/main/runtime/rpc/methods/structured-agent-session-create.ts
Files with no reviewable changes: 4
  • src/main/native-chat/agent-session-wire/structured-agent-session-launch-send-after-create.test.ts
  • src/main/agent-launch/agent-launch-executor-cancel.test.ts
  • src/main/runtime/rpc/methods/agent-launch-structured-prompt.ts
  • src/main/runtime/rpc/methods/agent-launch-structured-prompt.test.ts

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: 2


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: 20cceae9-2c4a-4e02-adc9-978d42b700f7
Commits

Reviewing files that changed from the base of the PR and between 2eece53 and f147817.

Files selected for processing: 3
  • src/main/agent-launch/agent-launch-prompt-delivery.ts
  • src/main/runtime/rpc/methods/agent-launch-at-rest.test.ts
  • src/main/runtime/rpc/methods/orchestration-structured-worker-retry.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 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: 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: 89f004f5-37e1-41a3-866b-9772dec9d1f5
Commits

Reviewing files that changed from the base of the PR and between f147817 and 7d12bb8.

Files selected for processing: 2
  • src/main/runtime/rpc/methods/agent-launch-surfaces.ts
  • tests/e2e/agent-launch-cli.unit.test.ts

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

@brennanb2025

brennanb2025 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor Author

A prompted launch could leave the saved message unsent after a transient agent-start failure, while a normal composer send retried. Background workers could fail before delivering their task. Submitted prompts now use the chat creation's existing first-message receipt and retrying start. Local workers are created at rest so their agent-sourced task starts the same retrying path. Bare and draft launch behavior is preserved.

The full source review finished in four rounds with no open P0/P1. Fixed whitespace-only RPC prompts being dispatched as empty turns, bounded option filtering to the existing seed keys, preserved the encoded seed map with one codec pass, and corrected stale executor/replay fixtures. The test audit retained distinct retry, exhaustion, replay, publication uncertainty and worker-provenance contracts, and removed duplicate/implementation-specific checks. A fresh round-3 decider kept the lifecycle architecture and authorized only the encoding correction. The common-pattern comparison and performance/readiness reviews are complete.

Deferred P2: an internal signal-bearing executor can commit if aborted during create preparation. No current production structured-launch caller supplies that signal, so the review did not broaden cancellation behavior. Generic explicit permission omission predates this change and is outside this PR.

Validation: 92 named tests and commit hooks passed at premerge 9981a6131c9280ad776924b631f29d9558427bde; CI on QA head 7d12bb8017ce45fc7abd69633eacba88ae3df595 passed after one named cold-import flake was reproduced and rerun. The later repair 9f1a5d6e6f9e6d8c4835e36534175d80dc58a4d6 changes one production line and adds 50 test lines: its actual factory-to-record cases failed before the fix (2 failed, 13 passed) and passed afterward (15/15), with hooks passing. It corrects the supported internal boolean selection contract; current public string-valued callers are unchanged. Fresh CI on reviewed merge head 36b3698580e0a11d8405aa1b0e3d7aa4f4fb37b4 passed. Under the CI-main-failure exception, merge 36b3698580e0a11d8405aa1b0e3d7aa4f4fb37b4 brought in main 9f02111538c3c457d3aeb35b657672f623592559, including #33934's layout-test fix; the scoped merge hook passed and a narrow merge review confirmed all PR file contents were preserved. The commits since QA are the tests-row encoding repair 9f1a5d6e6f9e6d8c4835e36534175d80dc58a4d6 and that main merge. #30449 remains open and none of its changes were absorbed.

All real QA below ran at 7d12bb8017ce45fc7abd69633eacba88ae3df595. The later encoding correction changes a tests-row contract without changing startup, recovery, process ownership, rendering or saved data, so its named tests and fresh CI validate that delta while the completed QA is retained.

Real QA has completed both prompted worktree CLI launches, both older-client launches, both structured workers, and both retained-state upgrades. Each passed launch/worker case used one verified first-start provider termination and automatic recovery to a real reply. Worker evidence shows one agent-sourced accepted preamble and one successful turn; Codex emitted the same token in commentary and final answer within that turn. The targeted older-client Codex case also recovered to a real reply after a strict QA controller repair for the installed launcher wrapper. Earlier 429 trials and a no-fault compatibility trial remain recorded separately. No passed flow was repeated.

Upgrade evidence retained main-created sessions/history/provider identities through a graceful stop into the exact unmodified branch, then two ordered sends/replies per agent across git and folder workspaces. Codex's main seed never received a successful reply because of 429; its original failed history was retained and resumed successfully. Independent evidence review confirmed that this covers the upgrade requirement, with that plan deviation recorded.

For Brennan's review: full-window main/branch comparisons below. The historical client uses its actual pinned renderer, bridge and RPC client without the create-message capability; its host adapter is QA-only. Workers are intentionally background sessions, so screenshots show the supported worker-read output in an ordinary isolated app terminal.

Flow Main Branch
CLI worktree launch — Claude CLI worktree launch — Claude main startup failure real reply
CLI worktree launch — Claude branch real reply
CLI worktree launch — Codex CLI worktree launch — Codex main startup failure real reply
CLI worktree launch — Codex branch real reply
Older client — Claude Older client — Claude main startup failure real reply
Older client — Claude branch real reply
Older client — Codex Older client — Codex main startup failure real reply
Older client — Codex branch real reply
Local worker — Claude Local worker — Claude main startup failure succeeded, real reply
Local worker — Claude branch succeeded, real reply
Local worker — Codex Local worker — Codex main startup failure succeeded, real reply
Local worker — Codex branch succeeded, real reply

Retained-state upgrade, two replies each:

Claude (git) Codex (folder; retained failed main history)
Claude retained history and two replies Codex retained failed history and two replies

Judgment points: first-message construction and receipt, bounded seed selection, and worker creation at rest.

QA notes: the targeted Codex run used the installed launcher’s Node wrapper and verified native child, with one pre-ready SIGTERM, a distinct retry provider and one accepted turn. A missing release-log acknowledgment is consistent with an exit race; direct signal and retry receipts establish the recovery. The private QA runtime matched its installed source byte for byte; both reported the same existing strict-signature verification error, with no signing or OS trust changes.

@brennanb2025
brennanb2025 merged commit c20971d into main Oct 26, 2026
42 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/launch-prompt-retry branch October 26, 2026 17:46
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