Repository navigation
AI-button and OpenCode-model tabs start their agent in their own terminal - #28210
Conversation
5fd4004 to
2fee7f2
Compare
25f4836 to
67f74d7
Compare
7395063 to
b05ffd5
Compare
efa70eb to
8a80da2
Compare
b05ffd5 to
328c23e
Compare
8a80da2 to
334fe69
Compare
|
Status: ready for review. Head Reviews.
Syncs with main. Two syncs with main, approved by the lane owner, plus one rebase after #28209 merged that dropped #28209's commits (all 7 commits of this PR unchanged in
Size against main: production +180, tests +269. Checks on this head.
Live QA (hidden macOS test windows, real Claude, Codex driver, Orca's own home isolated, real agent configs hash-checked and unchanged).
Not verified.
|
… spawn, with the host's planner and no launch record The window queues the launch on the tab; the pane's reserved spawn plans it with the planner every host launch uses and starts it at the pane's size, with its launch token. Every way the spawn ends finishes the launch, and the window pastes the prompt only once this pane says the agent started. An ordinary spawn reaches its provider without waiting on a plan. An OpenCode tab with a model keeps main's host hop untouched (TEMPORARY, until a local producer of model options exists).
…before the spawn budget runs, so a pane that settles slowly still gets its prompt; stale comments
…without an assertion
…once and Enter once, and nothing when the pane didn't start
…e started, never a split's shell that bound first; the pane's start answer names that PTY
…ss as it binds, so the launch pane's own ready output is seen even when a split bound first and it drained at once
…planner and runs its runtime fact's shell, so its command is quoted for the shell it is typed into, as a host launch is; the tab's inferred shell is not sent as a request
334fe69 to
f493843
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
上游 v1.4.229(stablyai#28210)讓 AI 按鈕的 agent 改在分頁自己的 spawn 裡依主程序規劃啟動, spawn 沿用分頁自己的 cwd。folder workspace 的分頁 cwd 是 folder 根目錄, 於是 commit/push 失敗的 AI Fix agent 跑在 folder 根目錄而不是出錯的 repo。 規劃後若啟動參數帶了 cwd 就以它為準;新增 pty-agent-pane-launch 測試案例。 實機 UI 測試 SC-10 發現,修正後信任提示與 shell 都在該 repo。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QgfW45N7JaoKC3zG1QSrD9
上游 v1.4.229(stablyai#28210)讓 AI 按鈕的 agent 改在分頁自己的 spawn 裡依主程序規劃啟動, spawn 沿用分頁自己的 cwd。folder workspace 的分頁 cwd 是 folder 根目錄, 於是 commit/push 失敗的 AI Fix agent 跑在 folder 根目錄而不是出錯的 repo。 規劃後若啟動參數帶了 cwd 就以它為準;新增 pty-agent-pane-launch 測試案例。 實機 UI 測試 SC-10 發現,修正後信任提示與 shell 都在該 repo。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QgfW45N7JaoKC3zG1QSrD9
上游 v1.4.229(stablyai#28210)讓 AI 按鈕的 agent 改在分頁自己的 spawn 裡依主程序規劃啟動, spawn 沿用分頁自己的 cwd。folder workspace 的分頁 cwd 是 folder 根目錄, 於是 commit/push 失敗的 AI Fix agent 跑在 folder 根目錄而不是出錯的 repo。 規劃後若啟動參數帶了 cwd 就以它為準;新增 pty-agent-pane-launch 測試案例。 實機 UI 測試 SC-10 發現,修正後信任提示與 shell 都在該 repo。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QgfW45N7JaoKC3zG1QSrD9
ELI5
When you click an AI button such as "Fix checks", Orca asks the background service (the "host") to plan the agent's command. Until now the host also started its own terminal for the agent and the window then adopted it. That terminal started at a fixed 40×120 and was resized about 0.4 s later. Now the host only plans the command, and the tab's own terminal starts it at the tab's size, the same way a "+" tab starts its command.
What Changed
The problem. An AI button's tab was one whose terminal the host spawned and the window adopted afterwards, unlike a "+" tab, whose own terminal starts its command. On main the host's terminal started at 40×120 and was resized to the tab about 0.4 s later. In 3 of 8 launches in live QA the shell saw that resize. The agent itself usually started at the right size, because the shell types its command after the resize.
What you'll see differently.
agent_error, as a "+" tab's failed spawn does. Before, it counted none.Temporary:
agent.launchon their own server. Moving them onto the same path needs a capability that remote servers advertise, which doesn't exist yet.Kept from main (the host's runtime rule, #27692): the tab's terminal runs the agent in the same place, and with the same command, as the host planned it on main. AI buttons get the same runtime answer as "+" and the host. For example, in a repo on a
\\wsl$share the agent runs inside WSL with its command written for Linux, as "+" and the host already do, even when that repo is saved as running on the Windows host (as on main); in a repo set to run in WSL it runs in that distro. The planner decides the shell once, and the tab's terminal uses that shell, so the command is always written for the shell it is typed into.Disabled agents are refused exactly as on main. A missing working folder fails as on main rather than starting at the workspace root. Nothing changes for "+" tabs, OpenCode tabs with a model picked, typed-prompt tabs, the phone's own launches, the CLI, or chats.
Mechanism.
Why
Starting the plan in the tab's own terminal, rather than the host spawning a terminal and handing it over, is what starts it at the tab's size and puts AI buttons on the one path "+" already uses; it is also the common pattern for desktop terminals. One planner means the window and the host can't build different commands for the same click. The alternative, keeping the host's terminal and fixing its size separately, keeps a second way to start a tab's agent and a hand-over between them.
Linked Issue
Part of the launch-convergence plan. Based on main. #28209 (AI buttons stop writing a launch record) merged as de9caf1; its temporary changes end with this PR, so this PR should land before the next release cut.
Visual Proof
Live QA on hidden macOS test windows with real Claude; the images are from 8a80da2, before the final runtime change, which the smoke run on this head repeats. The full results are in the status comment.
Testing
I manually tested these changes locally (live QA, see Visual Proof and the status comment)
Automated tests added/updated
One start, at the pane's size. A pane's own launch plans once and spawns the planned command once, at the pane's size, and reports that it started (
pty-agent-pane-launch.test.ts).Runtime. The tab's terminal runs the shell of the plan's runtime, as the host's launch does, and the planner never gets the tab's inferred shell (
pty-agent-pane-launch.test.ts); the planner's own runtime and quoting cases are main's (runtime-agent-terminal-startup.test.ts).Identity and joins. The agent's terminal carries its launch token and agent; two spawns of one pane start one agent; a remount of a pane whose agent survived attaches to it and never plans again (
pty-agent-pane-launch.test.ts,pty-agent-launch-pane-attach.test.ts).Failures. A plan failure starts no shell and the tab says why; a lost provider answer reads "couldn't confirm"; a close while planning starts nothing (
pty-agent-pane-launch.test.ts).OpenCode tabs with a model. Main's own tests pass untouched (
ipc-pty-opencode-model.test.ts).Paste gate. The window pastes only after this tab's spawn says the agent started, never after a refusal, failure or close (
agent-launch-pane-start.test.ts,launch-agent-new-tab-host-route*.test.ts,pty-transport-connect-spawn.test.ts). The tab's spawn answers with the PTY it started the agent in, and the prompt goes only to that PTY: a split made while the agent starts, whose shell binds first, never receives it (launch-agent-new-tab-host-route-readiness.test.ts). Readiness is watched on every split's terminal as it binds, before its startup output drains, so the launch pane's own ready signal is never missed even when a split bound first (launch-agent-new-tab-host-route-readiness.test.ts); a launch has no 8 s spawn deadline, so a pane that starts late still gets its prompt exactly once, and one that fails never does (agent-paste-draft-readiness-budget.test.ts). Other callers keep main's timing.Callers. Every AI-button caller queues the launch on its tab, in its group, with its working directory and source (
agent-launch-caller-*.test.ts,launch-agent-in-new-tab.test.ts).Verified:
tc:node,tc:web, the changed-code quality check, oxlint and the layout-writer check pass; every test file that directly imports a changed module, plus the launch-parity, race and runtime suites (550 files), passes on this head. One local failure is not from this PR:orca-runtime-agent-session-operation"shapes the launch for the route it resolved" fails on plain main on macOS too.Covered or hidden window. Since #28351 (on main), a tab's terminal doesn't wait for its grid to settle while Orca's window is hidden or covered. An AI button clicked just before Orca is covered starts its agent at once, at the tab's size, and the agent answers the prompt while the window is still covered, as on main (live QA in Visual Proof above). Its prompt waits for the tab's terminal to say it started, with no 8 s spawn deadline, so a slow start never loses the prompt (
agent-paste-draft-readiness-budget.test.ts). Not re-measured on Windows since #28351.Known, not fixed here (same on main):
Size
Measured with
git diff --numstat <base> HEAD -- src, TypeScript only; test files count as tests and locale JSON on its own. Against main (after #28209): production +180, tests +269 (the shared launch test harness counts as tests), locale strings 0. Where it goes (comments included):spawn-agent-launch.ts+128: the launch planned inside the reserved spawn, with the shared planner; Qoder resolved once; the launch token; the missing-folder parity.spawn-agent-launch-end.ts+81: finishing the launch on every way the spawn ends (started, failed before or after the provider was asked, closed by the user), with no record.agent-launch-pane-start.ts+30: the paste gate, answered by this tab's own spawn, and ended by a close or the workspace's removal (+9 in the close and purge paths).agent-paste-draft.ts; the answer's type change is one-for-one in the close, purge, verdict and connect paths).AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
\\wsl$repo set to the Windows host.Checklist
N/Awith reason