fix: infer workspace from env in coder support bundle#24617
Merged
Conversation
Docs preview |
coder support bundlecoder support bundle
johnstcn
reviewed
Apr 22, 2026
johnstcn
approved these changes
Apr 22, 2026
Member
johnstcn
left a comment
There was a problem hiding this comment.
Nice! One suggestion re CODER_WORKSPACE_ID env
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. Also updates the usage string from `<workspace>` to `[<workspace>]` to reflect that the argument has always been optional. Closes #24615
483a3f3 to
985b510
Compare
Member
|
A tangential QQ: does support bundle also runs and includes |
Contributor
Author
It does not no, and in this case, running |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When running
coder support bundleinside a workspace without arguments, the command now infers the workspace and agent from theCODER_WORKSPACE_NAME,CODER_WORKSPACE_OWNER_NAME, andCODER_WORKSPACE_AGENT_NAMEenvironment 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
Note
Generated by Coder Agents
Implementation notes
inv.Environ.Get()(testable viainv.Environ.Set()) rather thanos.Getenvfor the new env lookups, consistent withcli/open.go.os.LookupEnv("CODER")warning on line 131 is left as-isto avoid unnecessary churn.
owner/workspaceandthe optional agent name, then the existing resolution logic runs
unchanged.
missing or incomplete, so behavior is unchanged outside workspaces.