Repository navigation
fix(agent.launch): avoid blank shells when launching new workspaces - #28451
Conversation
442560e to
31b07ea
Compare
31b07ea to
dddc3dc
Compare
|
Update, delta review at CI is now green for this exact commit: PR Checks, including the aggregate PR checks passed gate, static analysis/typecheck, five Node shards, wire compatibility, packaging and selected rendered/layout checks. This supersedes the earlier main-side CI blocker. Added test lines440 remain below production479 (plus one registration line). Retained desktop comparison screenshots show Terminal1/Setup/Chat becoming Setup/Chat. The coordinator's later M4Air phone/CLI/desktop-dialog QA reports the extra shell removed; no shared simulator was attached in this round. A phone-created workspace still opening on Setup on desktop belongs to the separate landing-tab work and is outside this PR. Deferred: recovery-shell effect omission in failed-worker receipts and the stale warning after successful terminal-start fallback. Not newly exercised: Windows/Linux/WSL/SSH runtime behavior, old-peer replay, native focus, injected rendered publication/PTY faults and the naturally pending no-setup frame. No new source fix or scope expansion was needed. With Chat UI enabled, a workspace created through Successful chat launches have no incidental primary shell, including the no-setup/no-default case. Setup timing, each configured default command, split anchors and foreground/background selection retain their policy. A failed new-workspace start attempts one usable plain recovery shell and never starts a second agent; main’s failed terminal-start handoff is preserved. Ordinary workspace opens retain their policy, and desktop new-workspace/+tab migration code stays in its separate lane. Status: final head Verified: all 22 local CI is blocked by main-side failures. The one final-head watch stopped on seven static errors when GitHub merged this head with newer main
Earlier CI also exposed two main-side Deferred: failed-worker receipts can omit the usable recovery shell from their effect list; a successful terminal-start fallback can retain its preceding warning. Both updated host and reader are needed for the complete repair; older peers retain their previous behavior. If both chat and recovery-shell spawning fail, the launch releases its intent and returns the original failure. Not verified: rendered phone/automation/worker entrypoints, Windows/Linux/WSL/SSH flows, old-peer replay, native focus, injected rendered publication/PTY failures, and the naturally pending no-setup frame (too short without artificial delay). Failure contracts have source/unit coverage. QA apps were stopped by recorded owned PIDs; evidence and the QA checkout were retained. The following agent screenshots compare rebuilt main Reported setup case, before: Reported setup case, after: No setup or defaults, before: No setup or defaults, after: Ordinary workspace creation remains unchanged, baseline main9c: Ordinary workspace creation on final7db: |
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
…rst-surface-no-blank-shell # Conflicts: # src/main/runtime/session-tabs/session-tabs-change-publication.ts
There was a problem hiding this comment.
🔇 Additional comments: 2
src/main/runtime/workspaces/workspace-host-notifications.ts: 1
198-257: LGTM!src/main/runtime/session-tabs/session-tabs-change-publication.ts: 1
81-97: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.Extract the duplicated launch-attachment logic.
The no-snapshot path and the snapshot path both contain the same lookup and spread. A small local helper would keep the two paths consistent. This is optional.
The behavior is otherwise correct.
readCreatedWorkspaceLaunchreturnsundefinedwhen no launch exists, soinitialSurfaceLaunchis added only when a live launch is present. The spread keeps the existing result shape unchanged.
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b1463a05-b46b-4d68-a90c-827620a37e0c
📒 Files selected for processing: 2
src/main/runtime/session-tabs/session-tabs-change-publication.tssrc/main/runtime/workspaces/workspace-host-notifications.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.






