feat: query device state with CEL discovery predicates - #64
Merged
Merged
Conversation
This was referenced Sep 15, 2026
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.
Agents can now ask state questions over devices with no callable functions using
discover(selector, where=...). The registry evaluates the same CEL dialect as broadcast over storedstatus,identity, and devicelabelsbefore pagination; device-only tool results contain ids, types, and locations plus the match count and label histogram. Calls withoutwherekeep their existing behavior.Both registry clients forward predicates. State queries bypass the edge SDK's fleet cache, malformed predicates return JSON-RPC
-32602/ toolinvalid_predicate, and clients reject older servers that ignore the filter. Predicate pagination and counts include only ACL-visible matches. CEL is installed by both the server package and registry Docker image, and the discovery guide documents bindings, freshness, and compatibility.Installing CEL also activates the broadcast predicate scale test. Its first CI run exposed idle predicate workers timing out before submission because an unnecessary semaphore-task yield let other devices consume their deadline. Idle slots are now acquired directly; the 50 ms deadline, four-worker cap and contended timeout behavior are preserved, with a deterministic regression test. The scale test gets a simulation-only timeout budget because its devices share one interpreter/event loop; Python 3.12 can otherwise reject already-computed results while other simulated devices occupy that loop. Production timeout tests retain their original limits.
Validation:
fbc5ccb.--backend=nats).ruff check packages/ tests/andgit diff --checkpass; all three package wheels build.The full local integration attempt was interrupted after six Zenoh peer-discovery failures on macOS (those tests passed in the first Linux CI run); NATS broadcast cases are validated separately against Docker. The 5,000-record discovery check used a synthetic stored snapshot rather than etcd. State discovery requires an updated registry and edge SDK; D2D and old-server client fallback are not included. Registry scan cost and heartbeat/snapshot freshness remain unchanged.
Closes #63.