fix: infer workspace from env in coder support bundle (#24617)

When running `coder support bundle` inside a workspace without arguments, the command now infers the workspace and agent from the `CODER_WORKSPACE_NAME`, `CODER_WORKSPACE_OWNER_NAME`, and `CODER_WORKSPACE_AGENT_NAME` environment variables set by the workspace agent.

Previously, running without arguments inside a workspace produced an incomplete bundle with no workspace info, agent logs, or connection diagnostics, despite the environment having all the information needed to resolve the current workspace.

Also updates the usage string from `<workspace>` to `[<workspace>]` to reflect that the argument has always been optional.

Closes #24615
This commit is contained in:
Ehab Younes
2026-04-22 17:21:28 +03:00
committed by GitHub
parent 9b5d09ebdc
commit 3362b5ae7e
4 changed files with 77 additions and 7 deletions
+2 -2
View File
@@ -6,13 +6,13 @@ Generate a support bundle to troubleshoot issues connecting to a workspace.
## Usage
```console
coder support bundle [flags] <workspace> [<agent>]
coder support bundle [flags] [<workspace>] [<agent>]
```
## Description
```console
This command generates a file containing detailed troubleshooting information about the Coder deployment and workspace connections. You must specify a single workspace (and optionally an agent name).
This command generates a file containing detailed troubleshooting information about the Coder deployment and workspace connections. You may specify a single workspace (and optionally an agent name). When run inside a workspace, the workspace and agent are inferred from the environment if not provided.
```
## Options