mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-26 11:26:56 +01:00
* tunnels: host the agent host with the code-tunnel CLI Replaces the TypeScript dev-tunnels SDK hosting path with the `code-tunnel` binary, and gives the shared process a single owner for the tunnel process. The editor no longer creates, adopts, or reconciles dev tunnels itself: the CLI owns naming, reuse, and lifetime, and the editor supplies only intent. - Adds `--agent-host-only` to `code tunnel`, which serves the agent-host port without the control port, so remote session sharing does not also grant full remote editor access. - Adds `--delegate-to-editor`, which pins the selection gateway to the live editor agent host and stops it from starting a dedicated agent host. A dedicated host behind an editor-bound tunnel outlives the tunnel and cannot be reached. Clients that do not send `delegatedInstanceId`, which includes older editors and every background reconnect, get the bound host instead of an error. - Adds `--user-data-dir` to `code tunnel`. The gateway read the platform default registry, so it could not see the editor agent host in portable, custom, or development installations. - Adds a machine-readable status stream, enabled with `VSCODE_CLI_MACHINE_STATUS`, and removes the matching of human-readable output. The editor matched a string the CLI no longer prints, so Remote Tunnel Access never became connected. - Makes registry liveness require a reachable endpoint, not only a running process ID. Operating systems reuse process IDs, so a dead entry could look alive and be selected in preference to the live one. - Adds `TunnelProcessCoordinator`, which owns the single tunnel process, the tunnel name, and the CLI login. Both services previously started their own process with the same name, which made the CLI fall back to a random name, and both logged in to the same credential store. - Stops the editor from connecting to the tunnel that it hosts. - Raises the Windows stack size for development builds only. The default 1MB main thread stack overflows before `code tunnel` finishes starting. Fixes https://github.com/microsoft/vscode/issues/319297 Fixes https://github.com/microsoft/vscode/issues/329985 (Commit message generated by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * cli: fix clippy lints and a registry read race on Windows CI runs `cargo clippy -- -D warnings` without `--all-targets`, so lib-only warnings fail the build. Fix the four it reported: - use `?` instead of a match in `get_tunnel_web_url` - drop a redundant rebinding of `delegate_to_editor` - group `serve()`'s agent-host parameters into `AgentHostServeOptions` - box both `GatewayTargetWs` variants (boxing only the larger one just inverts the imbalance) Separately, `read_registry` failed intermittently on Windows with `PermissionDenied`. A file removed by a concurrent prune stays listed in the directory until its last handle closes, and opening it in that window fails with `PermissionDenied` rather than the `NotFound` the code already handled. The error propagated out of `read_entry_file` and aborted the whole read, so one unreadable entry hid every other endpoint. Per-entry read and directory-enumeration failures are now logged and skipped instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * tunnels: address review feedback on CLI-hosted tunnels Four fixes from PR review: - Agent host sharing hard-rejected every non-GitHub request, but `remote.tunnels.access.enableMicrosoftAuth` still exposes Microsoft accounts and the renderer prefers them when enabled. Carry `authProvider` through to `tunnel user login` instead of hard-coding GitHub. - The pending service uninstall lived in one queued generation, so a concurrent sharing update could preempt the reconcile that owed it and leave the tunnel service installed. Persist it on the coordinator until an uninstall succeeds. - `getTunnelName()` is also called while access is inactive, to compare the name this machine would use against a previously used one. Returning the running tunnel's name yielded undefined and permanently skipped the remote-extension recommendation. Expose the coordinator's intended name. - Machine-status events were written straight to the emitting process's stdout, so when the editor attached to an existing tunnel the singleton server's token errors never reached it and token expiry was never surfaced. Events are now always generated, relayed to attached clients over a new singleton notification, and printed only where a process-global stdout toggle is set. Also converts a runtime protocol-version assertion added by this branch into a const assertion, which `clippy --all-targets` rejects as an assertion on a constant. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>