8000 fix: handle `workspace.agent` and `agent.workspace.owner` in `coder ssh` by ethanndickson · Pull Request #18093 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

fix: handle workspace.agent and agent.workspace.owner in coder ssh #18093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2025

Conversation

ethanndickson
Copy link
Member
@ethanndickson ethanndickson commented May 29, 2025

Closes #18088.

The linked issue is misleading -- coder config-ssh continues to support the coder. prefix. The reason the command
ssh coder.workspace.agent fails is because coder ssh workspace.agent wasn't supported. This PR fixes that.

We know we used to support workspace.agent, as this is what we (used to) recommend in the Web UI:
image

This PR also adds support for coder ssh agent.workspace.owner, such that after running coder config-ssh, a command like

ssh agent.workspace.owner.coder

works, even without Coder Connect running. This is done for parity with an existing workflow that uses ssh workspace.coder, which either uses Coder Connect if available, or the CLI.

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the handling of the ssh command input format by adding support for the "workspace.agent" and "agent.workspace.owner" formats, ensuring parity with the existing Coder Connect workflow.

  • Updated SSH tests (cli/ssh_test.go) with new cases such as "myworkspace.dev" and "dev.myworkspace.myuser"
  • Modified the workspace normalization logic in cli/ssh.go to correctly transform the new input formats

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
cli/ssh_test.go Added new test cases for handling "workspace.agent" and "agent.workspace.owner" formats
cli/ssh.go Updated input normalization to support the new formats through specific conditional logic
Comments suppressed due to low confidence (1)

cli/ssh_test.go:117

  • Include an assertion comment or additional explicit test expectations for the normalized output of this new input format to verify that the transformation to 'owner/workspace.agent' is correct.
"dev.myworkspace.myuser",

@ethanndickson ethanndickson marked this pull request as ready for review May 29, 2025 01:47
@ethanndickson ethanndickson force-pushed the ethan/extra-ssh-input-cases branch from 99db25d to df1ec50 Compare May 29, 2025 01:49
@matifali
Copy link
Member

Would this also support ssh workspace.agent.coder format?
For workspaces having multiple agents?

@ethanndickson
Copy link
Member Author
ethanndickson commented May 29, 2025

ssh workspace.agent.coder via config-ssh becomes coder ssh workspace.agent, and supporting that is the very purpose of this PR

With this PR:

$ ssh pog2.dev.coder
👋 Your workspace is outdated! Update it here: https://dev.coder.com/@ethan/pog2

@ethanndickson ethanndickson merged commit da02375 into main May 29, 2025
30 checks passed
@ethanndickson ethanndickson deleted the ethan/extra-ssh-input-cases branch May 29, 2025 07:26
@github-actions github-actions bot locked and limited conversation to collaborators May 29, 2025
@matifali
Copy link
Member

/cherry-pick release/2.22

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: SSH Prefix change is not backwards compatible
3 participants
0