Skip to content

Commit 6532d25

Browse files
authored
fix!: set the minimum supported Coder version to 2.29.0 (#1186)
The extension now requires Coder server 2.29.0 or later and Coder CLI 2.29.0 or later. It checks the server version at login and again when it resolves the CLI binary, and shows an upgrade message for older deployments. All compatibility code for older versions is removed. The server and CLI capabilities are now worked out separately, so a CLI whose version can't be read gets the baseline features instead of borrowing the server version. - Add `MIN_SUPPORTED_CODER_VERSION` and `requireSupportedServerVersion`, and use them in `LoginCoordinator` and `CliManager` - Reject CLIs with a known version below 2.29.0 in `cliFeatureSet`; a CLI with an unknown version gets the baseline features - Remove CLI feature flags that are always on at 2.29.0: `cliLogin`, `proxyLogDirectory`, `wildcardSSH`, `buildReason`, `cliUpdate`, `keyringAuth`, `sshCommand`, `supportBundle` - Remove the `coder vscodessh` ProxyCommand, the REST API workspace update path and the "Incompatible Server" modal from remote setup - Always pass `--use-keyring`, `--log-dir` and `start --reason` - Remove `coder.sharedWorkspacesSupported` and the shared workspaces `onQueryRejected` probe - Show the "Open Settings" keyring hint only when the CLI failed to store the credentials - Remove the `unsupported_cli` and `incompatible_server` telemetry values - Add a Compatibility section to the README Closes #1180
1 parent 6acc293 commit 6532d25

36 files changed

Lines changed: 400 additions & 614 deletions

‎CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414

1515
### Changed
1616

17+
- **Breaking:** the minimum supported Coder server and Coder CLI versions are
18+
both 2.29.0. Compatibility paths for older versions have been removed. The
19+
server minimum is checked at login and during CLI binary resolution, with an
20+
upgrade message for unsupported deployments. Known CLI versions below the
21+
minimum are also rejected; unknown versions use baseline capabilities rather
22+
than the server version. Later features depend on each component's version.
23+
1724
- **Breaking:** the extension no longer follows a redirect to a different
1825
scheme, host or port, and passes `--allow-redirects=false` to Coder CLI 2.38
1926
or later even if `coder.globalFlags` or `CODER_ALLOW_REDIRECTS` allow

‎README.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ The Coder Remote extension connects your editor to
3434
> (`ms-vscode-remote.remote-ssh`, `anysphere.remote-ssh` for Cursor, or
3535
> `codeium.windsurf-remote-openssh` for Devin Desktop).
3636
37+
## Compatibility
38+
39+
| Component | Minimum supported version |
40+
| ------------ | ------------------------- |
41+
| Coder server | 2.29.0 |
42+
| Coder CLI | 2.29.0 |
43+
44+
The server minimum is checked at login and during CLI resolution. Known CLI
45+
versions below the minimum are rejected; unknown versions use baseline
46+
capabilities. Newer features have their own version requirements.
47+
48+
The minimum is version-pinned; changes are announced in the changelog.
49+
3750
## Getting Started
3851

3952
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press

‎docs/ARCHITECTURE.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ deny-listed (`DENIED_DEPLOYMENT_KEYS` in `src/remote/sshConfig.ts`), since the
8181
other two are the user's own. `SetEnv` is written only when the local ssh
8282
supports it, and `--usage-app` only when both the CLI and the deployment
8383
accept custom session app names; otherwise the session reports as `vscode`.
84-
CLIs without wildcard host support get a `coder vscodessh` ProxyCommand
85-
instead.
8684

8785
Which main file gains the include depends on the Remote - SSH extension.
8886
Microsoft's and Cursor's pass `remote.SSH.configFile` to ssh with `-F`, and

‎package.json‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@
7676
"scope": "application"
7777
},
7878
"coder.binarySource": {
79-
"markdownDescription": "Used to download the Coder CLI which is necessary to make SSH connections. The If-None-Match header will be set to the SHA1 of the CLI and can be used for caching. Absolute URLs will be used as-is; otherwise this value will be resolved against the deployment domain. Defaults to downloading from the Coder deployment.",
79+
"markdownDescription": "Used to download the Coder CLI which is necessary to make SSH connections. The If-None-Match header will be set to the SHA1 of the CLI and can be used for caching. Absolute URLs will be used as-is; otherwise this value will be resolved against the deployment domain. Defaults to downloading from the Coder deployment. The supplied CLI must be version 2.29.0 or newer.",
8080
"type": "string",
8181
"default": "",
8282
"scope": "application",
8383
"ignoreSync": true
8484
},
8585
"coder.binaryDestination": {
86-
"markdownDescription": "The path to the Coder CLI binary or the directory containing it. When set to a file path (e.g., `/usr/bin/coder`), the extension checks its version and downloads a replacement if it does not match the server (and downloads are enabled). When set to a directory, the extension looks for the CLI inside it (downloading if enabled). Defaults to the value of `CODER_BINARY_DESTINATION` if not set, otherwise the extension's global storage directory.\n\nSupports `${env:VAR}`, `${userHome}`, and a leading `~`.",
86+
"markdownDescription": "Path to a Coder CLI 2.29.0+ executable or its directory. With `#coder.enableDownloads#` enabled, missing binaries or versions that differ from the server are downloaded automatically. Defaults to `CODER_BINARY_DESTINATION`, then the extension's global storage directory.\n\nSupports `${env:VAR}`, `${userHome}`, and a leading `~`.",
8787
"type": "string",
8888
"default": "",
8989
"scope": "application",
@@ -214,7 +214,7 @@
214214
"ignoreSync": true
215215
},
216216
"coder.useKeyring": {
217-
"markdownDescription": "Store session tokens in the OS keyring (macOS Keychain, Windows Credential Manager) instead of a file. Requires Coder CLI 2.29.0 or later; 2.32.0 or later to sign in with the CLI's existing session. Has no effect on Linux.\n\nThe keyring entry is shared with the `coder` CLI: signing in here also signs in the CLI, and signing out asks whether to sign out the CLI too.",
217+
"markdownDescription": "Store session tokens in the OS keyring (macOS Keychain, Windows Credential Manager) instead of a file. Requires Coder CLI 2.32.0 or later to sign in with the CLI's existing session. Has no effect on Linux.\n\nThe keyring entry is shared with the `coder` CLI: signing in here also signs in the CLI, and signing out asks whether to sign out the CLI too.",
218218
"type": "boolean",
219219
"default": true,
220220
"scope": "application"
@@ -402,15 +402,10 @@
402402
"contents": "Sign in to view and manage Coder tasks.\n[Login](command:coder.login)",
403403
"when": "!coder.authenticated && coder.loaded"
404404
},
405-
{
406-
"view": "sharedWorkspaces",
407-
"contents": "Shared workspaces require Coder 2.27.0 or newer.",
408-
"when": "coder.authenticated && !coder.sharedWorkspacesSupported"
409-
},
410405
{
411406
"view": "sharedWorkspaces",
412407
"contents": "No workspaces have been shared with you.",
413-
"when": "coder.authenticated && coder.sharedWorkspacesSupported"
408+
"when": "coder.authenticated"
414409
}
415410
],
416411
"commands": [

‎src/api/responseValidation.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class InvalidApiResponseError extends Error {
2828
*
2929
* Schemas list only the fields the extension reads and use looseObject so
3030
* unknown fields pass through. Require a field only if every deployment back
31-
* to Coder 0.25 sends it; anything newer must be .optional().
31+
* to Coder 2.29 sends it; anything newer must be .optional().
3232
*
3333
* @throws {InvalidApiResponseError} naming the endpoint when validation fails.
3434
*/

‎src/api/workspace.ts‎

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import type {
1919
WorkspaceBuildParameter,
2020
} from "coder/site/src/api/typesGenerated";
2121

22-
import type { CliFeatureSet, ServerFeatureSet } from "../featureSet";
22+
import type { ServerFeatureSet } from "../featureSet";
2323
import type { UnidirectionalStream } from "../websocket/eventStreamConnection";
2424

2525
import type { CoderApi } from "./coderApi";
@@ -56,23 +56,14 @@ export class LazyStream<T> {
5656
}
5757
}
5858

59-
type BuildApi = Pick<
60-
Api,
61-
| "getTemplate"
62-
| "getWorkspace"
63-
| "postWorkspaceBuild"
64-
| "startWorkspace"
65-
| "stopWorkspace"
66-
| "waitForBuild"
67-
>;
59+
type BuildApi = Pick<Api, "getWorkspace" | "postWorkspaceBuild">;
6860

6961
interface CliContext {
7062
restClient: BuildApi;
7163
auth: CliAuth;
7264
binPath: string;
7365
workspace: Workspace;
7466
write: (data: string) => void;
75-
cliFeatures: CliFeatureSet;
7667
serverFeatures: ServerFeatureSet;
7768
}
7869

@@ -126,20 +117,15 @@ export async function startWorkspace(ctx: CliContext): Promise<Workspace> {
126117
return ctx.workspace;
127118
}
128119

129-
const args = ["start", "--yes"];
130-
if (ctx.cliFeatures.buildReason) {
131-
args.push("--reason", BUILD_REASON);
132-
}
133-
134-
await runCliCommand(ctx, args);
120+
await runCliCommand(ctx, ["start", "--yes", "--reason", BUILD_REASON]);
135121
return ctx.restClient.getWorkspace(ctx.workspace.id);
136122
}
137123

