Repository navigation
Conversation
Contributor
|
recheck |
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
helpcodeai
requested changes
Dec 6, 2026
helpcodeai
left a comment
Contributor
There was a problem hiding this comment.
Thanks for picking this up, and for signing the CLA.
We can't merge it as it is. Here is what needs to change:
- Move it out of
ee/. Every change is underpackages/backend/src/ee/. That folder uses the commercial license and we don't take outside changes there (seeAGENTS.mdandLICENSING.md). Issue #1971 puts the new sweep in the audit module, outsideee/, so it runs on Cloud and on self-hosted. The existing Cloud sweep inkg-cron.service.tscan stay as it is; we will connect the two on our side. - Values of 0 or below. An override of 0 or less removes the workspace from the global pass and is then skipped, so its rows are never trimmed or deleted. Please ignore such values and fall back to the default.
- Only shorten on Cloud. A value above the default keeps rows longer than the platform limit. On Cloud the effective value must be
min(override, default). On self-hosted any positive value is fine, and empty keeps today's behaviour. - Payload setting. #1971 asks to clear
input,output,errorandintentcompletely after N days, whatever their size, and keep tool, status, duration and time. This PR only shortens large payloads, like the global trim. - Key names. Please use the keys from #1971:
invocation_payload_daysandinvocation_retention_days. - Keep the diff small. The PR switches the whole file to double quotes. Please keep the existing style (
npm run lintinpackages/backend).OrgSettingsServiceis injected but not used.
Tests: please cover that the shorter value wins on Cloud, other workspaces keep the default, other workspaces' rows are left alone, and every query is filtered by organizationId.
Happy to review again once it lives outside ee/.
This branch has not been deployed
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
Adds per-workspace retention and payload trimming overrides in
KgCronServicefor tool invocation logs while preserving global environment defaults (INVOCATION_RETENTION_DAYSdefault90days andINVOCATION_PAYLOAD_RETENTION_DAYSdefault14days).Changes
OrgSettingsServiceintoKgCronServiceand resolves per-workspace overrides forinvocation_payload_retention_daysandinvocation_retention_dayswith fallback to global environment defaults and safe handling for non-numeric or disabled values.trimOldPayloads()(viatrimPayloadsForScope) andretention()to run scoped cleanup for overridden workspaces and exclude overriddenorganizationIdvalues from global fallback passes.packages/backend/src/ee/cloud/kg-cron.service.spec.tscovering per-workspace payload trimming, row pruning withnotInexclusions, and invalid setting fallbacks.Type
Testing
Ran
pnpm --filter @anythingmcp/backend test ee/cloud/kg-cron.service.spec.ts ee/cloud/kg-cron-batch.service.spec.ts(all 14 tests passing).Checklist
npm test)Related Issues