Fix/registry disable leak 3854#4178
Open
saurabh224s wants to merge 2 commits into
Open
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.
Summary
Fixes #3854 — the capability discovery API was leaking disabled registry
entries during agent lifecycle transitions.
Root Cause
RegistryListingService.list()did not pass a status filter to the databasequery, relying instead on a cache layer to hide disabled entries. During a
lifecycle transition (ACTIVE → DISABLED), a race window existed:
Changes
src/registry/listing.pystatus_infilter down to the DB query; invert cache-invalidation order indisable_entry()tests/registry/test_listing_no_disabled_leak.pyHow the Fix Works
Query-layer filter —
store.query(status_in={ACTIVE})is alwayspassed, so disabled entries are excluded at the DB index level, not
in application memory.
Cache-before-DB ordering —
disable_entry()now evicts the cacheentry before writing to the DB. Any reader that gets a cache miss
during the transition queries the DB and receives the post-write state.
Audit logging — every disable emits a structured log event with
entry_idandreason, no runtime secrets exposed.Test Coverage
Acceptance Criteria Check
Testing Locally