Skip to content

fix: clean up ServerlessRuntime record and cache on plugin uninstall#749

Merged
fatelei merged 4 commits into
mainfrom
fix/eng-474-serverless-uninstall-cleanup
Jun 1, 2026
Merged

fix: clean up ServerlessRuntime record and cache on plugin uninstall#749
fatelei merged 4 commits into
mainfrom
fix/eng-474-serverless-uninstall-cleanup

Conversation

@GareArc
Copy link
Copy Markdown
Contributor

@GareArc GareArc commented May 27, 2026

Summary

  • Delete ServerlessRuntime DB record when the last tenant uninstalls a serverless plugin (Refs==0), inside the existing transaction — guarded by InstallType == SERVERLESS
  • Expose ClearServerlessRuntimeCache as a public method on PluginManager (renamed from private)
  • Clear Redis serverless runtime cache on full plugin deletion — best-effort (logged, not returned), guarded by RuntimeType == SERVERLESS

Fixes ENG-474: after uninstall + reinstall, the stale ServerlessRuntime record and cached hostname caused credential requests to route to the deleted serverless endpoint (no such host). Required a Pod restart to recover.

Test Plan

  • Install serverless plugin (single tenant) → uninstall → confirm serverless_runtimes row deleted and redis-cli GET "serverless:runtime:<id>" returns (nil)
  • Reinstall same plugin → confirm fresh record created → add model credentials → no no such host error, no Pod restart needed
  • Multi-tenant: install on Tenant A + B → Tenant A uninstalls (Refers → 1) → confirm record and cache NOT cleared (Tenant B still active)

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. go Pull requests that update go code labels May 27, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request exports the ClearServerlessRuntimeCache method and updates the plugin uninstallation flow to clear the serverless runtime cache and delete the corresponding ServerlessRuntime database records. The reviewer identifies potential cache and database record leaks in the UpgradePlugin flow, which mirrors the uninstall flow, and suggests logging an error if the plugin manager is uninitialized when attempting to clear the cache.

Comment thread internal/service/install_plugin.go
Comment thread internal/types/models/curd/atomic.go
Comment thread internal/service/install_plugin.go
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels May 27, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 1, 2026
@fatelei fatelei merged commit b979ebb into main Jun 1, 2026
7 checks passed
@fatelei fatelei deleted the fix/eng-474-serverless-uninstall-cleanup branch June 1, 2026 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update go code lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants