You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(droid): run Orca's Plan mode as Droid Spec - #47845
Orca's Plan mode now works in Droid chats. Droid plans first (its "Spec" mode), shows the plan as Orca's plan card, and starts building only after you approve.
What Changed
Rebased onto main at 3d3d28c. It depends on #47843; until it merges, this diff also shows its commit. Review only this PR's commit f757b75af5.
Plan maps to Droid's spec autonomy level through a new dialect field planPermissionMode. Build returns to the level the chat ran at before Plan, and a permission picked during Plan waits for Build.
Droid's spec approval request (ExitSpecMode) shows as Orca's plan card ("Approve plan" / "Keep planning").
Approve answers with the option that keeps the chat's Build level: proceed_auto_run_<risk> for auto levels, proceed_once for Auto (Off). Keep planning answers cancel and stays in Spec.
The validated-plan store rule now covers Droid as well as Claude, so the Plan chip clears after approval.
Review fixes since the first push:
Plan/Build and permission picks are written to Droid one at a time, so a quick permission pick cannot land after Plan's switch to Spec and leave the chat in the wrong mode.
Why
Droid supports a spec-first flow over ACP, but Droid chats had no Plan mode, and approving a spec with the wrong option drops the chat to Auto (Off).
In a scratch repo with calc.py holding only add: /plan ("Switch to Plan mode") turned on the Plan chip. "Add a subtract(a, b) function to calc.py." came back as a plan card with Approve plan / Keep planning. Keep planning kept Plan on and Droid revised the plan. Approve plan cleared the Plan chip, Droid added subtract with a docstring and checked it, and the permission picker read Full access afterwards.
/plan in a Droid chat:
Droid's spec arrives as the plan card:
After Approve plan: Plan is off, Droid made the edit, and the composer is back in Build:
Testing
Local macOS only.
ORCA_CODE_QUALITY_BASE=ac/07-b9-droid-model-list pnpm check:changed passed on this commit after the rebase (format, oxlint, typecheck, tests importing the change, selected ratchets).
Full unit suite (pnpm test --maxWorkers=6) on this branch: 1310 test files passed, 3 failed, 15 skipped. The failing files also fail on main at 3d3d28c on this machine: agent-cli-update-timeout (timing), bot-upcoming-copy (locale), worktree-removal-real-git (temp-dir cleanup).
Each added test was mutation-checked: reverting the production change it covers made it fail.
Golden E2E journeys ran on the previous stack tip (main at 59f3122): 8 passed, 4 skipped (Windows-only), and golden-fresh-profile-terminal failed the same way on main. Not rerun after the rebase.
Live check, before the rebase: dev build of the previous stack tip, launched hidden with ORCA_BACKGROUND_LAUNCH=1 and an isolated profile, driven over CDP at 1440x900, with a real Droid 1.17.2 login and model Claude Opus 5.5. Details under Visual Proof.
Not run: Linux, Windows, or SSH remote hosts.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
None, because the mode check before each send already existed; Plan only changes which config value it writes.
Risk
Level: Medium
Touches shared ACP option and prompt paths (acp-select-choices, acp-structured-options, acp-structured-prompts), but only dialects that declare planPermissionMode (Droid) take the new branch. A bug would leave a Droid chat in Spec or at the wrong autonomy level after approval. Back out with a plain revert.
AI Disclosure
Review
Self-reviewed this PR's single commit for correctness, security, and performance. Merge order:
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Considered security, macOS/Linux/Windows paths, SSH remote hosts, mobile compatibility, folder workspaces, and performance. Execution coverage is limited to the checks listed under Testing.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
Merge message
feat(droid): run Orca's Plan mode as Droid Spec
Droid has a spec-first autonomy level, but Droid chats had no Plan
mode. Map Plan to spec and return Build to the pre-Plan level, show
Droid's spec approval as the plan card, approve with the option that
keeps the chat's Build level, and clear the Plan chip on approval.
Droid ACP now reads model options and reasoning-effort choices from the account’s model catalog. ACP Plan and Build handling now retains the Build permission mode while Plan is active and passes it to prompt replies. Droid spec permission requests receive approval choices based on the Build mode. Droid sessions are also included in validated-plan interaction-mode updates.
Merge Risk: Moderate · up to f757b
With Droid Plan mode, changing the model or reasoning effort while Plan is being entered can leave the chat's stored permission state out of step with the agent. A later permission change can then take the agent out of Spec unexpectedly. Several smaller Droid session-tracking and permission-ordering issues also remain open. These should be addressed or explicitly accepted before merge.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "feat(droid): run Orca's Plan mode as Droid Spec" matches the main change. The PR maps Orca's Plan mode to Droid's spec autonomy level, and the diff adds spec approval handling. The title is…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, AI Disclosure, Review, Agent skill upstream boundary, N…
Full details: Title check
Explanation
The title "feat(droid): run Orca's Plan mode as Droid Spec" matches the main change. The PR maps Orca's Plan mode to Droid's spec autonomy level, and the diff adds spec approval handling. The title is specific and follows a conventional commit style. It names the Droid scope and the mapping, but not the approval card or the Build-level restore, which the title does not need to cover.
Full details: Description check
Explanation
The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections, and each is substantively filled in. The change scope, mechanism, testing, live check, and risk level are all described. Gaps: the Linked Issue says 'Part of #37354' rather than the 'Fixes #' form the template asks for, and the template asks for a complete issue link, so this is a partial match. The 'Review' section is an unusual addition but harmless. The AI Disclosure section still contains the template's HTML comments with no answer. The final checklist item for lint, typecheck, test, and build is unchecked. The description also cites a commit hash (f757b75) that differs from the commit hash in the objectives (80ee86c), which is a consistency issue for reviewers. Overall, the description is mostly complete.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Data Integrity & Integration · Heavy lift
A permission pick made during a pending Plan-to-Build write can be overwritten.
When a Build write is still in flight, the permission write reads the Plan value and only updates the local record. The Build reply then installs the higher autonomy level, and nothing in the inspected permission path reapplies the newer, lower choice. The agent can keep running at the Build level until another permission write, a restart, or a later send restores the chosen level.
Order the permission write after the pending interaction-mode write, or make the Build completion keep the newer permission choice. The required behavior is that the latest permission pick wins on the running agent.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Data Integrity & Integration · Quick win
Record the Build level before an agent-initiated switch into Spec.
AcpInteractionModeChoice learns the Build level only from an Orca Plan write (write) or a deferred permission choice (adoptBuild). When the agent changes its own autonomy level to spec through config_option_update, adoptConfigOptions stores the new value and does not record the previous level. If the session adopted auto-high at launch or from a prior update, lastBuild stays unset. running('spec') then reports the Droid default normal, and build() returns normal when the plan is approved. The chat leaves Spec at normal, not at the level it had before Spec.
Record the non-Spec level when the observed mode changes into the plan value outside an Orca write. The exact recording point is a design choice. It must preserve the level for both Orca-initiated and agent-initiated Spec entry.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Data Integrity & Integration · Quick win
Keep an empty hooks.json event array after cleanup.
If hooks.json starts with PreToolUse: [], it suppresses a custom PreToolUse hook in settings.json. Installation adds Orca's hook to that empty array. Removal then deletes the event, so Droid loads the previously suppressed custom hook from settings.json.
For hooks.json cleanup, retain an empty array when the last managed definition is removed. Keep the settings.json cleanup separate. This preserves the event override without retaining Orca's command.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Select the lease that belongs to the stored row, not the first provider in list order.
HookLeaseExpiryTimers passes Claude before Droid. AgentLeaseExpiryTimers.lease() returns the first provider that has a lease, so when both leases exist the Claude deadline controls the wakeup. A Droid child deadline that expires sooner is ignored until the Claude deadline, which can be up to 60 seconds later. The Claude lease also does not check that the row is a Claude row.
Droid session start clears turn-cache state but not Claude lead or owed-task state. A stale Claude lead can therefore remain on a Droid pane. The lease selection must not let that stale lead override the current row's own deadline.
Define the required behavior before changing the code. Either the lease must belong to the provider that owns the stored row, or the earliest valid deadline must win. Choose one rule and apply it in agent-lease-expiry-timers.ts, and ensure the Claude lease is inactive on a non-Claude row.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Keep the Droid lead Stop reply in the session normalization branch.
For a Droid lead Stop with last_assistant_message, normalize() sets state.eventReplyCandidate. The sessionNormalization branch then returns replyCandidate: undefined, so the reply is not admitted as acceptedReply. getAcceptedReply returns undefined for that turn, where the base commit returned the reply. The retry path does not restore it. The retry re-enters this branch, and the Droid verdict read returns only a verdict.
Read the candidate after normalize() and clear it, as the normal path does.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Retain cancellation until the held-open turn completes.
If a child survives an earlier lead Stop, a later idle_prompt retains that child. The resolved row stays working, so this condition discards the cancellation verdict. When the child finishes and its lease expires, settleDroidLeaseExpiry emits done without that verdict.
Store the pending cancellation in the lead/session state and include it in the final completion payload. Clear it when a new lead turn starts. Keep immediate cancellation working when no child holds the row open.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Classify child AskUser and high-risk PreToolUse as waiting.
The child branch in normalizeDroidEvent skips the AskUser and high-risk check that the lead branch applies. applyDroidChildEvent records every child PreToolUse as working. A child that waits for an answer to AskUser, or for a high-risk approval, therefore shows as working in its roster entry. The lead path shows waiting for the same call. Compute the same classification for child PreToolUse, and pass it into the child helper.
The reason will be displayed to describe this comment to others. Learn more.
Major · Functional Correctness · Heavy lift
A later parent name cannot repoint a lead that a child-named parent created.
If Droid's calling_session_id names the immediate parent, a child-first start can misassign the pane's lead. When a child start names parent B and the pane has no sessions, adoptChild creates B as a provisional lead (droid-sessions.ts:146). The same call then runs confirmOrRepointLead, which sets provisional = false (lines 150-152, 117). B becomes a confirmed lead.
If B later starts with calling_session_id naming its own parent A, line 150 skips the repoint because provisional is false. Line 154 then skips recording B as a child, since B is the lead. adoptChild returns undefined and admitStart returns SKIP. A is never promoted. Hooks from A do not match the lead or a child, so they can be dropped.
Required behavior: a later parent name that reaches above the current lead must repoint the lead to the top-level ancestor. This must hold even when the lead was created from a child-named parent.
The reason will be displayed to describe this comment to others. Learn more.
Major · Functional Correctness · Quick win
Reject starts for known and finished children before replacing the lead.
A SessionStart with no calling_session_id skips the parent-chain checks and reaches createSessions. This can occur when the transcript also names no parent, for example when the transcript is unreadable. For a session already tracked as a child, this replaces the pane's lead, discards the child roster, and marks the prior row done. The real lead's later hooks are then skipped at the final branch.
The finished-child rule at droid-sessions.ts:37-38 says a late start must not bring a finished child back. The no-parent path does not apply that rule.
Return SKIP for a known or finished child before the replacement. Keep the replacement for a new root session.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Child-session hooks clear the lead's exit marker and stop its exit watch.
After the lead's SessionEnd sets the exit marker, any later hook for another session clears it. This happens at droid-sessions.ts:213-214, before the hook is checked for child linkage, so a hook that is later skipped also clears it. The exit watch captures that marker and treats its absence as isCurrent() === false. On the next probe, agent-process-exit-watch.ts:45-53 deletes the watch without rescheduling it. Child events do not restart it, so the process exit for the ended lead is no longer detected unless another reconciliation path runs.
Keep the exit marker for the ended lead while child events arrive. Clear it only when that lead's exit state is replaced, or when the watch has completed.
Droid lists the account's models over `_factory/models/list` without a
session, so model discovery no longer needs a session Droid cannot delete.
Read each model's own reasoning efforts from the listing and from session
models, so the picker offers the right levels for every model.
Plan maps to Droid's `spec` autonomy level. Build returns to the level
the chat ran at before Plan, and a permission picked during Plan waits
for Build instead of ending Spec.
Droid's spec approval shows as Orca's plan card. Approving answers with
the option that keeps the chat's Build level (proceed_auto_run_<risk>
for auto levels, proceed_once for Auto (Off)); "Keep planning" stays in
Spec. The validated-plan store rule now also covers Droid, so the Plan
chip clears after approval.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Major · Data Integrity & Integration · Heavy lift
A superseded Plan write drops its state adoption, so a later permission pick can end Spec.
When a Plan write runs, boundAcpOptionWrite increments options.writeRevision. A model or effort setOption also increments that counter, and it does not wait for the mode-write queue. If such a write starts before the Plan reply returns, the Plan write throws option write was superseded at acp-session-option-write.ts:65-67. It skips its apply() step, so adoptConfigOptions never runs and options.configOptions keeps the Build value while the agent is in Spec. The caller receives a rejected Plan setOption.
The next permission write reads that stale state. In writeAcpSessionMode, modeChoice.holds(...) does not match the Build value, so the write sends setConfigOption directly at acp-live-permission-mode.ts:90-92. That write can end Spec instead of adopting Build. A model write does not refresh configOptions. An effort write refreshes it only when its reply reflects the agent after the Plan change, so neither write reliably restores the state.
A successful Plan write must leave the option state in agreement with the agent before a later permission write reads that state. A superseding write must not discard the Plan adoption unless it also supplies a complete newer configuration. Alternatively, the permission path must not decide from state that a superseded write left stale. The choice between these approaches is open.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Orca's Plan mode now works in Droid chats. Droid plans first (its "Spec" mode), shows the plan as Orca's plan card, and starts building only after you approve.
What Changed
Rebased onto main at 3d3d28c. It depends on #47843; until it merges, this diff also shows its commit. Review only this PR's commit
f757b75af5.specautonomy level through a new dialect fieldplanPermissionMode. Build returns to the level the chat ran at before Plan, and a permission picked during Plan waits for Build.ExitSpecMode) shows as Orca's plan card ("Approve plan" / "Keep planning").proceed_auto_run_<risk>for auto levels,proceed_oncefor Auto (Off). Keep planning answerscanceland stays in Spec.Review fixes since the first push:
Why
Droid supports a spec-first flow over ACP, but Droid chats had no Plan mode, and approving a spec with the wrong option drops the chat to Auto (Off).
Linked Issue
Part of #37354
Visual Proof
In a scratch repo with
calc.pyholding onlyadd:/plan("Switch to Plan mode") turned on the Plan chip. "Add a subtract(a, b) function to calc.py." came back as a plan card with Approve plan / Keep planning. Keep planning kept Plan on and Droid revised the plan. Approve plan cleared the Plan chip, Droid addedsubtractwith a docstring and checked it, and the permission picker read Full access afterwards./planin a Droid chat:Testing
Local macOS only.
ORCA_CODE_QUALITY_BASE=ac/07-b9-droid-model-list pnpm check:changedpassed on this commit after the rebase (format, oxlint, typecheck, tests importing the change, selected ratchets).pnpm test --maxWorkers=6) on this branch: 1310 test files passed, 3 failed, 15 skipped. The failing files also fail on main at 3d3d28c on this machine:agent-cli-update-timeout(timing),bot-upcoming-copy(locale),worktree-removal-real-git(temp-dir cleanup).golden-fresh-profile-terminalfailed the same way on main. Not rerun after the rebase.ORCA_BACKGROUND_LAUNCH=1and an isolated profile, driven over CDP at 1440x900, with a real Droid 1.17.2 login and model Claude Opus 5.5. Details under Visual Proof.Not run: Linux, Windows, or SSH remote hosts.
Changed test files:
src/main/acp/acp-dialects/droid-spec-approval.test.tssrc/main/acp/options/acp-structured-options-droid-spec.test.tsPerformance
None, because the mode check before each send already existed; Plan only changes which config value it writes.
Risk
Level: Medium
Touches shared ACP option and prompt paths (
acp-select-choices,acp-structured-options,acp-structured-prompts), but only dialects that declareplanPermissionMode(Droid) take the new branch. A bug would leave a Droid chat in Spec or at the wrong autonomy level after approval. Back out with a plain revert.AI Disclosure
Review
Self-reviewed this PR's single commit for correctness, security, and performance. Merge order:
Agent skill upstream boundary
Notes
Considered security, macOS/Linux/Windows paths, SSH remote hosts, mobile compatibility, folder workspaces, and performance. Execution coverage is limited to the checks listed under Testing.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Merge message