Skip to content

launch: build copilot in compile; wait for CDP in launch.sh#318272

Merged
roblourens merged 2 commits into
mainfrom
agents/launch-i-d-like-you-to-run-a-3406c6e0
May 26, 2026
Merged

launch: build copilot in compile; wait for CDP in launch.sh#318272
roblourens merged 2 commits into
mainfrom
agents/launch-i-d-like-you-to-run-a-3406c6e0

Conversation

@roblourens
Copy link
Copy Markdown
Member

Two related improvements to the agent dev-loop workflow (the launch skill used by Copilot CLI / agent host to drive a Code OSS dev build).

npm run compile now also builds the Copilot extension

The compile script used to run only gulp compile, which builds the client, built-in extensions, and extension but not the Copilot extension in extensions/copilot/. That extension has its own esbuild script and was only included in npm run watch. Result: a one-shot npm run compile left the Copilot extension stale, and there was no documented one-line equivalent of npm run watch.media

Now compile runs compile-client (the previous compile) and a new compile-copilot in parallel via npm-run-all2 -lp, mirroring the structure of watch.

launch.sh blocks until Code OSS is actually ready

The launcher used to & code.sh and return within ~1s. But code.sh first runs preLaunch.ts (electron download, compile-if-missing, built-in extensions), and Electron itself takes several more seconds to bootstrap and open the CDP port. That meant:nohup

  • Agents driving the workbench via @playwright/cli had to implement a retry-attach loop.
  • If code.sh died early (bad flag, broken build, etc.), the failure was the launcher returned a JSON blob with PID/ports that referred to a dead process.silent
  • An early-killed Electron could die mid-bootstrap from SIGHUP without a clean error path.

The new flow:

  1. Runs preLaunch.ts in the foreground so any error surfaces synchronously with a log tail and a non-zero exit code.
  2. Launches code.sh with VSCODE_SKIP_PRELAUNCH=1 (skipping the duplicate work) and detaches with & disown.nohup
  3. Polls http://127.0.0.1:$CDP/json/version for up to 90s before printing the JSON. If code.sh exits or CDP never opens, prints the log tail and exits non-zero.

End-to-end timing: launch.sh now returns in ~10s with CDP already open, so npx @playwright/cli attach works immediately with no retry loop.

SKILL.md updated to drop the retry loop and document the new error-surfacing behavior.

Notes for reviewers

  • Scope is limited to .agents/skills/launch/ and package.json. No production source changes.
  • compile-client / compile-copilot are new internal npm script names; nothing in CI/build calls these by those names today, but if any other process invokes npm run compile it will pick up the parallel build automatically.

(Written by Copilot)

Two related improvements to the agent dev-loop workflow:

- npm run compile now builds the Copilot extension in parallel with the
  rest of the client, mirroring the structure of npm run watch. Previously
  only the watch path included extensions/copilot, so a one-shot build
  left the Copilot extension stale.

- .agents/skills/launch/scripts/launch.sh now runs preLaunch.ts in the
  foreground (surfacing any failure synchronously with a log tail), then
  launches Code OSS with VSCODE_SKIP_PRELAUNCH=1 and blocks until the
  renderer's CDP endpoint responds (90s timeout) before printing the JSON.
  Previously the script returned in ~1s while Electron was still mid-
  bootstrap, which made it racy for agents driving the workbench via
  @playwright/cli and could let an early-dying child go unnoticed.

SKILL.md updated to drop the now-unnecessary attach retry loop and to
document the new error-surfacing behavior.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 26, 2026 01:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the agent dev-loop workflow by ensuring a one-shot npm run compile also builds the Copilot extension, and by making the launch.sh skill wait until Code OSS is actually ready for CDP-based automation before returning.

Changes:

  • Update root compile to run client compilation and Copilot extension compilation in parallel.
  • Run preLaunch.ts in the foreground in launch.sh, then start code.sh detached and poll the CDP endpoint before printing launch JSON.
  • Update the launch skill documentation to reflect the new compile behavior and remove the Playwright retry-attach loop.
Show a summary per file
File Description
package.json Makes npm run compile also build extensions/copilot via a new parallel script setup.
.agents/skills/launch/SKILL.md Documents the new one-shot compile behavior and the “CDP-ready” launch semantics (no retry loop).
.agents/skills/launch/scripts/launch.sh Runs prelaunch synchronously, launches Code OSS detached, and blocks until the CDP endpoint responds (or fails with log tail).

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 1

Comment thread .agents/skills/launch/SKILL.md Outdated
Per code review, `launch.sh` does not invoke `lsof` or `jq` itself
those are used only by the example caller snippets. Reword the
prerequisites bullet so it reflects what the script actually requires
(`rsync`, `curl`, `nohup`, Node) and notes `jq` / `lsof` as optional
for the caller-side examples.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roblourens roblourens marked this pull request as ready for review May 26, 2026 01:55
@roblourens roblourens enabled auto-merge (squash) May 26, 2026 01:55
@roblourens roblourens merged commit dfbbbdf into main May 26, 2026
25 checks passed
@roblourens roblourens deleted the agents/launch-i-d-like-you-to-run-a-3406c6e0 branch May 26, 2026 02:06
@vs-code-engineering vs-code-engineering Bot added this to the 1.122.0 milestone May 26, 2026
anthonykim1 added a commit that referenced this pull request May 26, 2026
Squashed cherry-pick of 10 commits from main that are included in the
Insiders build (183159e) people are verifying:

- agentHost: show fetched URL for web_fetch (#318240)
- Fix SSH remote agent host passphrase auth (#318244)
- agentHost: add setting to disable worktreeCreated task auto-dispatch (#318243)
- Agent host: clearer worktree git timeout errors and 60s budget (#318242)
- Normalize LF to CRLF in agent host terminal tool output (#318257)
- sessions: restore X-button removal of SSH remote agent host entries (#318262)
- chat: fix duplicate command registration for agent-host-copilotcli (#318273)
- launch: build copilot in compile; wait for CDP in launch.sh (#318272)
- Preserve unread state across remote host disconnect (#318267)
- Add more codenotify for terminal (#318285)
dileepyavan pushed a commit that referenced this pull request May 27, 2026
Squashed cherry-pick of 10 commits from main that are included in the
Insiders build (183159e) people are verifying:

- agentHost: show fetched URL for web_fetch (#318240)
- Fix SSH remote agent host passphrase auth (#318244)
- agentHost: add setting to disable worktreeCreated task auto-dispatch (#318243)
- Agent host: clearer worktree git timeout errors and 60s budget (#318242)
- Normalize LF to CRLF in agent host terminal tool output (#318257)
- sessions: restore X-button removal of SSH remote agent host entries (#318262)
- chat: fix duplicate command registration for agent-host-copilotcli (#318273)
- launch: build copilot in compile; wait for CDP in launch.sh (#318272)
- Preserve unread state across remote host disconnect (#318267)
- Add more codenotify for terminal (#318285)
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.

3 participants