Repository navigation
fix: make SSH connection hints consistent across CLI, dashboard and docs - #31188
Conversation
459e451 to
9c39f97
Compare
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here. |
9c39f97 to
7b29057
Compare
Documentation CheckUpdates Needed
Automated review via Coder Agents |
7b29057 to
6380999
Compare
coder ssh commands suggestions for multi-agent workspaces6380999 to
c44d38b
Compare
nickvigilante
left a comment
There was a problem hiding this comment.
Thanks for pulling these hints together.
The coder ssh owner logic, the Coder Connect hostnames in the docs, and the config-ssh hint all line up with what #31192 writes and what tailnet/controllers.go serves.
Nothing blocking in the code; the inline comments are test gaps and small cleanups.
CI: Flake Check is failing on a memory guard, not a test bug.
Because TestSSH/SSHHost changed, it reruns all of TestSSH 35 times with 16 parallel tests and hits memory guard: test process uses 6305 MiB, over the 6144 MiB limit.
The "agent cannot authenticate" errors in the log are teardown noise after the panic.
Open question, not from this PR: with --ssh-host-prefix, the multi-agent hint is ssh <prefix><agent>.<ws>.<owner>, which doesn't match the <prefix><owner>--<ws>.<agent> entries the VS Code and JetBrains plugins write.
Possibly worth a follow-up.
I ran go test ./cli/ -run 'Test_agentSSHSuggestion|Test_suggestWithOwner|TestShow' on c44d38b and it passed.
Note
This review was generated by Coder Agents on behalf of @nickvigilante.
nickvigilante
left a comment
There was a problem hiding this comment.
Documentation Check
Reviewed the SSH hostname and connection-hint changes across the CLI, dashboard, and the four edited docs pages. Every claim checked out against the code: the multi-agent agent.workspace.owner.coder form matches what coder config-ssh generates (cli/configssh.go:564), what coder ssh suggests (cli/ssh.go:951), what the dashboard Connect via SSH button shows (site/src/modules/resources/SSHButton/SSHButton.tsx:347), and what Coder Connect DNS serves (tailnet/controllers.go:1012). The default suffix coder is confirmed in codersdk/deployment.go:1974 and the reference page. I found nothing that needs to change.
Generated by Coder Agents on behalf of @nickvigilante, using the proposed doc-check skill from #31193 on Solstice-1 Local. Reply in a thread if a finding is wrong.
e84c93e to
8e2986f
Compare
c44d38b to
e0e1d3d
Compare
e0e1d3d to
330b55d
Compare
|
Addressed the Flake Check workload in 330b55d. The original
|
|
Current CI and Flake Check passed at 330b55d. GitHub still displays two failed placeholder checks from the cancelled, superseded run 40696459225; the latest CI run 40696459404 and its required aggregator passed.
|
nickvigilante
left a comment
There was a problem hiding this comment.
Docs LGTM with two nits
that doesn't sound correct. shouldn't it just be edit: TIL that's the multi-agent syntax. so I guess the extra coder in this context is to represent the agent name? |
f0af2a0 to
e35db89
Compare
a875a56 to
d96b291
Compare
|
Yes. In Updated the description and before/after example to use
|
eb05f53 to
1305206
Compare
|
Addressed the three P2 findings from the native Claude Code and Codex reviews:
Regression controls fail with the old behavior and pass with the fixes. Full SSH/config/show/create race tests, strict lint, 25 frontend copy tests, 53 stories, browser checks, and docs self-review pass. The actual ten-test flake selection also passes 35 repeats at parallelism 16 with the unchanged 6,144 MiB guard. The docs explain the bare-entry fallback when compatible start history is unavailable. The P3 legacy-name compatibility finding remains outside this change. Both PRs are rebased onto main at 4790b0e. Core CI, required checks and Flake Check passed on both exact heads on the first attempt. The remote docs-analysis checks remain running; local docs self-review and deterministic checks passed.
|
nickvigilante
left a comment
There was a problem hiding this comment.
Docs LGTM. The only thing I just want to verify is that if there are no agents, it's <workspace_name>.coder, but if there are agents, it's <agent_name>.<workspace_name>.<owner>.coder, so we add the owner here.
|
Yup, this is how it works. We are not changing the behavior, just making it more consistent. Also |
841023f to
bded5be
Compare
1305206 to
2c5dbed
Compare
|
Added the same agent-selection guidance to Try running:
$ coder ping dogfood.coder
$ coder ping dogfood.devThe suffix here selects the agent, not an SSH hostname suffix. Owner-qualified and UUID inputs retain the owner. JSON-mode errors leave stdout empty; ping still does not autostart stopped workspaces. The focused regression failed against the old behavior and passes with the fix. Original and focused ping race tests, strict Go lint, docs checks, and the actual seven-test flake selection at 35 repeats/parallelism 16 passed. The original network-heavy ping suite remains unchanged. Both PRs were refreshed onto main at 8efd1fc. Core CI, required checks and Flake Check passed on both exact heads on the first attempt. Remote docs-analysis checks remain running; local author self-review and deterministic docs checks passed.
|
bded5be to
f6c4af3
Compare
2c5dbed to
0fc4b36
Compare
`coder config-ssh --no-wildcard` writes one `Host` entry per workspace and none per agent. OpenSSH only applies exact `Host` matches, so with `--no-wildcard` (and without Coder Desktop): - `ssh <agent>.<workspace>.<owner>.coder`, the hostname the dashboard's **Connect via SSH** button shows and Coder Connect serves, doesn't resolve. - Agents in multi-agent workspaces can't be reached with plain `ssh`; `ssh <workspace>.coder` hits "multiple agents found". Before wildcard hosts (#14986), `config-ssh` wrote an entry per agent. `--no-wildcard` (#26753) brought back per-workspace entries only. ## Change With `--no-wildcard`, also write an `<agent>.<workspace>.<owner>` entry for each agent, using the same prefix/suffix as workspace entries: ``` Host dogfood.coder # unchanged Host coder.dogfood.matifali.coder # new Host dev.dogfood.matifali.coder # new ``` `coder ssh --stdio` already parses `agent.workspace.owner`, so no ProxyCommand changes are needed. - **Non-breaking**: existing `<workspace>` entries are unchanged; agent entries are added after them. Without `--no-wildcard` the config is unchanged. - **Workspaces without agents on their latest build** (stopped, or a start that is pending or failed): known agents come from that workspace’s most recent successful start using the same template version, not template-import defaults. Lookups are cached per workspace and bounded to eight concurrent requests. Missing or incompatible history leaves only the workspace entry; lookup failures also produce a warning. - **Devcontainers**: while a workspace runs, its sub-agents get entries too. - **Validation**: workspace and owner names retain `codersdk.NameValid` checks. Agent components permit safe ASCII letters, digits, underscores and hyphens, preserving Terraform-precreated names such as `dev_box` while rejecting SSH syntax, leading options and doubled-hyphen delimiters. Workspace entries are written as before, including legacy names (related: SEC-378). The flag description, generated CLI reference/help, and workspace access and Gateway tips describe known agents. The guide explains when stopped workspaces have only a workspace entry and how to populate their agent entries. ## Verification `TestConfigSSH_NoWildcard` verifies two stopped workspaces sharing a template version but having different actual agents, import defaults that differ from both, a precreated `dev_box` agent, and injection rejection. History tests cover pagination, failed/newer builds, version changes and request failures. Regression controls failed before the fixes and passed afterward. Race tests, strict Go lint and docs checks pass on the refreshed stack. <details> <summary>Validation commands</summary> Latest rebase preserves the implementation and carries the docs edits to main’s renamed `docs/workspaces/` paths. The SSHButton documentation links and preview URL use the new routes. Revalidated the full SSH/ping/config CLI race suite, strict lint, 25 frontend tests, 53 stories, and docs/manifest/redirect checks. The local shell’s Oh My Zsh update prompt interrupted the first race run; the unchanged suite passed with `DISABLE_AUTO_UPDATE=true` scoped to the test process. Review decision: use workspace-specific build history because template imports cannot represent chosen workspace parameters. Preserve the last-start template-version boundary rather than inventing agents when no compatible history exists. Both stack branches are rebased onto `main` at `63b5c4d64a`. ```sh go test -race -tags=testsmallbatch ./cli -run 'TestConfigSSH|Test_noWildcardHostNames|Test_previousStartResources|TestCommandHelp' -count=1 -parallel=4 GOMEMLIMIT=6GiB make lint/go/new-code GO_LINT_CONCURRENCY=4 ``` Docs validation also passed emdash, HTML-table and manifest checks, targeted markdownlint, table formatting and Vale. </details> Fixes [CLI-68](https://linear.app/codercom/issue/CLI-68/config-ssh-no-wildcard-does-not-write-host-entries-for-workspace). #31188 is stacked on this PR. Preview: https://coder.com/docs/@fix%2Fconfig-ssh-no-wildcard-agents/workspaces/workspace-access > 🤖 This PR was created with the help of Coder Agents, and has been reviewed by my human. 🧑💻
…paces When coder ssh is run directly against a workspace with multiple agents, the error suggested plain OpenSSH hostnames like `ssh coder.dogfood.alice`. Without a config-ssh host entry or Coder Connect, those hostnames never resolve. A hostname prefix or suffix is only set when coder ssh runs as the config-ssh ProxyCommand, so keep the ssh suggestions for that case and suggest `coder ssh <workspace>.<agent>` otherwise. The owner is included only when the user typed one, e.g. `coder ssh bob/dogfood`.
- coder show and coder create keep the owner in the suggested `coder ssh` command when one was given, so it resolves for workspaces owned by someone else. - coder config-ssh names an agent in its example when the workspace has more than one, since `ssh <workspace>.coder` is ambiguous there. - The dashboard's Connect via SSH popover no longer renders `.undefined` when the deployment has no hostname suffix; it falls back to `coder ssh`. - Docs show the hostname config-ssh actually prints (`<workspace>.coder`, not `coder.<workspace>`) and the agent hostname for multi-agent workspaces.
- Keep the owner in suggested commands whenever the workspace was not identified by its bare name, so `coder show <id>` and `coder ssh <id>` suggest commands that resolve for someone else's workspace. - Name the agent in the config-ssh hint for stopped multi-agent workspaces too, reading agents from the template version, and build the hint in one place. - Show a spinner instead of the fallback command while the SSH popover loads the deployment SSH config, and build the command once. - Use `<workspace>.coder` hosts in the Gateway and networking docs. - Cover the host formats used by the IDE plugins, config-ssh and the dashboard in TestSSH/SSHHost.
Keep the original TestSSH scenarios unchanged and retain the three added agent-qualified hostname round trips in a focused test with one shared fixture. Changed-test stress can exercise this coverage without repeating the unrelated SSH suite, which independently exceeds the memory guard on the base branch.
0fc4b36 to
dc73352
Compare
|
Rebased directly onto main at fb6d287 after #31192 merged. The old parent commits are dropped; all eleven remaining patches and the complete effective worktree are unchanged. Pushed as dc73352. Full SSH/ping/config race tests, strict Go lint, 25 frontend tests, 53 stories, and docs/manifest/redirect validation passed. Documentation edits and preview links now use the renamed workspaces paths. The local shell-update prompt that interrupted the first race run was disabled only for the test process; no repository code or shell configuration was changed. Fresh CI is running on the new head. Approvals are preserved. I will verify mergeability after the checks finish.
|
SSH hints across the CLI, dashboard and docs used different, sometimes broken, workspace names. This makes them consistent with minimal, non-breaking changes and no new syntax:
sshhostnames:<agent>.<workspace>.<owner>.<suffix>(or<workspace>.<suffix>for single-agent workspaces). Works withconfig-ssh(with or without--no-wildcard) and Coder Connect.coderCLI arguments:[<owner>/]<workspace>[.<agent>], with the owner unless the workspace was given by its bare name.Built on #31192, which is now merged into
main.Changes
coder pingmulti-agent error: now suggestscoder ping <workspace>.<agent>instead of listing agents without a runnable command. Owner-qualified and UUID inputs retain<owner>/<workspace>. JSON-mode errors leave stdout empty, and ping still does not autostart stopped workspaces.coder sshmulti-agent error: when run directly (no--ssh-host-prefix/--hostname-suffix), it suggestedssh coder.dogfood.matifali, which never resolves without a matching SSH config entry or Coder Connect. For an agent nameddev, it now suggestscoder ssh dogfood.dev, orcoder ssh bob/dogfood.devif the workspace was given asowner/nameor by ID. Here.devselects the agent; it is not an SSH hostname suffix. The ProxyCommand path used byconfig-sshand the IDE plugins still suggests the full hostname.coder show/coder create: the access column dropped the owner, socoder show bob/dogfoodorcoder show <id>suggestedcoder ssh dogfood.dev. It now keeps the owner unless the workspace was given by its bare name.coder config-ssh: the examplessh <workspace>.coderis ambiguous for multi-agent workspaces. It now names an agent,ssh <agent>.<workspace>.<owner>.coder, reading a stopped workspace’s known agents from its latest successful start using the same template version. With--no-wildcard, the hint reuses the workspace snapshot and resources used to write the Host entries....<owner>.undefinedwhen the deployment has no hostname suffix. It now falls back tocoder ssh <owner>/<workspace>for single-agent workspaces, orcoder ssh <owner>/<workspace>.<agent>otherwise. With a hostname suffix, owned single-agent workspaces showssh <workspace>.<suffix>unless that hostname collides with the deployment’s legacy prefix block. Prefix collisions, shared workspaces and multi-agent workspaces retain the full agent/workspace/owner hostname. The count includes agents across all resources and devcontainers. Commands remain undefined while the SSH config loads, with a spinner instead of a premature fallback. If the initial load fails, it displays the error while keeping the CLI command available.config-sshprintsssh coder.<workspace>; it printsssh <workspace>.coder. Added the multi-agent hostname, noted it in the Desktop docs, and updated the Gateway host and the networking page to<workspace>.coder.Before / after
Compatibility
Hostname parsing (
findWorkspaceAndAgentByHostname,normalizeWorkspaceInput) is unchanged, so every hostname that resolves today still does. The VS Code, JetBrains Gateway and Toolbox plugins write their ownHostentries and runcoder ssh --stdio --ssh-host-prefix <prefix>, so they don't reach the changed hints.TestSSH_AgentHostnamesconnects with their<prefix>--<owner>--<workspace>.<agent>form, and with the<agent>.<workspace>.<owner>forms used byconfig-sshand the dashboard.Verification
CLI/resource race tests pass, including the complete original
TestSSHsuite and the new agent-hostname round trips.TestConfigSSH_Examplechecks running two-agent and stopped one-/two-agent workspaces whose import defaults differ, with and without--no-wildcard. It verifies the hint has a matching generated Host entry and reuses workspace history once per stopped workspace.TestShowcovers bare names, owner-qualified names and UUIDs;TestCreate/CreateForOtherUserchecks the owner-qualified preview. Mutation checks confirmed the new assertions fail when the protected behavior is removed.TestPing_AgentSuggestionscovers bare names, owner-qualified names, UUIDs and JSON-mode errors with a shared fixture. The tests fail without the new hints; an owner-omission control also fails the qualified/UUID cases. The original network-heavyTestPingsuite remains unchanged and passes its normal race run.Normal and strict new-code Go lint, frontend checks/lint/typechecking, all eleven SSHButton stories, and docs checks pass. Browser checks verified copied SSH/CLI commands and keyboard dismissal; screenshots were visually inspected. The single-agent follow-up adds 25 command-copy cases covering ownership, agents across resources, subagents, and zero/unknown counts. All 53 affected SSHButton, AgentRow, and AgentDevcontainerCard stories pass, with browser validation of both real callers and regression/mutation controls for the command-selection guards.
CI follow-up and validation commands
After #31192 merged, the parent commits were dropped and the remaining eleven commits were rebased onto the merge commit
fb6d287528. Range-diff and full-tree comparisons confirm no implementation changes. Revalidated the complete SSH/ping/config race suite and strict lint after that rebase.Latest rebase preserves the implementation and carries the docs edits to main’s renamed
docs/workspaces/paths. The SSHButton documentation links and preview URL use the new routes. Revalidated the full SSH/ping/config CLI race suite, strict lint, 25 frontend tests, 53 stories, and docs/manifest/redirect checks. The local shell’s Oh My Zsh update prompt interrupted the first race run; the unchanged suite passed withDISABLE_AUTO_UPDATE=truescoped to the test process.Latest review follow-up: connection commands remain undefined during initial loading, and each instruction is gated on its own command. A cached SSH suffix remains usable after a failed refetch; a story captures that state. Rebased directly onto
mainatfb6d287528after #31192 merged. The P2 follow-up preserves native hostnames that collide with legacy prefix blocks, uses workspace-specific history for stopped agents, and retains safe precreated devcontainer names.Earlier stress runs of the unmodified
TestSSHsuite exceeded the 6,144 MiB guard under 35-repeat stress. Its existing scenarios remain unchanged. The three added agent-qualified hostname cases have independent full SSH round-trip coverage inTestSSH_AgentHostnames, with a shared fixture. The current top-PR changed-test selector chooses seven tests without the unrelatedTestSSHscenarios, and the complete selected set passes 35 repetitions at parallelism 16 with the same memory guard. No test cases, repetitions, parallelism or memory checks were removed.Follow-up to #19943. Tracks CLI-67.
Preview: https://coder.com/docs/@fix%2Fssh-multi-agent-hint/workspaces/workspace-access