fix(gateway): invalidate agent cache on cross-process session writes (#45966) - #46095
Closed
kyssta-exe wants to merge 1 commit into
Closed
fix(gateway): invalidate agent cache on cross-process session writes (#45966)#46095kyssta-exe wants to merge 1 commit into
kyssta-exe wants to merge 1 commit into
Conversation
Contributor
|
Verification: clean review — agent cache invalidation for cross-process writes Reviewed the full diff. Implementation is sound:
Checked for: race conditions between the pre-lock DB query and the post-lock cache check (benign — worst case is one unnecessary cache miss), dead variables, callback chain issues. No findings. Tests cover the happy path (cache hit/miss) and the cross-process invalidation scenario. Clean PR. |
Collaborator
Contributor
Author
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.
Fixes #45966. When another process (e.g. hermes dashboard) writes to the same session DB, the cached agent's in-memory transcript becomes stale. This fix stores the session's message_count alongside the cached agent and checks it on reuse. If the count has changed (indicating a cross-process write), the cache entry is discarded and a fresh agent is built from the updated DB transcript.