Repository navigation
fix(coderd/database): match workspace requester by owner ID when sorting - #32188
Merged
Merged
Conversation
GetWorkspaces sorted the requester's own and favorite workspaces first by comparing owner_username with the requester's username. Usernames are unique only among non-deleted users, and deleting a user keeps the username, so a new user with a deleted user's username saw the deleted user's workspaces sorted as their own when listing deleted workspaces. Compare owner_id with the requester ID instead.
Member
Author
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
mafredri
marked this pull request as ready for review
November 17, 2026 10:24
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
deansheather
approved these changes
Nov 17, 2026
mafredri
had a problem deploying
to
docs-preview
November 17, 2026 11:42 — with
GitHub Actions
Failure
This branch had an error being deployed
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.
The
GetWorkspacessort that puts the requester's favorite and own workspaces first matches the owner by username instead of by ID. Usernames are unique only among non-deleted users, and a deleted user keeps theirs. So a user who takes a deleted user's username sees that user's deleted workspaces and favorites sorted as their own indeleted:truelistings. The new test reproduces this onmain.Matching by
owner_id, as the sort did before #22290, has no such case. #22290 doesn't say why it switched to the username. The likely reason is the sqlc CTE bug. With theEXISTS (tasks)filter the query had at the time, sqlc without the coder/sqlc fix rejected the bareowner_idas ambiguous, and the username form avoided that. #29085 removed that filter and #32187 restores the fix, so theowner_idform generates with either sqlc.Only deleted workspaces are affected through the API, because
deleteUserrefuses to delete a user who still has workspaces.