Repository navigation
🤖 feat: delete CoderWorkspacePoolMember workspaces with the identity guard and the last use check - #344
Conversation
…line and check the start build initiator Change-Id: I431d9dab372a21a885caef16659f5e9782a2fad3 Signed-off-by: Thomas Kosiewski <tk@coder.com>
…ne at bind Change-Id: I5b3d8d99f493c268d3b692baed5be0bec89e39a6 Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: I17d4226fdbc86196ea985c14a760c32b1917fa73 Signed-off-by: Thomas Kosiewski <tk@coder.com>
…se, agent loss, and dormancy Change-Id: I5ffdeabd7e32c5a6236ea4e6f25a7db99d536db3 Signed-off-by: Thomas Kosiewski <tk@coder.com>
…es out Change-Id: I92de215625e1d4d7d6d86d29040b457b2e6997cf Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: I7571e9c29a9e2093098ec6b3279e1230663091ba Signed-off-by: Thomas Kosiewski <tk@coder.com>
…ard and the last use check Change-Id: I5a7ebcaae02ef30dbedd9d51d9f2fd695a9e1813 Signed-off-by: Thomas Kosiewski <tk@coder.com>
Codex Review SummaryThis 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. |
|
@codex security review |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2989dabd21
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
…r is present Change-Id: Id270ded0f63a879bf6a2b6044b0c497b6a15a005 Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review |
|
@codex security review |
|
Codex Review: Didn't find any major issues. Nice work! 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". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
…ember-cleanup Change-Id: Ibd906df940eff74028b07e9215f39983bc648c45 Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review |
|
@codex security review |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80b8941d86
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
Summary
This PR adds the cleanup of a deleted
CoderWorkspacePoolMember(plan 6.5) to the dormant reconciler. Nothing registers the reconciler yet, so no user sees a change.When someone deletes a member (the pool, a claim through garbage collection, or a person), the member's finalizer now runs these steps:
coder.com/workspace-pool-member-cleanupgets no cleanup step at all, so removing the finalizer always releases it, even while another finalizer keeps the object (Codex 4268108694).CoderTemplateTest. The controller logs the workspace ID and name.include_deleted. The owner and thekwp-name must be the member's, and the build history must prove that the operator user created the workspace with the recorded start build (workspaceProvenance). Otherwise the member setsWorkspaceDeleted=UnknownwithOwnershipUnknown, keeps its finalizer, and never calls Coder for that workspace again. Only a person who removes the finalizer releases it.CoderTemplateTestdelete step: cancel an active build withexpect_status, send a delete build, count each failed delete build once, back off from 1 to 30 minutes, confirm with aninclude_deletedread. The member storesdeleteBuildIDanddeleteAttempts, shows phaseDeleting, and releases the finalizer after the delete build succeeded.Refs #153
Background
This is PR 8c of the
CoderWorkspacePoolstack (#153). It stacks on PR 8b (#343). The #322 and #324 final assessors asked for a start build provenance check before the delete step. Step 4 is that check: it uses the full build history, because during cleanup the latest build can be a cancel or a delete build.Validation
New tests (
coderworkspacepoolmember_cleanup_test.go):TestPoolMemberCleanupDeletesWorkspace: a deleted ready member starts a delete build (phaseDeleting,WorkspaceDeleted=FalseDeleting), and the finalizer goes once it succeeded. A bound member is deleted even after its claimant used it.TestPoolMemberCleanupGuardsDelete(plan mutation 3): a status that names another workspace of the owner, or a start build that the owner started, setsOwnershipUnknownwith no requeue. The finalizer stays, and later reconciles make no Coder call and no Coder write.TestPoolMemberCleanupLastUseCheck(plan mutation 11): a used unclaimed workspace is released without any Coder write. A template-wide write is not use, so that workspace is deleted.TestPoolMemberCleanupWithoutWorkspaceID: a create that took effect behind a lost answer is adopted, then its start build is canceled before the delete build. A create without effect is read again every 5 s within the settle window, and the site owner's 404 after it releases the finalizer. A gone control plane releases the finalizer without a Coder call.Mutation checks: I removed one control at a time, and each removal made a named test fail (14 of 14): the finalizer gate, plan mutations 3 (the identity guard before the delete) and 11 (the last use check), the start build ID check, the owner and name check, the last use check only for unclaimed members, no Coder call after
OwnershipUnknown, no requeue after it, the control plane gone release, adopting a confirmed workspace, the settle window poll, the release after reads prove no workspace, the release after the delete build, and storing the delete state.Gates on the final commit: drift (codegen, manifests, installer, API reference: no diff),
make docs-check, dormant-CRD guard, docs lint and spelling,make verify-vendor,make build,make lint, actionlint,make test,make test-integration,make vuln, race. All passed.make testandmake test-integrationpassed on retry: the first runs timed out under host load in unrelated CoderAIGatewayKey tests.Size
352 hand-written lines (about 201 production, 151 test, counting removals). No generated files.
Risks
None for users. The reconciler is dormant: nothing registers it.
Generated with
mux• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$121.59