Skip to content

fix(coderd/database/dbpurge): allow disabling AI Bridge retention with 0 - #21062

Merged
mafredri merged 1 commit into
mainfrom
mafredri/feat-allow-disable-aibridge-purge
Dec 3, 2025
Merged

mafredri merged 1 commit into
mainfrom
mafredri/feat-allow-disable-aibridge-purge

Conversation

@mafredri

@mafredri mafredri commented Dec 2, 2025

Copy link
Copy Markdown
Member

Previously setting AI Bridge retention to 0 would cause records to be
deleted immediately since we didn't check for the zero value before
calculating the deletion threshold.

This adds a check for aibridgeRetention > 0 to skip deletion when
retention is disabled, matching the pattern used for other retention
settings (connection logs, audit logs, etc.).

Also fixes the return type of DeleteOldAIBridgeRecords from int32 to
int64 since COUNT(*) returns bigint in PostgreSQL.

Refs #21055

@mafredri

mafredri commented Dec 2, 2025

Copy link
Copy Markdown
Member Author

For reviewer: I suggest hiding whitespace changes to view the test refactor.

@dannykopping dannykopping left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot!

Previously setting AI Bridge retention to 0 would cause records to be
deleted immediately since we didn't check for the zero value before
calculating the deletion threshold.

This adds a check for aibridgeRetention > 0 to skip deletion when
retention is disabled, matching the pattern used for other retention
settings (connection logs, audit logs, etc.).

Also fixes the return type of DeleteOldAIBridgeRecords from int32 to
int64 since COUNT(*) returns bigint in PostgreSQL.

Refs #21055
@mafredri
mafredri force-pushed the mafredri/feat-allow-disable-aibridge-purge branch from 97374cc to 5e15923 Compare December 3, 2025 09:27
@mafredri
mafredri enabled auto-merge (squash) December 3, 2025 09:36
@mafredri
mafredri merged commit ad93262 into main Dec 3, 2025
25 checks passed
@mafredri
mafredri deleted the mafredri/feat-allow-disable-aibridge-purge branch December 3, 2025 09:37
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants