Repository navigation
🤖 fix: trust only Coder's own 404 in the CoderAIProvider sync and disable paths - #335
Merged
Merged
Conversation
…able paths A 404 that Coder did not send, such as an HTML page of a proxy or Coder's "Route not found." for a wrong base URL, made the sync path clear the provider ID and credential after a spec edit, so the object lost ownership for good, and made the disable path report the provider gone without disabling it. Both now wait with CoderUnavailable and change nothing. Fixes #327 Change-Id: Ifcd70ee11dcb94c41bd0c29680b22afce2248774 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. |
Member
Author
|
@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. |
This was referenced Oct 14, 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 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
CoderAIProvidersync and disable paths now trust only Coder's own 404, as the delete path does since #325. This must land before the next release tag (#327).Fixes #327
Refs #154
Why
Before this change, any 404 counted as "the provider is gone": an HTML page from a proxy, or Coder's
Route not found.for a wrong base URL.providerGoneclearstatus.providerIDandstatus.credential. The create path then read the provider by name, saw a display name that was no longer the nonce, and stalled withNameConflict. The object lost ownership for good: a later credential failure no longer disabled the provider, and a delete released the finalizer without deleting it in Coder.DeletedExternally.enabled: false.What
isCoderResourceNotFound(from #325: a 404 whose message is Coder's fixedResource not found or you do not have access to this resource) now decides at the three remaining provider-by-ID reads:coderaiprovider_sync.go).coderaiprovider_sync.go).coderaiprovider_disable.go).Any other 404 falls through to the existing error branches: sync waits with
CoderUnavailable(30 s) and changes nothing; disable waits with "Coder can still send the key of provider X ..." (30 s) and retries the disable.The create path's name lookups keep
isCoderNotFound: there a 404 leads to a create attempt or to the site-owner check, not to a loss of ownership.Tests
TestCoderAIProviderSyncNotCoder404: an HTML 404 andRoute not found.on the sync GET, for an applied provider and after a spec edit. Each waits withCoderUnavailable, keepsproviderIDandcredential, and sends no write. The next reconcile isReady, with no second create.TestCoderAIProviderSyncUpdate404NotCoderRead: after a spec edit, the PATCH answers Coder's 404 and the re-read answers a non-Coder 404. The object waits (get provider ... after a 404 update) and keeps ownership; the next reconcile isReady.TestCoderAIProviderDisableNotCoder404: with the key Secret's label removed, a non-Coder 404 on the read waits with "Coder can still send the key" and the provider stays enabled; the next reconcile disables it.Mutation checks (each one breaks a named test, then I reverted it):
isCoderNotFoundback on the sync GET, on the sync re-read, and on the disable GET.Local gates on the pushed tree, exit 0 each:
make verify-vendor,make test,make test-integration,make build,make lint,go tool govulncheck ./...,go test -race ./internal/controller/, andmake codegen manifests build-installer docs-referencewith no diff.Generated with
mux• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$116.80