launch: simple file dialog, monaco-paste helper, parallel session pattern#318488
Merged
roblourens merged 2 commits intoMay 27, 2026
Conversation
…tern
Surfaced while running a bug bash over the Agents window terminal tool —
the launch skill needed three improvements before subagents could drive
multiple Code OSS instances cleanly.
1. launch.sh now forces `files.simpleDialog.enable: true` in the launched
profile. Native macOS file dialogs cannot be driven via @playwright/cli
over CDP/SSH; the simple (quick-input style) dialog can. Without this,
the new-session workspace picker's `Select...` button is a dead end
for automation on a fresh slim-copied UDD.
2. New scripts/monaco-paste.sh helper inserts text into the focused
Code OSS chat-input Monaco editor by dispatching a synthetic
ClipboardEvent('paste') with a DataTransfer payload. Avoids pbcopy's
system-wide NSPasteboard collision (which fights any other process
touching the clipboard), supports unicode/emoji/backticks/quotes/
newlines, and waits two requestAnimationFrames before read-back
because Monaco updates its view-line DOM asynchronously after paste.
Honors `--session NAME` arg or `$PW_SESSION` env. Verified across
20+ pastes including all the awkward characters and parallel
multi-instance runs.
3. SKILL.md updated to:
- document the new simpleDialog default
- recommend monaco-paste.sh as the primary typing path; keeps per-key
`press` and `pbcopy` as fallbacks with the pasteboard-collision
caveat called out explicitly
- make `-s=$PW_SESSION` the default convention on every
@playwright/cli example so the skill's per-instance isolation
extends to the Playwright-driving layer. Without `-s=`, parallel
shells share the implicit "default" session daemon and the most-
recently-attached CDP wins for every subsequent command
- add a "Parallel multi-instance pattern" subsection showing the
full attach/paste/cleanup loop with per-session names
- note that PLAYWRIGHT_CLI_SESSION env var works for `open`-style
workflows but interacts poorly with `attach --cdp=` due to a
playwright-core bug (cli-client/session.ts:142-143) — explicit
`-s=` works in all modes
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the .agents/skills/launch skill to make multi-instance Code OSS automation more reliable, particularly for subagents driving UI via @playwright/cli in parallel.
Changes:
- Force
files.simpleDialog.enable: truein the launched throwaway profile to ensure file/folder picking is automation-friendly. - Add
scripts/monaco-paste.shto paste into Monaco-based chat input via a syntheticClipboardEvent('paste'), avoiding system clipboard collisions. - Update
SKILL.mdwith a consistent-s=$PW_SESSIONpattern and documentation for the new paste helper and parallel workflows.
Show a summary per file
| File | Description |
|---|---|
.agents/skills/launch/SKILL.md |
Documents the simpleDialog override, introduces the -s=$PW_SESSION convention, and adds parallel multi-instance guidance. |
.agents/skills/launch/scripts/monaco-paste.sh |
New helper script to paste text into Monaco via CDP/Playwright CLI without using the system clipboard. |
.agents/skills/launch/scripts/launch.sh |
Applies a per-launch setting override to force the simple file dialog in the cloned profile. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 5
Five inline comments from the Copilot reviewer on #318488, all addressed: - launch.sh: replace the regex-strip-then-JSON.parse settings overlay with a data-preserving text-based insert. The previous version could silently drop user settings on parse failure and would incorrectly strip `//` inside string values (e.g. URLs). The new version: * detects when the key is already present (any value) and updates its value via a targeted regex on the value slot only; * otherwise inserts the key before the last `}`, preserving all comments and formatting; * fails loudly (non-zero exit) if the file is structurally bad rather than silently overwriting with `{}`; * is idempotent (T6: byte-identical when key is already `true`). Verified across 7 scenarios incl. JSONC comments + URLs containing `//` + malformed input. - monaco-paste.sh: detect platform and pick `Meta+a` (macOS) or `Control+a` (Linux/Windows) for the clear-before-paste select-all, so the default (non-`--append`) path actually clears the editor on non-mac. - monaco-paste.sh: validate node + jq up-front in addition to npx, so missing tools fail with a clear actionable message and exit 2 rather than crashing later. - monaco-paste.sh: header docs now correctly list the three exit codes (0 success, 1 paste/eval failure, 2 argument/tooling error) and the required tools on PATH. - monaco-paste.sh: fix `set -u` unbound-variable error when no PW_SESSION/--session is set — `"${PW_ARGS[@]}"` on an empty array trips set -u, so use the `${PW_ARGS[@]+"${PW_ARGS[@]}"}` idiom at every call site. - SKILL.md: fix "Macros-Mach-ports" → "macOS Mach-ports" typo. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
anthonykim1
approved these changes
May 27, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Surfaced while running a bug bash over the Agents window terminal tool — the
launchskill needed three improvements before subagents could drive multiple Code OSS instances cleanly.1.
launch.sh: forcefiles.simpleDialog.enable: truein the launched profileNative macOS file dialogs cannot be driven via
@playwright/cliover CDP / SSH; the simple (quick-input style) dialog can. Without this, the new-session workspace picker'sSelect...button is a dead end for automation on a fresh slim-copied UDD.2. New
scripts/monaco-paste.shhelperInserts text into the focused Code OSS chat-input Monaco editor by dispatching a synthetic
ClipboardEvent('paste')with aDataTransferpayload. Why a helper instead of just docs:pbcopy's system-wideNSPasteboardcollision — any other process touching the clipboard during the paste window can stomp the prompt. The synthetic event stays inside the CDP connection.\"and\`.requestAnimationFrames before read-back — Monaco updates its view-line DOM asynchronously after a paste event; a same-tick read returns stale state.startsWithchecks.--session NAMEor$PW_SESSIONso it stays in the same@playwright/clisession as the rest of the agent's calls.Tested across 20+ pastes with all the awkward characters and parallel multi-instance runs (
-s=sessA/-s=sessB) — no cross-contamination.3.
SKILL.mdupdatessimpleDialogdefault and themonaco-paste.shhelper.-s=$PW_SESSIONthe default convention on every@playwright/cliexample. The skill is built around per-instance isolation (UDD, ports, shared-data-dir), and this pattern extends that isolation to the Playwright-driving layer. Without-s=, parallel shells share the implicit"default"session daemon and the most-recently-attached CDP wins for every subsequent command from either shell.PLAYWRIGHT_CLI_SESSIONenv var works foropen-style workflows but interacts poorly withattach --cdp=due to an upstream behavior inplaywright-core/cli-client/session.ts:142-143(the env var is pushed as--endpoint=…even when--cdp=…is already set, and the daemon ends up trying to connect to the env var value as a socket path). Explicit-s=is safe in all modes.Test plan
-s=sessA/-s=sessB; pastes landed in their respective windows with no cross-contamination.Not in this PR
@playwright/cliattach --cdp=+PLAYWRIGHT_CLI_SESSIONinteraction. Worth a separate issue against microsoft/playwright; the-s=flag is a clean workaround for now.🤖 Generated with Copilot CLI
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com