Repository navigation
🤖 feat: delete the Coder MCP server config of a deleted CoderMCPServer - #368
Merged
Merged
Conversation
A deleted CoderMCPServer now deletes the config that it created and then releases its finalizer (plan 4.10): - With a config ID, one DELETE by ID. Coder's own 404 also releases. Any other answer keeps the finalizer and retries every 60 s. - With only a create marker, the slug read decides: only the nonce proves that the config is this object's. A missing config waits until a late create cannot commit any more (2 minutes), and needs a site owner. - A deleted control plane releases the finalizer without a Coder request. A control plane that is being deleted gets one DELETE attempt bounded at 10 s, then the finalizer goes. - The scope gate never blocks the delete. - The released object's credential hashes leave the reconciler's map. Refs #155 Change-Id: Iaa3d096523bb12408656377958c20563409982f3 Signed-off-by: Thomas Kosiewski <tk@coder.com>
Member
Author
|
@codex security review |
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 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. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
A deleted
CoderMCPServernow deletes the Coder MCP server config that it created, then releases its finalizer. Before this PR, the dormant reconciler kept the finalizer of any object that could own a config, and deleted nothing. The kind is not registered, so users see no change.This is plan step M7 (plan 4.10). It also removes the object's entry from the reconciler's in-memory credential hash map on release, from the #329 final assessment.
How a delete works
ControlPlaneGone).DELETEby ID, in the pinned organization. A 204 or Coder's own 404 (CoderMCPServer: trust only Coder's own 404 before clearing the config ID (gate before M9) #337) releases the finalizer. A proxy 404,Route not found., or any other error keeps it and retries every 60 s.DELETEattempt bounded at 10 s, then the finalizer goes, also when that attempt fails. This is the rule ofCoderAIProvider(AI providers, chat models and AI policies as controller CRDs #154 D12).This follows the
CoderAIProviderdelete path (coderaiprovider_delete.go).Validation
New tests in
internal/controller/codermcpserver_delete_test.go:TestCoderMCPServerDeleteDeletesTheConfig: with the opt-in in place and with it withdrawn, oneDELETE, the config is gone, and the finalizer goes.TestCoderMCPServerDeleteAnswers: a config already gone (Coder's own 404) releases. An HTML 404,Route not found.and a 502 keep the finalizer, reportCoderUnavailablewith a 60 s requeue, and the retry deletes the config.TestCoderMCPServerDeletePendingCreate: with only a create marker, a config with the nonce is deleted, someone else's config is kept, a recent create waits withConfirmingCreate(at most 2 minutes), and an old create releases.TestCoderMCPServerDeleteWhileControlPlaneDeletes: a Terminating control plane gets exactly oneDELETEattempt, then the finalizer goes. This holds when the attempt succeeds, fails with 502, or hangs (released in about 12 s).TestCoderMCPServerDeleteForgetsSentCredentials: the released object's credential hashes leave the map.TestCoderMCPServerFinalizer(updated): an object with a config ID whose control plane is gone releases its finalizer with no Coder request.make verify-vendor,make build,make lint,GOFLAGS=-mod=vendor go tool govulncheck ./...,make test,make test-integration,go test -race ./internal/controller/, andmake docs-checkpass.make codegen,make manifests,make build-installerandmake docs-referenceleave no diff.Size
407 lines added and 16 removed, all hand-written: 138 in
codermcpserver_delete.go, 15 changed lines in the reconciler, 8 in the test export file, and 262 in tests.Refs #155
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$201.29