fix: skills apis backend response bloat clearing + cleanup orphans grace period change - #4396
Conversation
…ace period change
This stack of pull requests is managed by Graphite. Learn more about stacking. |
📝 WalkthroughSummary by CodeRabbit
WalkthroughIntroduces a ChangesSkill Orphan Cleanup Grace Period and GetSkill Optimization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Comment |
Confidence Score: 4/5Safe to merge; changes are well-scoped and test coverage for the cleanup behaviour is updated correctly. The core logic changes are correct and consistent with the existing GetSkillLean pattern. GetSkill and GetSkillLean are now functionally identical — a cleanup opportunity — and no new test directly asserts GetSkill's HighestVersion output after the refactor, though the path is implicitly covered. Neither finding affects runtime correctness today. framework/configstore/skills.go — GetSkill and GetSkillLean are now equivalent; worth consolidating to prevent silent divergence. Important Files Changed
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
ui/lib/types/skills.ts (1)
47-51: 💤 Low valueComment wording: suggest explicit exclusivity clause to match PR objectives.
The comment "Lean version summary returned in version list responses" is accurate and helpful, but the PR objectives state the clarification should emphasize it is returned "only in version list responses, not in skill detail responses." While the TypeScript interfaces already enforce this (GetSkillResponse uses Skill without a versions field), making the comment explicit would align it with the stated intent.
Optional improvement: "Lean version summary returned only in version list responses, not in skill detail responses."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ui/lib/types/skills.ts` around lines 47 - 51, Update the comment for the SkillVersionSummary type definition to explicitly clarify that it is returned only in version list responses, not in skill detail responses. Change the current comment from "Lean version summary returned in version list responses." to "Lean version summary returned only in version list responses, not in skill detail responses." to align with the PR objectives and make the distinction between usage contexts clear.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@ui/lib/types/skills.ts`:
- Around line 47-51: Update the comment for the SkillVersionSummary type
definition to explicitly clarify that it is returned only in version list
responses, not in skill detail responses. Change the current comment from "Lean
version summary returned in version list responses." to "Lean version summary
returned only in version list responses, not in skill detail responses." to
align with the PR objectives and make the distinction between usage contexts
clear.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: a1dc94b2-13f4-4206-b0b3-717f4292e688
📒 Files selected for processing (4)
framework/configstore/skills.gotransports/bifrost-http/handlers/skills.gotransports/bifrost-http/handlers/skills_cleanup_test.goui/lib/types/skills.ts
|
|
Merge activity
|
…ace period change (#4396) ## Summary This PR decouples version history loading from the `GetSkill` endpoint, extends the orphan file cleanup grace period from 30 minutes to 24 hours, and populates `HighestVersion` and `FileCount` fields directly on the skill struct during retrieval. ## Changes - `GetSkill` no longer eagerly preloads the full version list. Instead, it fetches only the most recently created version via `latestCreatedSkillVersion` and assigns it to `skill.HighestVersion` for bump validation. Full version history is now exclusively loaded through `ListSkillVersions`. - `populateSkillFiles` now also sets `skill.FileCount` from the length of the loaded files slice. - The orphan blob and upload object cleanup grace period has been increased from 30 minutes to 24 hours, extracted into a named constant `SkillOrphanCleanupGracePeriod` shared between the configstore and HTTP handler layers. - Tests updated to backdate orphan blobs and objects by 25 hours instead of 1 hour to correctly exceed the new grace period. - The `SkillVersionSummary` type comment updated to reflect that it is only returned in version list responses, not skill detail responses. ## Type of change - [x] Bug fix - [ ] Feature - [ ] Refactor - [ ] Documentation - [ ] Chore/CI ## Affected areas - [x] Core (Go) - [x] Transports (HTTP) - [ ] Providers/Integrations - [ ] Plugins - [x] UI (React) - [ ] Docs ## How to test ```sh go test ./framework/configstore/... go test ./transports/bifrost-http/handlers/... ``` Verify that: - `GetSkill` returns the correct `HighestVersion` without including a full version list in the response. - `FileCount` is populated correctly on the returned skill. - Orphan cleanup does not reap blobs or objects created within the last 24 hours when `force` is false. - Orphan cleanup correctly removes blobs and objects older than 24 hours. ## Breaking changes - [ ] Yes - [x] No ## Related issues ## Security considerations None. ## Checklist - [x] I read `docs/contributing/README.md` and followed the guidelines - [x] I added/updated tests where appropriate - [x] I updated documentation where needed - [x] I verified builds succeed (Go and UI) - [x] I verified the CI pipeline passes locally if applicable

Summary
This PR decouples version history loading from the
GetSkillendpoint, extendsthe orphan file cleanup grace period from 30 minutes to 24 hours, and populates
HighestVersionandFileCountfields directly on the skill struct duringretrieval.
Changes
GetSkillno longer eagerly preloads the full version list. Instead, itfetches only the most recently created version via
latestCreatedSkillVersionand assigns it to
skill.HighestVersionfor bump validation. Full versionhistory is now exclusively loaded through
ListSkillVersions.populateSkillFilesnow also setsskill.FileCountfrom the length of theloaded files slice.
30 minutes to 24 hours, extracted into a named constant
SkillOrphanCleanupGracePeriodshared between the configstore and HTTPhandler layers.
hour to correctly exceed the new grace period.
SkillVersionSummarytype comment updated to reflect that it is onlyreturned in version list responses, not skill detail responses.
Type of change
Affected areas
How to test
Verify that:
GetSkillreturns the correctHighestVersionwithout including a fullversion list in the response.
FileCountis populated correctly on the returned skill.when
forceis false.Breaking changes
Related issues
Security considerations
None.
Checklist
docs/contributing/README.mdand followed the guidelines