Repository navigation
feat(native-chat): unify local agent entrypoint routing - #18248
Conversation
ea0c449 to
e8c1a69
Compare
|
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. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (13)
💤 Files with no reviewable changes (2)
🚧 Files skipped from review as they are similar to previous changes (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe change centralizes agent launch route selection and adds structured Codex session recovery, prompt staging, cancellation, and fallback handling. Workspace creation, onboarding, direct work-item launches, and new-tab launches now support structured native chat when eligible. Activation avoids redundant terminal creation when a structured session provides the initial surface. Local runtime capabilities are cached and refreshed before structured session synchronization. Tests cover routing, recovery, prompt delivery, cancellation, and activation behavior. Merge Risk: 🟡 Moderate · up to This PR changes local agent launches to create durable native chat sessions, but some failure and cancellation paths can leave staged prompts or sessions uncleared, bypass the established trust check, or open a workspace without a usable chat or terminal. The current head is not merge-ready until these bounded security and launch-reliability risks are fixed or explicitly accepted. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description clearly explains the change, motivation, behavior, entrypoints, and validation. However, it omits the required Linked Issue section and link, and it does not provide the required Visual Proof attachments or the exact N/A statement. Several required checklist sections are also missing. ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 8
🧹 Nitpick comments (1)
src/renderer/src/components/sidebar/NonGitFolderDialog.tsx (1)
104-104: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove or correct the unreachable structured branch.
When
connectionIdis non-empty,worktreeRefreshOptions(undefined, connectionId)returnstoSshExecutionHostId(connectionId).resolveDismissedOnboardingFolderAgentLaunchpasses this value toresolveAgentLaunchRoute, which requiresexecutionHostId === 'local'forstructured-native-chat. The branch cannot run in this SSH flow. Confirm the intended host ID; otherwise remove lines 104–120.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 41848ee6-f0b2-407f-bf79-947b81f90b82
📒 Files selected for processing (48)
src/renderer/src/components/native-chat/structured-agent-session-outbox-storage.tssrc/renderer/src/components/sidebar/NonGitFolderDialog.tsxsrc/renderer/src/components/sidebar/folder-workspace-agent-startup.tssrc/renderer/src/components/sidebar/folder-workspace-composer-submit.tssrc/renderer/src/components/tab-group/useTabGroupTabCloseCommands.structured-session.test.tssrc/renderer/src/components/tab-group/useTabGroupTabCloseCommands.tssrc/renderer/src/hooks/composer-state/composer-submit-orchestration.tssrc/renderer/src/hooks/composer-state/folder-submit-orchestration.tssrc/renderer/src/hooks/composer-state/full-creation-execution.test.tssrc/renderer/src/hooks/composer-state/full-creation-execution.tssrc/renderer/src/hooks/composer-state/full-creation-finalization.tssrc/renderer/src/hooks/composer-state/full-creation-issue-command.tssrc/renderer/src/hooks/composer-state/full-creation-startup.tssrc/renderer/src/hooks/composer-state/full-creation-structured-launch.tssrc/renderer/src/hooks/composer-state/quick-creation-execution.tssrc/renderer/src/hooks/composer-state/quick-creation-request.tssrc/renderer/src/lib/agent-launch-routing-caller-census.test.tssrc/renderer/src/lib/agent-launch-routing.test.tssrc/renderer/src/lib/agent-launch-routing.tssrc/renderer/src/lib/launch-agent-in-new-tab-cwd.test.tssrc/renderer/src/lib/launch-agent-in-new-tab.tssrc/renderer/src/lib/launch-agent-structured-chat-guard.test.tssrc/renderer/src/lib/launch-agent-tab-order.tssrc/renderer/src/lib/launch-structured-codex-session.test.tssrc/renderer/src/lib/launch-structured-codex-session.tssrc/renderer/src/lib/launch-work-item-direct-agent-routing.tssrc/renderer/src/lib/launch-work-item-direct-prompt-delivery.tssrc/renderer/src/lib/launch-work-item-direct.tssrc/renderer/src/lib/onboarding-folder-agent-startup.tssrc/renderer/src/lib/pending-worktree-creation.tssrc/renderer/src/lib/structured-agent-session-launch-prompt.tssrc/renderer/src/lib/structured-agent-session-launch-recovery.tssrc/renderer/src/lib/structured-agent-session-launch.test.tssrc/renderer/src/lib/structured-agent-session-launch.tssrc/renderer/src/lib/structured-native-chat-availability.test.tssrc/renderer/src/lib/structured-native-chat-availability.tssrc/renderer/src/lib/worktree-activation-emptied-workspace-reseed.test.tssrc/renderer/src/lib/worktree-activation-nav-registration.tssrc/renderer/src/lib/worktree-activation-store-contract.tssrc/renderer/src/lib/worktree-activation.tssrc/renderer/src/lib/worktree-agent-activation-seam.test.tssrc/renderer/src/lib/worktree-creation-flow-execute.tssrc/renderer/src/lib/worktree-creation-structured-session.tssrc/renderer/src/lib/worktree-initial-terminal-seeding.tssrc/renderer/src/runtime/local-runtime-capabilities.test.tssrc/renderer/src/runtime/local-runtime-capabilities.tssrc/renderer/src/runtime/local-structured-session-tabs-sync.tssrc/renderer/src/store/repos/repo-add-actions.ts
💤 Files with no reviewable changes (2)
- src/renderer/src/lib/structured-native-chat-availability.test.ts
- src/renderer/src/lib/structured-native-chat-availability.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| if (args.structuredLaunch || !args.agent || !window.api.agentTrust?.markTrusted) { | ||
| return | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Restore the empty-path guard before the trust write.
The previous inline code required worktreePath before it called markTrusted. This guard is gone. When result.worktree.path is empty, this helper now sends an empty workspacePath to the trust IPC. Add the path check.
🛡️ Proposed fix
- if (args.structuredLaunch || !args.agent || !window.api.agentTrust?.markTrusted) {
+ if (
+ args.structuredLaunch ||
+ !args.agent ||
+ !args.workspacePath ||
+ !window.api.agentTrust?.markTrusted
+ ) {
return
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (args.structuredLaunch || !args.agent || !window.api.agentTrust?.markTrusted) { | |
| return | |
| } | |
| if ( | |
| args.structuredLaunch || | |
| !args.agent || | |
| !args.workspacePath || | |
| !window.api.agentTrust?.markTrusted | |
| ) { | |
| return | |
| } |
| return | ||
| } | ||
| const supported = status.capabilities?.includes(STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY) | ||
| const supported = capabilities.includes(STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Recompute support after tab restoration.
Line 136 uses the first capability refresh. restoreLocalStructuredSessionTabsOnce() performs a second refresh on first use. If the capability changes between these reads, this code can subscribe after support was removed or skip subscription after support was added. Read the cached capabilities after restoration, or pass one refresh result through both operations.
Proposed fix
-import { refreshLocalRuntimeCapabilities } from './local-runtime-capabilities'
+import {
+ readLocalRuntimeCapabilities,
+ refreshLocalRuntimeCapabilities
+} from './local-runtime-capabilities'
- const capabilities = await refreshLocalRuntimeCapabilities()
+ await refreshLocalRuntimeCapabilities()
if (args.isDisposed()) {
return
}
- const supported = capabilities.includes(STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY)
await restoreLocalStructuredSessionTabsOnce()
if (args.isDisposed()) {
return
}
+ const supported = readLocalRuntimeCapabilities().includes(
+ STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY
+ )📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const supported = capabilities.includes(STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY) | |
| const supported = readLocalRuntimeCapabilities().includes( | |
| STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY | |
| ) |
There was a problem hiding this comment.
Important
The routing, ownership gates, and prompt-durability logic are solid, but one coalescing path silently drops a racing prompt and misreports its delivery to the caller. Details below.
Reviewed changes
- Central route resolver —
resolveAgentLaunchRoutefolds the structured / legacy-native-chat / terminal decision into one fail-closed function gated on execution host, platform, project runtime, and the host's advertised capability, wired into every local entrypoint. - Durable prompt staging — structured Codex launches stage the prompt in a localStorage outbox, then dispatch it after
agentSession.create, requeueing on refusal and falling back to the preserved terminal launch throughclaimDefinitiveRefusalFallback. - Launch coalescing, cancellation, reconcile — one launch identity per worktree with re-reconcile on unknown visibility, plus
cancelStructuredCodexLaunchon tab close. - Capability gating —
local-runtime-capabilities.tsreads the live host's capabilities (fail-closed) and replaces the removedcanUseStructuredNativeChat. - Activation surface control —
providesInitialSurface/createNewTerminalForStartupkeep an unwanted terminal out of structured launches while preserving the refusal-fallback terminal. - Mechanical extraction — creation orchestration split into focused helpers (
full-creation-*,launch-work-item-direct-*,worktree-creation-structured-session,launch-agent-tab-order) with no stated behavior change.
ℹ️ Nitpicks
trackLaunchFailureToast(src/renderer/src/lib/structured-agent-session-launch.ts:138) attaches a.catchto everystate.promisevalue it is handed without thestate.promise === promisestaleness guard thattrackLaunchSettlementuses, so repeatedreconcileUnknownLaunchfailures can emit duplicate "Could not open Codex chat" toasts.cancelStructuredCodexLaunch(src/renderer/src/lib/structured-agent-session-launch.ts:228) discards the staged prompt optimistically, beforecloseStructuredAgentSessionis confirmed by the tab-close caller; a failed close leaves the host session alive with its prompt already deleted.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
|
||
| export type StructuredCodexLaunchOptions = { | ||
| prompt?: string | ||
| promptDelivery?: 'auto-submit' | 'submit-after-ready' |
There was a problem hiding this comment.
promptDelivery is accepted here and threaded from src/renderer/src/lib/launch-agent-in-new-tab.ts:227 and src/renderer/src/lib/launch-work-item-direct-agent-routing.ts:132, but neither settleStructuredCodexLaunchPrompt nor structuredCodexLaunchState reads it, so submit-after-ready collapses to immediate dispatch on the structured path. Honor the distinction or drop the option so it doesn't advertise behavior that doesn't exist.
There was a problem hiding this comment.
ℹ️ Follow-up commits are clean — no new issues. The prior review's open finding (and the minor prompts in
structured-agent-session-launch.ts) are untouched by these commits and still stand.
Reviewed changes
- Import dedup —
full-creation-execution.tsfolds the duplicatedCLIENT_PLATFORMimport back into the existing@/lib/new-workspaceline. - Deps-array consolidation —
folder-submit-orchestration.tsreplaces eightsettings?.{field}entries with the singlesettingsreference the submit callback now closes over, satisfying the exhaustive-deps gate. - Caller-census completion —
worktree-activation-surface-caller-wiring.test.tsregisters the six newprovidesInitialSurfacecallers and broadens the activation-call regex to[\s\S]*?so nested activation calls are matched.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: a98caf0b-132e-4845-9a66-5fa64ba88413
📒 Files selected for processing (1)
src/renderer/src/lib/worktree-activation-surface-caller-wiring.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
| // are stripped first — commenting the flag out in place must fail this test. | ||
| const ACTIVATION_CALL_WITH_OPT_OUT = | ||
| /activateAndReveal(?:Worktree|FolderWorkspace|Workspace)\((?:[^()]|\([^()]*\))*?providesInitialSurface: true/ | ||
| /activateAndReveal(?:Worktree|FolderWorkspace|Workspace)\([\s\S]*?providesInitialSurface: true/ |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Keep the opt-out match within the same activation call.
[\s\S]*? can cross the closing ) and match providesInitialSurface: true from a later activation call or unrelated code. A file with an earlier activation call that lacks the flag can therefore pass the census incorrectly. Use a parser or balanced-call scanner to verify the property belongs to the matched activation call.
There was a problem hiding this comment.
Important
The two new commits swap the resolver's platform from CLIENT_PLATFORM to the resolved launch platform, which silently admits WSL / repair-required local repos to structured Codex chat — the exact boundary resolveAgentLaunchRoute's own runtimeRefused gate (and this PR's summary) is meant to preserve.
Reviewed changes
- Routing now feeds the launch platform —
full-creation-execution.tsandquick-creation-execution.tsreplaceplatform: CLIENT_PLATFORMwithplatform: selectedRepoAgentLaunchPlatformin theirresolveAgentLaunchRoutecalls, and threadselectedRepoAgentLaunchPlatformthrough the composer submission inputs. - Boundary assertions updated —
useComposerState-host-context-boundaries.test.tsdrops theCLIENT_PLATFORMrouting assertion in favor of theselectedRepoAgentLaunchPlatformliteral.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Caution
The revert restores the correct CLIENT_PLATFORM routing gate, but leaves selectedRepoAgentLaunchPlatform wired to the wrong hook — the branch no longer typechecks (pnpm tc:web emits TS2353 + TS2345).
Reviewed changes
- Routing gate restored —
full-creation-execution.tsandquick-creation-execution.tsrevertresolveAgentLaunchRoute'splatformback toCLIENT_PLATFORM, and dropselectedRepoAgentLaunchPlatformfromfull-creation-execution.ts's input type; the startup plan still receives the launch platform. - Boundary test scoped —
useComposerState-host-context-boundaries.test.tsisolates the startup-plan assertions withsourceBetween, so the routing-call region no longer trips thenot.toContain('platform: CLIENT_PLATFORM')check.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No critical issues — the two follow-up commits are solid; one minor reuse suggestion inline.
Reviewed changes
- Typecheck restored —
selectedRepoAgentLaunchPlatformmoved from theuseFullCreationExecutioncall back ontouseFullSubmitPreparation, clearing the TS2353/TS2345 the prior review flagged (pnpm tc:webis clean). - Coalesced prompt delivery fixed — the existing-launch branch now stages and dispatches a second caller's prompt and returns a per-caller
promptDeliveryResult, so a racing continuation no longer silently drops its context (new test covers the success path). - Shared trust preflight — extracted
preflightAgentTrustintoagent-trust-preflight.tsand wired it into the structured-launch refusal fallbacks (direct work-item + worktree creation) so a terminal fallback pre-marks Codex trust. - Late-activation tab surface preserved —
setActiveTabTypegained an optionalworktreeId;activateStructuredAgentSessionTabpasses it so agent-session activation in a non-active worktree no longer clobbers the visible tab type.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| import { TUI_AGENT_CONFIG } from '../../../shared/tui-agent-config' | ||
| import type { TuiAgent } from '../../../shared/tui-agent' | ||
|
|
||
| export async function preflightAgentTrust(args: { |
There was a problem hiding this comment.
This new shared helper consolidates the markTrusted/preflightTrust lookup, but markDirectWorkItemAgentTrusted (launch-work-item-direct-agent-routing.ts:88), which this same PR adds, still inlines the identical field read and differs only by a structuredLaunch guard. Consider delegating to preflightAgentTrust so the two copies can't drift.
There was a problem hiding this comment.
ℹ️ No new issues in these four commits. Approval stays withheld only because three prior Pullfrog threads remain open and were not touched by this delta: the
promptDeliveryoption still dead in the structured path, the coalesced-refusal??=fallback first-wins residual, and themarkDirectWorkItemAgentTrusted/preflightAgentTrustduplication nit.
Reviewed changes
- Default-args classification —
hasExplicitTuiAgentArgsignores per-launch args that equal the agent's built-in default (e.g. Codex's--dangerously-bypass-approvals-and-sandbox) so resolved defaults no longer read as TUI customization and force a terminal fallback; wired intohasExplicitTuiLaunchCustomizationand every routing call site. - Structured quick-command history —
runQuickCommandInNewTabrecords quick-command recency immediately for structured launches (which publish their tab asynchronously), using the caller's group or its active-group fallback.
Both changes ship focused tests that would fail under the prior behavior.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No new issues in these two commits. One advances a prior open thread — the whole-outbox discard removes the orphaned-prompt residual on refusal/cancel — but the coalesced-refusal
??=first-wins fallback and the two other open threads remain, so approval stays withheld.
Reviewed changes
- Cleared the abandoned launch outbox —
discardStagedPromptremoved only the first caller'sstagedPromptId, orphaning coalesced prompts in localStorage after a refusal or cancellation. It's replaced bydiscardStructuredAgentSessionLaunchOutbox, which clears the entire session outbox on both paths. - Cancelled dismissed worktree launches —
launchStructuredWorktreeSessionnow takescreationId, subscribes to the store, and when the pending creation is dismissed mid-launch it cancels the in-flight Codex launch and retires any already-created session (closing it and its tab).executeWorktreeCreationshort-circuits instead of completing the handoff. A focused test covers the dismiss-mid-launch path.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No new issues in this commit. The coalesced-refusal
??=first-wins thread is now fully resolved; the two remaining minor threads (promptDeliverystill unread in the structured path, and themarkDirectWorkItemAgentTrusted/preflightAgentTrustduplication) are untouched by this delta and still hold approval.
Reviewed changes
- Per-caller refusal fallbacks —
structured-agent-session-launch.tsnow models coalesced launches as aStructuredLaunchCallerGroup(structured-agent-session-launch-callers.ts). Each caller keeps its ownclaimDefinitiveRefusalFallbackcallback, andsettleStructuredLaunchCallersWithFallbackruns every caller's fallback on refusal, closing the first-wins residual. visibilityUnknownoutcome —startStructuredCodexLaunchexposesisVisibilityUnknown(), and the full-creation, direct work-item, and worktree-creation flows now distinguish a definitive refusal (terminal fallback) from "couldn't confirm the session opened" (retry surface, no terminal fallback), each backed by a focused test.- Retry surface for unknown outcomes —
executeWorktreeCreationkeeps the pending creation in an error state ("Retry to check again") instead of completing the handoff when visibility is unknown, rather than reporting completion with no session to show.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No critical issues — one minor observation inline on the recovery-retry progress state.
Reviewed changes
- Extracted shared handoff — the post-create completion (clearing the pending entry, terminal seeding, agent startup, terminal focus, note persistence) moved into
completeWorktreeCreationso the primary and recovery paths share one routine. - Uncertain-launch reconciliation —
markStructuredWorktreeLaunchUnconfirmednow recordsstructuredLaunchRecoveryWorktreeId, andretryBackgroundWorktreeCreationroutes that entry toretryStructuredWorktreeLaunch, which reuses the already-created worktree and reconciles its Codex session instead of recreating it. - Focused coverage — the unknown-outcome test now asserts a recovery retry reconciles without a second
createWorktree.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| store.setActivePendingWorktreeCreation(creationId) | ||
| store.setActiveView('terminal') | ||
| store.setSidebarOpen(true) | ||
| if (entry.structuredLaunchRecoveryWorktreeId) { |
There was a problem hiding this comment.
The phase reset above runs before this branch and unconditionally sets phase: 'fetching' (plus status: 'creating'), so a recovery retry shows "Fetching base branch…" while actually reconciling an existing Codex session on an already-created worktree. Consider skipping the phase reset on this branch (or using an indeterminate phase) so the panel doesn't imply a git fetch is in progress.
There was a problem hiding this comment.
ℹ️ No new blocking issues — the release mechanism is correct and well-tested, with one consistency gap noted below.
Reviewed changes
- Exposed per-caller release after unknown outcomes —
startStructuredCodexLaunchnow returnsreleaseCallerAfterUnknownOutcome, backed by a newreleaseStructuredLaunchCallerAfterUnknownOutcomein the caller group that settles and drops the caller when the group outcome isunknown. - Recovery retry reuses the queued prompt —
launchStructuredWorktreeSessiongainedrecoverUnknownLaunch, starting the retry with empty options so the already-staged outbox prompt is not re-enqueued (no duplicateagentSession.send). - Refusal isolation between first and retry callers — the worktree-creation flow releases its caller on an unknown outcome, so a later recovery retry that is refused runs only the retry caller's terminal fallback, not the abandoned first caller's.
ℹ️ Direct work-item and full-creation structured launches still orphan their caller after an unknown outcome
releaseCallerAfterUnknownOutcome is only invoked by the worktree-creation recovery path. settleDirectWorkItemStructuredLaunch (src/renderer/src/lib/launch-work-item-direct-agent-routing.ts:162) and settleFullCreationStructuredLaunch (src/renderer/src/hooks/composer-state/full-creation-structured-launch.ts:41) observe the same isVisibilityUnknown() and claim the same definitive refusal fallback, but leave their caller in the coalesced group. A later re-launch of the same worktree reuses the identity and, if refused, settleStructuredLaunchCallersWithFallback still runs the abandoned first caller's terminal fallback, reopening the exact spurious-terminal case this commit fixes for the creation path.
Technical details
# Release the unknown-outcome caller in the direct and full-creation flows too
## Affected sites
- src/renderer/src/lib/launch-work-item-direct-agent-routing.ts:162 — returns `{ visibilityUnknown: true }` without releasing the caller.
- src/renderer/src/hooks/composer-state/full-creation-structured-launch.ts:41 — same shape; returns on unknown without release.
- src/renderer/src/lib/structured-agent-session-launch-callers.ts:226 — `releaseStructuredLaunchCallerAfterUnknownOutcome` exists but is only called from `worktree-creation-structured-session.ts:154`.
## Required outcome
- Decide whether the direct work-item and full-creation flows can re-reuse the same worktree identity after an unknown outcome; if so, release their caller there too so a refused re-launch cannot double-fire the abandoned fallback.
## Open questions for the human
- Is re-launch after an unknown outcome expected to mint a fresh intent (new identity) in those flows, making release unnecessary?DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No critical issues from the merge — one small cleanup from the merge resolution surfaced inline.
Reviewed changes
- Merged origin/main into the branch — two merge commits (
0a0230ef94,dacac4a) brought upstream native-chat and SSH/execution-host work into the shared files this PR also touches. No new PR-authored behavior change. - Reconciled shared launch files onto main's race-resistant logic —
structured-agent-session-launch.tsgaineduseStructuredCodexLaunchStatus(auseSyncExternalStorestatus hook plus listener notification),structured-agent-session-launch-recovery.tsgainedhasAdoptedStructuredSession(short-circuitsverifyPublishedSessionwhen the tab is already inunifiedTabsByWorktree), andlocal-structured-session-tabs-sync.tsgained publication-epoch/version fences and subscription reconnect logic. The branch's caller-group / refusal-fallback /releaseCallerAfterUnknownOutcomefeatures survive intact. - Store-adoption verification —
verifyPublishedSessionnow consults the renderer store before the inventory RPC, so adopted sessions resolve without an extra round-trip.
ℹ️ Nitpicks
- The merge left a duplicate
cancelStructuredCodexLaunch(see inline) in the single-tab close path.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| worktreeId | ||
| ) | ||
| if (item.contentType === 'agent-session') { | ||
| cancelStructuredCodexLaunch(worktreeId, item.entityId) |
There was a problem hiding this comment.
This new cancelStructuredCodexLaunch duplicates the call a few lines down (currently line 129), leaving back-to-back identical calls with two stacked // Why comments. The merge kept this PR's pre-existing cancel and main's #18251 "still-reconciling create" cancel, but the call is idempotent so the second is dead. Remove one call (both comments are worth keeping).
* feat(native-chat): unify local agent entrypoint routing * fix(native-chat): satisfy entrypoint routing quality gates * test(native-chat): keep activation caller census complete * fix(native-chat): honor selected runtime platform in routing * fix(native-chat): pass runtime platform through full creation * fix(native-chat): include runtime platform dependency * fix(native-chat): preserve client platform routing gate * fix(native-chat): preserve trust and coalesced prompts * fix(native-chat): preserve target tab surface on late activation * fix(native-chat): retain quick-command history for structured tabs * test(native-chat): cover structured quick-command group history * fix(native-chat): ignore resolved default agent args in routing * test(native-chat): cover default agent args classification * fix(native-chat): keep direct launch within lint limits * fix(native-chat): clear abandoned launch outbox * fix: cancel dismissed structured worktree launches * fix(native-chat): preserve coalesced launch recovery * fix(native-chat): reconcile uncertain worktree launches * fix(native-chat): reuse uncertain launch caller --------- Co-authored-by: Merge Sim <sim@local>

Summary
Centralize local agent-start routing so every supported visible entrypoint makes one shared decision about structured native Codex chat, legacy Chat UI, or terminal TUI. Structured Codex is used only when the experimental toggle, local capability, ownership, workspace, and launch-option gates all allow it. Unsupported, remote, SSH, WSL, Windows, floating, customized, or toggle-off launches retain their existing terminal/legacy behavior.
ELI5
Before, different buttons and creation flows each made their own guess about how to start an agent. That meant the same Codex launch could open different surfaces depending on where it started. Now they all ask one shared router the same question. If the launch is a supported local structured-Codex case, Orca opens one structured chat tab; otherwise it uses the established fallback for that host and context.
User-facing before / after
Before
After
Entrypoints covered
Shared
launchAgentInNewTabcallerscomponents/dashboard/launch-dashboard-agent.ts)components/right-sidebar/runSourceControlAgentActionStart.ts)components/right-sidebar/source-control/ai/recovery-launch.ts)components/right-sidebar/source-control/sync/use-git-history-commit-actions.ts)components/tab-bar/QuickLaunchButton.tsx)components/tab-bar/use-tab-bar-create-menu-controller.ts)components/terminal-pane/terminal-agent-session-fork.ts)components/use-terminal-create-actions.ts)lib/fix-checks-agent-launch.ts)lib/launch-agent-session-continuation.ts)lib/run-quick-command-in-new-tab.ts)Direct creation families using the same route policy
components/sidebar/folder-workspace-composer-submit.ts)hooks/composer-state/full-creation-execution.ts)hooks/composer-state/quick-creation-execution.ts)lib/launch-agent-in-new-tab.ts)lib/launch-work-item-direct.ts)lib/onboarding-folder-agent-startup.ts)Intentionally outside this visible route: background/non-visible sessions, AI Vault resume launches, and floating-terminal controls.
Manual Electron validation
Exact branch/head:
brennanb2025/entrypoint-routing-recoveryat81beb4735c5395a7b61f92e69435217f35fd2787.Using Electron + Playwright CDP on that exact worktree, the New tab → Codex flow rendered one structured Codex Chat tab while preserving the pre-existing terminal tab; the backing tab inventory contained an
agent-sessionentry. The app identity was verified asbrennanb2025/entrypoint-routing-recoverybefore testing.Earlier Electron evidence on the same lane lineage also covered toggle-off Codex TUI, structured Codex creation, Claude Chat UI, tab switching/closing, and cancellation-toast suppression; those checks are called out separately from the exact-head proof above.
Automated validation
Review status
Fresh Claude Fable and Codex exact-head reviews: LAND, no proven P0/P1/P2 findings.
CI note
All required package, test-shard, changed-E2E, typecheck, static-analysis, and verify checks passed. The only failing check is the untouched SSH skill-installation harness (
skill-install-workspace-not-found), which is unrelated to the changed files and has reproduced outside this lane.Author: @BrennanKB5