chore: switch agent gone response from 502 to 404 (backport #23090)#23635
Merged
f0ssel merged 1 commit intorelease/2.31from Mar 25, 2026
Merged
chore: switch agent gone response from 502 to 404 (backport #23090)#23635f0ssel merged 1 commit intorelease/2.31from
f0ssel merged 1 commit intorelease/2.31from
Conversation
When a user creates a workspace, opens the web terminal, then the workspace stops but the web terminal remains open the web terminal will retry the connection. Coder will issue a HTTP 502 Bad Gateway response when this occurs because coderd cannot connect to the workspace agent, however this is problematic as any load balancer sitting in front of Coder sees a 502 and thinks Coder is unhealthy. The main change is in https://github.com/coder/coder/pull/23090/changes#diff-bbe3b56ed3532289481a0e977867cd15048b7ca718ce676aae3f3332378eebc2R97, however the main test and downstream tests are also updated. This PR changes the response to a [HTTP 404](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/404) after internal discussion. <img width="1832" height="1511" alt="image" src="https://github.com/user-attachments/assets/0baff80d-bb98-4644-89cd-e80c87947098" /> Created with the help of Mux, reviewed and tested by a human
1 task
f0ssel
approved these changes
Mar 25, 2026
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.
Backport of #23090 to
release/2.31.When a user creates a workspace, opens the web terminal, then the workspace stops but the web terminal remains open, the web terminal will retry the connection. Coder would issue a HTTP 502 Bad Gateway response when this occurred because coderd could not connect to the workspace agent, however this is problematic as any load balancer sitting in front of Coder sees a 502 and thinks Coder is unhealthy.
This PR changes the response to a HTTP 404 after internal discussion.
Cherry-picked from merge commit c33812a.