fix: invalidate gateway cache on secret and rule mutations - #117
Merged
Conversation
Add POST /api/cache/invalidate endpoint to the gateway that clears cached CONNECT responses for the authenticated account. Include account_id in cache keys to enable prefix-based invalidation. Web app calls the endpoint after every secret, rule, and agent mutation so agents pick up changes immediately instead of waiting for the 60-second cache TTL. Fixes #116
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
Credentials added via the dashboard were not immediately available to agents due to the gateway's 60-second CONNECT response cache. This adds cache invalidation so changes take effect instantly.
Changes
Gateway (Rust):
del_by_prefixmethod toCacheStoretrait (both InMemory and Redis implementations)account_idin cache key format:connect:{account_id}:{token}:{host}POST /api/cache/invalidateendpoint (authenticated, scoped to caller's account)Web app (TypeScript):
useInvalidateGatewayCachehook for client-side cache bustingHow it works
POST /api/cache/invalidateto the gateway (fire-and-forget)Fixes #116