ELI5
With Chat UI enabled, an agent-created workspace could show an unused “Terminal 1” beside Setup and the requested chat. It happened again from the phone: creating a workspace from the phone with Claude and Chat UI on, in a repo with a setup script, opened three tabs: “Terminal 1” (a plain shell nobody asked for), “Setup”, and the Claude chat. Setup provisioning assumed it needed a shell, and foreground opening could independently add another shell before the launch published its chat. The launch now supplies that workspace’s first surface; successful chat launches do not acquire an incidental primary shell. After this change the same phone create opens just Setup and the chat.
What Changed
agent.launchcreate-worktree requests carry the promised chat through the existing workspace/setup provisioning path. The executing launch registers its live intent when workspace metadata is created, before the workspace can open. Tab inventory reads that intent together with the current tabs, so foreground opening waits for the launch’s surface instead of filling the temporary empty workspace with a shell. The intent ends when the surface is published or the launch exits; nothing persists a second workspace-open model.Setup timing, configured terminal commands, split anchors, foreground/background selection, and terminal-agent startup handoff remain intact. If a new workspace’s chat start fails, the launch attempts one plain recovery shell and preserves the original failure; it does not start another agent. Ordinary workspace opens and the non-launch empty-workspace watcher keep their existing policy. Desktop new-workspace/+tab migration code has no change in this PR; its existing lane owns that work. Every caller of
agent.launchgets the same first-surface behavior, including the phone, whose new-workspace create goes throughagent.launchwith a create-worktree target.Why
The launch knows which surface it is creating and how long that work is live. Giving its existing consumers that fact removes the guessing that produced the redundant shell, without a global renderer latch or permanent shell-suppression flag.
Linked Issue
STA-10160; related #27796.
Visual Proof
See the final review status comment for full-window before/after screenshots of the reported setup case, no-setup/no-default case and ordinary creation on final head7db4.
Testing
ORCA_BACKGROUND_LAUNCH=1.Current head
e5868a5eb95(current main merged in once, at the end of review). New: the first-surface flow test now also drives the real runtime through theagent.launchhandler as a paired phone (Claude, Chat UI on, setup script in its own tab) and checks the workspace ends up with exactly one terminal, Setup, plus the chat. It fails on the extra spawn when the launch stops passing the promised chat to workspace creation. The focused launch, inventory, provisioning, startup, worker, renderer-gate and setup-choice tests pass on the merged head.Earlier rounds (head
7db4cd36f58, before the main sync): all 22orca-ci-checksgates and the CI anti-slop lint passed. On M4Air, rebuilt main and PR builds passed 12 agent-create cells per build across setup wait/immediate, default tabs, horizontal/vertical splits and no-setup, plus six post-relaunch background reveals per build. Ordinary non-agent raw CLI QA passed all four foreground/background setup creates: Terminal 1 then Setup, Terminal 1 first and active, zero agents, prior selection kept, one setup run each. That QA predates the main sync; the merge had one conflict, two adjacent import lines inworkspace-creation.ts(both kept); main's other edits to these files merged cleanly in separate hunks. Added lines: tests 440, production 480.AI Disclosure
Review
Four review rounds total. The approved narrower design panel preceded the changed-design fourth round; bounded final integration checks followed. The final changed-design round covered correctness, readiness and performance. Tests added remain below production lines.
Agent skill upstream boundary
Notes
Split setup deliberately retains its terminal anchor; each configured default command still runs once. Before chat publication, a newly selected no-setup workspace can briefly show its existing empty view. Both the updated host and renderer reader are needed for this repair; the optional inventory field is safe for older peers to ignore, and those peers retain their prior behavior.
Deferred: a failed orchestration-worker receipt can omit the recovery-shell effect even though the durable shell is usable and listed, and a successful terminal-start fallback can retain the preceding failure warning. If chat creation and the recovery-shell spawn both fail, no usable shell can be guaranteed; the launch releases its intent and returns the failure.
The phone entry point is covered by the host-side flow test above but was not exercised on a real paired phone. Rendered automation/worker entrypoints, Windows/Linux/WSL/SSH flows, old-peer replay, native focus, and injected rendered publication/PTY failures were not exercised. Failure contracts have source/unit coverage. The naturally pending no-setup frame was too short to capture without artificial delay.
Checklist
agent.launchworkspace first-surface ownership.e5868a5eb95(PR checks passed). The first attempt failed one unrelated browser popup Electron test on a hidden-frame capture timeout; the rerun passed.Kept draft; not merged.