fix: unify simulated cache handling and expose usage to proxy clients#648
Open
zhoudashuaibi wants to merge 2 commits into
Open
fix: unify simulated cache handling and expose usage to proxy clients#648zhoudashuaibi wants to merge 2 commits into
zhoudashuaibi wants to merge 2 commits into
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.
This PR addresses two related issues we hit while running Aether in production:
Unlimited wallet balance was still rejected after the wallet state was updated
When a key's wallet was initially cached as
BalanceDeniedand then changed tounlimitedbalance mode, the gateway kept returning the stale cached rejection. This change makes the refresh logic re-check wallet rejections so thatunlimitedwallets are allowed through instead of being blocked by a staleBalanceDeniedstate.Simulated cache was not applied consistently and was invisible to proxy clients
The existing
kirosimulated cache only covered a subset of providers. We added a provider-levelsimulated_cacheconfiguration that applies to all providers and overrides any native cache reporting when enabled. We also wired the simulated cache hit/miss counts through to proxy clients via response metadata.What's changed
apps/aether-gateway/src/control/auth/resolution.rsunlimitedwallets can recover from a previousBalanceDeniedstate.apps/aether-gateway/src/execution_runtime/kiro_cache.rsSimulatedCacheConfigand provider-levelsimulated_cache_enabled/simulated_cache_min_percent/simulated_cache_max_percentcontext fields.apps/aether-gateway/src/execution_runtime/simulated_cache.rs(new)apps/aether-gateway/src/execution_runtime/stream/execution.rs&sync/execution.rscrates/aether-usage-runtime/src/request_metadata.rs&write.rsAdmin provider write/normalize paths and frontend provider form
Usage repositories (memory / postgres / sqlite)
Notes for reviewers