138124
/**
139125
* Update a workspace to the latest template version. Callers must collect
140126
* any newly-required parameters via `collectUpdateParameters` first; this
141-
* function does not prompt. On servers before 2.36, updating takes two
142-
* builds: `coder update`, or the REST API on CLIs before 2.24.
127+
* function does not prompt. On servers before 2.36, `coder update` takes
128+
* two builds.
143129
*/
144130
export async function updateWorkspace(
145131
ctx: CliContext,
@@ -149,10 +135,6 @@ export async function updateWorkspace(
149135
return updateWorkspaceInOneBuild(ctx, parameters);
150136
}
151137

152-
if (!ctx.cliFeatures.cliUpdate) {
153-
return updateWorkspaceViaApi(ctx, parameters);
154-
}
155-
156138
const paramArgs = parameters.flatMap((p) => [
157139
"--parameter",
158140
`${p.name}=${p.value}`,
@@ -195,30 +177,6 @@ async function updateWorkspaceInOneBuild(
195177
return { ...workspace, latest_build: build };
196178
}
197179

198-
async function updateWorkspaceViaApi(
199-
ctx: CliContext,
200-
parameters: WorkspaceBuildParameter[],
201-
): Promise<Workspace> {
202-
if (ctx.workspace.latest_build.status === "running") {
203-
ctx.write("Stopping workspace for update...\r\n");
204-
const stopBuild = await ctx.restClient.stopWorkspace(ctx.workspace.id);
205-
const stoppedJob = await ctx.restClient.waitForBuild(stopBuild);
206-
if (stoppedJob?.status !== "succeeded") {
207-
throw new Error("Workspace update stop build did not succeed");
208-
}
209-
}
210-
211-
ctx.write("Starting workspace with updated template...\r\n");
212-
const template = await ctx.restClient.getTemplate(ctx.workspace.template_id);
213-
await ctx.restClient.startWorkspace(
214-
ctx.workspace.id,
215-
template.active_version_id,
216-
undefined,
217-
parameters,
218-
);
219-
return ctx.restClient.getWorkspace(ctx.workspace.id);
220-
}
221-
222180
/**
223181
* Streams build logs in real-time via a callback.
224182
* Returns the websocket for lifecycle management.

‎src/cli/cliExec.ts‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,13 @@ export function ping(env: CliEnv, workspaceName: string): vscode.Terminal {
169169

170170
/**
171171
* Open a terminal that runs `coder ssh <workspace> -- <command>` with no
172-
* local shell in between. Older CLIs cannot take a command, and falling back
173-
* to typing it into a local shell would let the deployment run local code.
172+
* local shell in between; typing the command into a local shell would let the
173+
* deployment run local code.
174174
*/
175175
export function openAppStatusTerminal(
176176
env: CliEnv & { featureSet: CliFeatureSet },
177177
app: { name?: string; command: string; workspace_name: string },
178178
): void {
179-
if (!env.featureSet.sshCommand) {
180-
throw new Error("Running app commands requires Coder CLI v2.23.0 or later");
181-
}
182179
const workspaceName = validateIdentifier(
183180
app.workspace_name,
184181
"workspace name",

‎src/cli/cliManager.ts‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { HttpStatusCode } from "../api/httpStatusCode";
1313
import { tempFilePath } from "../common/fs";
1414
import { toSafeHost } from "../common/url";
1515
import { errToStr } from "../error/normalize";
16+
import { requireSupportedServerVersion } from "../featureSet";
1617
import {
1718
CliDownloadsDisabledError,
1819
CliFallbackDeclinedError,
@@ -227,12 +228,7 @@ export class CliManager {
227228
// and to log for debugging.
228229
const buildInfo = await restClient.getBuildInfo();
229230
this.output.info("Got server version", buildInfo.version);
230-
const parsedVersion = semver.parse(buildInfo.version);
231-
if (!parsedVersion) {
232-
throw new Error(
233-
`Got invalid version from deployment: ${buildInfo.version}`,
234-
);
235-
}
231+
const parsedVersion = requireSupportedServerVersion(buildInfo.version);
236232

237233
if (resolved.source === "not_found") {
238234
this.output.info("No existing binary found, starting download");

‎src/commands.ts‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,6 @@ type OpenWorkspaceResult =
141141
| { readonly status: "opened"; readonly handoff: "folder" | "empty_window" }
142142
| { readonly status: "cancelled"; readonly stage: "recent_folder_picker" };
143143

144-
class SupportBundleUnsupportedCliError extends Error {
145-
public constructor() {
146-
super(
147-
"Support bundles require Coder CLI v2.10.0 or later. Please update your Coder deployment.",
148-
);
149-
}
150-
}
151-
152144
const UPDATE_AND_RESTART_ACTION = "Update and Restart";
153145

154146
const openDefaults = {
@@ -478,9 +470,6 @@ export class Commands {
478470
logger: this.logger,
479471
}).then(toRemoteLogGlobs);
480472
const env = await this.resolveCliEnv(client);
481-
if (!env.featureSet.supportBundle) {
482-
throw new SupportBundleUnsupportedCliError();
483-
}
484473

485474
// The resolution APIs take no signal, so race to keep cancel honest.
486475
const workspaceFiles = env.featureSet.supportBundleWorkspaceFiles
@@ -526,11 +515,7 @@ export class Commands {
526515
telemetry.abort("progress");
527516
return;
528517
}
529-
telemetry.error(
530-
result.error instanceof SupportBundleUnsupportedCliError
531-
? "unsupported_cli"
532-
: undefined,
533-
);
518+
telemetry.error();
534519
this.logger.error("Support bundle failed", result.error);
535520
vscode.window.showErrorMessage(
536521
escapeNotificationLinks(

‎src/extension.ts‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,6 @@ async function doActivate(
194194
client,
195195
output,
196196
deploymentManager.session,
197-
{
198-
// Older deployments reject this query; show a message instead of an
199-
// empty tree (see `viewsWelcome` in package.json).
200-
onQueryRejected: () =>
201-
contextManager.set("coder.sharedWorkspacesSupported", false),
202-
},
203197
);
204198
ctx.subscriptions.push(sharedWorkspacesProvider);
205199

@@ -222,11 +216,8 @@ async function doActivate(
222216
};
223217
void updateTasksSupported();
224218

225-
// Re-probe support on session change (login, logout, deployment switch);
226-
// the next fetch clears the message again if still unsupported.
227219
ctx.subscriptions.push(
228220
deploymentManager.session.onDidChange(() => {
229-
contextManager.set("coder.sharedWorkspacesSupported", true);
230221
void updateTasksSupported();
231222
}),
232223
);
@@ -372,9 +363,6 @@ async function doActivate(
372363
commands.navigateToWorkspaceSettings.bind(commands),
373364
);
374365
commandManager.register("coder.refreshWorkspaces", () => {
375-
// Re-probe in case the deployment was upgraded; the fetch below clears
376-
// the message again on rejection.
377-
contextManager.set("coder.sharedWorkspacesSupported", true);
378366
void myWorkspacesProvider.fetchAndRefresh();
379367
void sharedWorkspacesProvider.fetchAndRefresh();
380368
void allWorkspacesProvider.fetchAndRefresh();

0 commit comments

Comments
 (0)