Files
vscode/cli/tests/agent_tunnel.rs
T
Connor PeetandCopilot d1bf0ed77d cli: route agent tunnels through the full tunnel server (#340136)
* cli: route agent tunnels through the full tunnel server

- Make `agent --tunnel` and `agent host --tunnel` use the normal tunnel server so remote
  sessions also support editor access.
- Remove the agent-only tunnel mode, relay lifecycle, unused sidecar methods, and obsolete
  reuse fields.
- Reject local-only host options when starting a tunnel and document the aliases.
- Route both aliases before logger setup to prevent a duplicate global logger installation.
- Add argument, credential expiry, and subprocess startup regression tests.
- Update AHP dependencies to 1.0.0 and send the remaining token lifetime when it is known.

Fixes https://github.com/microsoft/vscode/issues/340096

(Commit message generated by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* tests: use full tunnels in the remote agent smoke fixture

- Remove the retired agent-only flag from CLI discovery and fixture startup.
- Create and verify both editor control and agent host ports before and after startup.
- Update the smoke test documentation for the full tunnel server.

Validation:
- npm --prefix test/smoke run compile: passed.
- npm run eslint -- test/smoke/src/areas/agentsWindow/remoteDevContainerFixtures.ts: passed.
- The compiled fixture capability probe accepts the current CLI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-06 20:59:44 +00:00

54 lines
1.8 KiB
Rust

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
use std::{process::Stdio, time::Duration};
use cli::state::LauncherPaths;
use tokio::{
io::{AsyncBufReadExt, BufReader},
process::Command,
};
#[tokio::test]
async fn agent_tunnel_aliases_start_without_logger_panic() {
for command in [vec!["agent"], vec!["agent", "host"]] {
let dir = tempfile::tempdir().unwrap();
let paths = LauncherPaths::new_without_replacements(dir.path().to_path_buf());
// An unopenable lockfile stops startup before authentication or external network access.
std::fs::create_dir(paths.tunnel_lockfile()).unwrap();
let mut child = Command::new(env!("CARGO_BIN_EXE_code"))
.arg("--cli-data-dir")
.arg(dir.path())
.arg("--verbose")
.args(&command)
.args(["--tunnel", "--accept-server-license-terms"])
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.kill_on_drop(true)
.spawn()
.unwrap();
let mut stdout = BufReader::new(child.stdout.take().unwrap()).lines();
let started = tokio::time::timeout(Duration::from_secs(30), async {
while let Some(line) = stdout.next_line().await.unwrap() {
if line.contains("error access singleton, retrying:") {
return true;
}
}
false
})
.await;
child.kill().await.unwrap();
let output = child.wait_with_output().await.unwrap();
assert!(
matches!(started, Ok(true)),
"{command:?} --tunnel did not reach tunnel startup: {}",
String::from_utf8_lossy(&output.stderr)
);
}
}