Repository navigation
Purge stored prompts past their retention as a recurring job - #2641
Merged
Merged
Conversation
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.
Closes #2618
What
The recurring retention purge of stored prompts (AUD-04), from the post-merge review of #2545: until now nothing purged them unless a person called
IModelCallLog.PurgeAsync, andSystemInitiator.Retentionwas unused.retention.purgejob (RetentionPurgeJob, Core):SystemInitiator.Retentionand is listed for it inEngineJobs(Harden the system initiator: reset links, an engine allow-list and refusal tests #2617).PurgeAsyncbatch after batch until a batch clears nothing, each batch in a scope of its own so a long backlog does not pile up in one context, reporting progress after each.model_call.purgedevent, logged as the retention engine. A purge the engine may not make fails the run with its reason.IRetentionSchedule):RetentionStartup). A database the host cannot reach yet only delays that to the next start.PurgeAsync's comment says it clears a batch at a time.Why
AUD-04 sets a retention for stored prompts and responses. A retention that a person must remember to apply is not enforced, so the product applies it itself, as the engine ADR-0012 named for it.
Choices worth a look:
EngineJobs, now in v2.Tests
Integration, on SQLite and PostgreSQL where a database is involved:
model_call.purgednames the engine, and one run is left queued a day later. A second host that starts then enqueues none. The test waits for the run to succeed, and the first host's own run ends before the expired call goes in.model_call.purgedfor each as the retention engine, and schedules the next run a day later as that engine.model_purge_people_only, and purges and schedules nothing.EngineJobslists the purge for the retention engine (unit).The full suite ran locally against a
postgres:17container as well as SQLite, and markdownlint passes. No new package and no migration. After v2's webhook job, the model test scenario gives the job handlers a secret protector stub, since the retention tests resolve them together as the worker does. A started host now runs a retention job at once, so a test that reads the SQLite file while its host runs, as the webhook tests do, reads it without asking for sole access.Checklist
v2