Repository navigation
Conversation
The reconciler now reads the config on every reconcile and sets back any field that differs with one sparse PATCH. A PATCH that sets a URL or the auth type carries every credential of the auth type. Credentials of other auth types are cleared and checked on every apply (#314). The ACL sync also runs every reconcile, so a user grant added in the dashboard goes. A config deleted before its generation is applied is created again. Refs #155 Change-Id: Iecb93e07d2fe2d13630dd026827c948afa0c6a73 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
The dormant
CoderMCPServerreconciler now reads its config in Coder on every reconcile and sets back each field that differs, with one sparse PATCH. It also clears credentials of other auth types on every apply (#314), and the access list sync runs on every reconcile, so a user grant that an admin added in the dashboard goes. The kind is not registered, so users see no change.This is the first of three PRs for plan step M6:
user_oidccorrection, and the in-memory hash that skips a resend after a metadata-only Secret change.Background
#307 applied the spec once per generation and then made no Coder call until the spec or a Secret changed. The
spec.accessfield doc says that every sync removes user grants added in the dashboard, but with no call, nothing removed them. I chose to add the drift read that the plan puts in M6, instead of changing the doc.TestCoderMCPServerSyncRemovesUserGrantshows a dashboard grant removed with no spec change.How a sync works
Every reconcile of an object with
status.configID, after the checks of #274:DeletedExternallywith no write (as in 🤖 feat: apply the CoderMCPServer spec and access list to the created config #307).url,auth_typeor an OAuth2 URL (plan 4.6 item 5), when its change token differs fromstatus.credentials, or when Coder reports it missing. A dashboard URL change therefore goes back with the credential.api_key_value: "",custom_headers: {},oauth2_client_secret: ""). Coder keeps them while the auth type stays.appliedGeneration,Ready.Known gap until the next PR: a dashboard disable or credential clear is set back on the next reconcile (at the latest after the 10-minute resync). The plan's kill switches for those, which hold every write until a spec edit, are in the next PR. The kind is not registered, so no install can hit this.
Validation
New tests in
internal/controller/codermcpserver_sync_test.go(envtest and the fake Coder, with the leak scan on every reconcile). Dashboard edits go through a second SDK client against the fake.TestCoderMCPServerSyncDrift(plan 4.7 item 5, S13): for each dashboard edit, the next reconcile sends exactly one PATCH with this body, Coder then holds the applied state again, and the reconcile after it sends nothing:{"description":""}{"availability":"default_off","forward_coder_headers":false}{"url":...,"api_key_value":...}(the credential goes with the URL){"api_key_header":"Authorization"}(no credential)api_keyconfig:{"custom_headers":{}}(🤖 CoderMCPServer: check that inactive credentials are cleared on every apply #314)noneconfig:{"api_key_value":""}(🤖 CoderMCPServer: check that inactive credentials are cleared on every apply #314: the state of the retry case in the issue)TestCoderMCPServerSyncRemovesUserGrant: a user grant added in the dashboard goes with one ACL PATCH and no config PATCH.TestCoderMCPServerSyncDeletedConfig: a dashboard delete after the apply givesDeletedExternallywith no write. A spec edit creates the config again, enabled with the key.TestCoderMCPServerApplyFailuresgains "update answers another type's credential" (has_custom_headers: trueon anapi_keyconfig givesCoderAnswerMismatch, 🤖 CoderMCPServer: check that inactive credentials are cleared on every apply #314). Its "config gone" case moves toTestCoderMCPServerSyncDeletedConfig.has_*check reduced to the active typemake 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
411 lines added and 125 removed, all hand-written: 293 changed lines in
codermcpserver_apply.go(94 of them remove the #307 apply and its answer check), 39 in the reconciler, 176 in the new sync tests, and 28 in existing tests.Fixes #314
Refs #155
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$127.81