Repository navigation
🤖 feat: sweep the cleanup records of CoderAIGatewayKey objects that went without a delete (#353 part 2d) - #386
Conversation
… part 2c) Change-Id: I6c7f7e46475e8077e1e05bace6651255696f5782 Signed-off-by: Thomas Kosiewski <tk@coder.com>
…t without a delete (#353 part 2d) Change-Id: Ibf00c765664b1fa913d842a5c3e42509ea71312f 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. |
Dogfood: key sweep after a namespace deletion (head 5bb2486)Operator image
The key counts come straight from the key-sweep-dogfood.mp4Generated with |
Change-Id: Ie6e20c73f37d2ad40e2df7d8602fb0d0aebab4bd Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review Round 2: one docs-only commit. The advisor found that the how-to said the sweep deletes "every key whose name starts with the prefix". The code ( |
|
@codex security review |
|
Codex Review: Didn't find any major issues. Breezy! 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. |
…leanup-sweep Change-Id: I4ab65c5fe1c0be7661b20c783c3df60d89b2077b Signed-off-by: Thomas Kosiewski <tk@coder.com>

Refs #353 (part 2d: the
CoderAIGatewayKeyhalf of option B′, sweep). Refs #156. Stacked on #385 (records). Review only the top commit. I retarget this PR tomainafter #385 lands.Summary
The cleanup record sweep from #375 now also handles
CoderAIGatewayKeyrecords. After a namespace deletion with an external database, the leftover keys are deleted in Coder once the namespace comes back with a control plane on the same Coder deployment. A different deployment at the same URL is never swept. Provider sweeping is unchanged.Design note (option B′, #353 (comment))
The sweep keeps every rule of #375. The only new part is how one record's resources are deleted. That part now goes through a per-kind table (
cleanupRecordKinds): the object type to look up, the words for the Event, and the sweep function./buildinfodeployment ID equals the record'sck8s-<UID without dashes>-plus a serial. The prefix is checked against the record's UID first (assertion). No other key is touched.NoMatchingDeploymentEventCoderAIGatewayKey. The Event says "the AI Gateway keys".The sweeper also wakes a key record when its
CoderAIGatewayKeyis deleted, as it does for providers.Validation
cleanup_sweep_key_test.go:TestCleanupSweepAIGatewayKeys: the settle window, no match, a different deployment at the same URL, and then the sweep. The sweep deletes the current, the retiring and an orphan key. It leaves a person's key and another object'sck8s-key, and the metrics change.TestCleanupSweepAIGatewayKeyCases: a living object, the same name with a new UID, a proxy 404, a LIST that still shows a key, an operator user that is not a site owner, and a control plane in another namespace.Risks
Swept the Coder resources of a deleted object). Its Event text is the same as before.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high