Repository navigation
🤖 feat: write a cleanup record before each CoderAIGatewayKey create (#353 part 2c) - #385
Merged
Merged
Conversation
… part 2c) Change-Id: I6c7f7e46475e8077e1e05bace6651255696f5782 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.
Refs #353 (part 2c: the
CoderAIGatewayKeyhalf of option B′, records). Refs #156.Summary
Before each AI Gateway key create, the operator now writes a cleanup record for the
CoderAIGatewayKeyobject: a ConfigMapck8s-cleanup-<object UID>in the operator namespace, the same kind of record that #374 added forCoderAIProvider. If the record cannot be written, no key is created. The delete path removes the record only after a LIST in the record's Coder deployment shows no key of the object. In every other release without a delete (for example a namespace deletion), the record stays. The sweep that uses it follows in the stacked PR (part 2d).Design note (option B′, maintainer decision #353 (comment))
How each invariant maps to keys:
issueKeywrites the record after the Secret claim and dry run, and before the create marker (pendingKey,nextSerial). A failed deployment ID read is aCoderUnavailablewait. A failed write is an error. Either way no POST is sent and no marker is written.ck8s-<UID without dashes>-(in thenoncefield), the time of the last create, and the current key ID. The test helperreconcileErrnow also checks the record for every key plaintext, in every key test./api/v2/buildinfo), read in the reconcile that sends the create. When a record already names another deployment, the create step stalls withCoderDeploymentChangedand creates nothing in the new deployment (same rule as providers).4.–6. Sweep rules: next PR.
nextSerial == 0sent no create, so its record (left by a failed marker write) goes with no Coder call.8.–9. Same Role and namespace as 🤖 feat: write a cleanup record before each CoderAIProvider create (#353 part 2a) #374. No RBAC change.
Key-specific choices:
recordAIGatewayKeyID). The same path also gives a record to an object from before records existed.attemptStartstamps the record,lastCreateAttemptTimeand the Secret write-age limit, so the sweep's settle window covers every create.Also in this PR: #384 follow-up 4 for keys (#353 (comment), item 4). A delete pass under the control plane hold now ends at the hold end (
context.WithDeadline), and its retry counts from the end of the pass, as #384 did forCoderMCPServer.Validation
TestCoderAIGatewayKeyCleanupRecord,TestCoderAIGatewayKeyNoCreateWithoutRecord,TestCoderAIGatewayKeyDeploymentChanged,TestCoderAIGatewayKeyRecordAfterBoundedPass,TestCoderAIGatewayKeyRecordWithoutCreate,TestCoderAIGatewayKeyRecordBackfill, andTestAIGatewayKeyDeleteUnderHoldEndsAtHoldEnd../internal/controller/...), docs-check, actionlint. All passed.Risks
GET /api/v2/buildinfo) per create. A failure of that read blocks the create with a 60 s retry, as for providers.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high