Repository navigation
Speak agent protocol v2 over UDS and gRPC - #5
Merged
Merged
Conversation
Agents built with this SDK could not connect to Zentinel: both UDS runners used the v1 framing, and the gRPC server registered no service. - v2/uds.py: v2 framing (4-byte BE length incl. the type byte, type byte, JSON payload) and the message type codes. - UDS server: handshake answered with the full UdsHandshakeResponse schema (capabilities, features, limits, encoding); Configure (0x17) reaches on_configure and is acknowledged with allow, or block 500 on rejection, before the next message is read; Ping -> Pong; every AgentResponse carries its correlation id in audit.custom; events are handled concurrently. - gRPC: zentinel.agent.v2.AgentServiceV2 from the proxy's proto (generated code committed). ProcessStream sends its headers up front (the proxy waits for them before the handshake), applies ConfigureEvent in order and ends the stream on rejection, answers Ping with the same sequence, and maps headers, bodies and decisions. - One handler per runner, shared by every connection: the proxy may send a request's headers and body on different pooled connections. The request cache is bounded. - run_agent / AgentRunner now delegate to the v2 runner; the v1 framing helpers are removed from protocol.py. - examples/conformance_agent.py (the harness's conformance agent) and examples/hello_agent.py (the README agent); tests/integration runs them through the shared conformance harness, replacing the v1 mocks; CI gets a conformance job using zentinelproxy/zentinel/sdk-conformance. - Requires grpcio>=1.72.1 and protobuf>=6.30 (generated-code floors). - Version 0.3.0.
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.
Refs zentinelproxy/zentinel#600. Before this PR, the SDK couldn't complete a handshake with Zentinel on either transport.
It now passes every check of the shared conformance harness (
zentinelproxy/zentinel/sdk-conformance, merged in zentinel#607) on UDS and gRPC, against a zentinel built frommain: handshake, Configure (nested config acknowledged), request and response header mutations, Block, body inspection, and reconnect. CI runs the harness throughsdk-conformance@mainwithzentinel-ref: mainuntil a release includes zentinel#603. The README's "adds X-Hello and allows" agent passes thehelloprofile.Agents built with this SDK could not connect to Zentinel: both UDS runners
used the v1 framing, and the gRPC server registered no service.
JSON payload) and the message type codes.
(capabilities, features, limits, encoding); Configure (0x17) reaches
on_configure and is acknowledged with allow, or block 500 on rejection,
before the next message is read; Ping -> Pong; every AgentResponse carries
its correlation id in audit.custom; events are handled concurrently.
code committed). ProcessStream sends its headers up front (the proxy waits
for them before the handshake), applies ConfigureEvent in order and ends
the stream on rejection, answers Ping with the same sequence, and maps
headers, bodies and decisions.
request's headers and body on different pooled connections. The request
cache is bounded.
helpers are removed from protocol.py.
examples/hello_agent.py (the README agent); tests/integration runs them
through the shared conformance harness, replacing the v1 mocks; CI gets a
conformance job using zentinelproxy/zentinel/sdk-conformance.