From 0ee71a24691639e49038865b2c44c84b2a0fb6df Mon Sep 17 00:00:00 2001 From: LuMarans30 Date: Fri, 25 Sep 2026 15:38:22 +0200 Subject: [PATCH] fix: regenerate the stale avp_pb2 with protoc 5.29 so `import avp` loads on the 5.x runtime `src/avp/avp_pb2.py` was last regenerated on 2026-03-24 (`658aca2`), nine days before `6f7d04e` removed `EMBEDDING` from `proto/avp.proto` and v0.5.0's changelog announced it as "removed from SDK enum and proto schema". The generated module was never regenerated, so the generated enum kept the value even though the schema had dropped it: the checked-in copy still declares `EMBEDDING = 2` in the `avp_pb2.PayloadType` descriptor. (The public `avp.PayloadType` enum in `types.py` never carried it, so this changes no public API.) That stale copy was produced by protoc 6.31.1, whose guard refuses any runtime older than the linked gencode: $ python -m venv /tmp/repro && . /tmp/repro/bin/activate $ pip install "protobuf==5.29.6" $ pip install -e . $ python -c "import avp" google.protobuf.runtime_version.VersionError: Detected incompatible Protobuf Gencode/Runtime versions when loading avp.proto: gencode 6.31.1 runtime 5.29.6. The trigger is broader than any single extra: `pyproject.toml` declared only `protobuf>=4.21`, so every environment constrained below 6.31.1 failed at `import avp`. The `all` extra hits it deterministically because `autogen-core` requires `protobuf~=5.29.3`, so `pip install "avp[all]"` can never supply a runtime the stale gencode accepts. Regenerate with protoc 5.29 (gencode 5.29.0) and raise the `protobuf` floor to `>=5.29` to match. The floor bump is a deliberate narrowing: environments pinned to protobuf 4.21-5.28 must upgrade, but protobuf 4.x is end-of-life and a 5.29-generated module cannot load on those runtimes. `grpcio-tools` is pinned to `>=1.71.2,<1.72`; 1.72+ targets protobuf 6.30 and 1.84+ targets 7.35.1, neither of which can coexist with `autogen-core`'s `~=5.29.3`. Left unpinned, the next `make proto` would silently reintroduce the mismatch, and the `dev` and `all` extras could no longer be co-installed. `proto/avp.proto` is not touched. The only descriptor difference is the disappearance of the dead `avp_pb2.PayloadType.EMBEDDING`, which nothing under `src/` or `tests/` references. Verified against protobuf 5.29.6 and 7.36.1: `import avp` succeeds and `avp_pb2.PayloadType` exposes exactly `{HIDDEN_STATE, KV_CACHE}`. Regenerating with the pinned toolchain reproduces the committed file exactly (`grpcio-tools==1.71.2` + `make proto` leaves `git diff` clean), and `tests/test_codec.py` + `tests/test_codec_v2.py` pass (28 tests). --- CHANGELOG.md | 10 ++++++++++ Makefile | 3 +++ pyproject.toml | 7 +++++-- src/avp/avp_pb2.py | 20 ++++++++++---------- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95468a7..70f1716 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ All notable changes to the AVP Python SDK are documented in this file. Format follows [Keep a Changelog](https://keepachangelog.com/). Versions follow [Semantic Versioning](https://semver.org/). +## [Unreleased] + +### Changed + +- **Minimum `protobuf` raised to `>=5.29`** (from `>=4.21`) to match the regenerated gencode. Environments pinned to `protobuf` 4.21–5.28 must upgrade; protobuf 4.x is end-of-life. + +### Fixed + +- **Protobuf gencode/runtime mismatch** — the checked-in `avp_pb2.py` carried gencode 6.31.1, whose runtime guard rejects any `protobuf` older than 6.31.1, while `pyproject.toml` required only `>=4.21`. Every environment constrained below 6.31.1 failed at `import avp`, including `avp[all]`, where `autogen-core` requires `protobuf~=5.29.3`. Regenerated with protoc 5.29 (gencode 5.29.0). `grpcio-tools` is pinned to `>=1.71.2,<1.72` (1.72+ needs `protobuf>=6.30`, which cannot coexist with `autogen-core`'s pin) so a later `make proto` cannot reintroduce the mismatch. Also drops the dead `EMBEDDING` value that v0.5.0 removed from `proto/avp.proto` but never from the generated module. + ## [0.6.2] - 2026-04-26 ### Added diff --git a/Makefile b/Makefile index 16e74db..40aefcf 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ .PHONY: proto test lint clean install +# Regenerate avp_pb2.py. Keep grpcio-tools on the 5.29 gencode line +# (>=1.71.2,<1.72): the autogen extra pins protobuf to 5.29.x, so a +# newer protoc would emit gencode the runtime refuses to load. proto: python -m grpc_tools.protoc \ -I proto \ diff --git a/pyproject.toml b/pyproject.toml index 4b1ca17..82b2ece 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ classifiers = [ dependencies = [ "numpy>=1.24", - "protobuf>=4.21", + "protobuf>=5.29", "zstandard>=0.21", ] @@ -57,7 +57,10 @@ dev = [ "pytest>=7.0", "pytest-asyncio>=0.21", "ruff>=0.1", - "grpcio-tools>=1.59", + # Keep protoc on the 5.29 gencode line. grpcio-tools 1.72+ targets + # protobuf>=6.30 (1.84+ targets >=7.35.1), neither of which can coexist + # with autogen-core's protobuf~=5.29.3. + "grpcio-tools>=1.71.2,<1.72", ] [project.entry-points."vllm.general_plugins"] diff --git a/src/avp/avp_pb2.py b/src/avp/avp_pb2.py index 69aaa91..a73085d 100644 --- a/src/avp/avp_pb2.py +++ b/src/avp/avp_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: avp.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 5.29.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -11,9 +11,9 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, - 6, - 31, - 1, + 5, + 29, + 0, '', 'avp.proto' ) @@ -24,7 +24,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\tavp.proto\x12\x03\x61vp\"\xdb\x03\n\x08Metadata\x12\x12\n\nsession_id\x18\x01 \x01(\t\x12\x17\n\x0fsource_agent_id\x18\x02 \x01(\t\x12\x17\n\x0ftarget_agent_id\x18\x03 \x01(\t\x12\x10\n\x08model_id\x18\x04 \x01(\t\x12\x12\n\nhidden_dim\x18\x05 \x01(\r\x12\x12\n\nnum_layers\x18\x06 \x01(\r\x12&\n\x0cpayload_type\x18\x07 \x01(\x0e\x32\x10.avp.PayloadType\x12\x1c\n\x05\x64type\x18\x08 \x01(\x0e\x32\r.avp.DataType\x12\x14\n\x0ctensor_shape\x18\t \x03(\r\x12$\n\x04mode\x18\n \x01(\x0e\x32\x16.avp.CommunicationMode\x12\x18\n\x0b\x63ompression\x18\x0b \x01(\tH\x00\x88\x01\x01\x12\x12\n\navp_map_id\x18\r \x01(\t\x12\'\n\x05\x65xtra\x18\x0e \x03(\x0b\x32\x18.avp.Metadata.ExtraEntry\x12\x1d\n\x10payload_checksum\x18\x0f \x01(\rH\x01\x88\x01\x01\x1a,\n\nExtraEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x0e\n\x0c_compressionB\x13\n\x11_payload_checksumJ\x04\x08\x0c\x10\r\"\xcc\x01\n\x10TransmitResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\x12\x14\n\x07message\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x17\n\nrequest_id\x18\x03 \x01(\tH\x01\x88\x01\x01\x12/\n\x05\x65xtra\x18\x04 \x03(\x0b\x32 .avp.TransmitResponse.ExtraEntry\x1a,\n\nExtraEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\n\n\x08_messageB\r\n\x0b_request_id*<\n\x0bPayloadType\x12\x10\n\x0cHIDDEN_STATE\x10\x00\x12\x0c\n\x08KV_CACHE\x10\x01\x12\r\n\tEMBEDDING\x10\x02*.\n\x11\x43ommunicationMode\x12\n\n\x06LATENT\x10\x00\x12\r\n\tJSON_MODE\x10\x01*<\n\x08\x44\x61taType\x12\x0b\n\x07\x46LOAT32\x10\x00\x12\x0b\n\x07\x46LOAT16\x10\x01\x12\x0c\n\x08\x42\x46LOAT16\x10\x02\x12\x08\n\x04INT8\x10\x03\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\tavp.proto\x12\x03\x61vp\"\xdb\x03\n\x08Metadata\x12\x12\n\nsession_id\x18\x01 \x01(\t\x12\x17\n\x0fsource_agent_id\x18\x02 \x01(\t\x12\x17\n\x0ftarget_agent_id\x18\x03 \x01(\t\x12\x10\n\x08model_id\x18\x04 \x01(\t\x12\x12\n\nhidden_dim\x18\x05 \x01(\r\x12\x12\n\nnum_layers\x18\x06 \x01(\r\x12&\n\x0cpayload_type\x18\x07 \x01(\x0e\x32\x10.avp.PayloadType\x12\x1c\n\x05\x64type\x18\x08 \x01(\x0e\x32\r.avp.DataType\x12\x14\n\x0ctensor_shape\x18\t \x03(\r\x12$\n\x04mode\x18\n \x01(\x0e\x32\x16.avp.CommunicationMode\x12\x18\n\x0b\x63ompression\x18\x0b \x01(\tH\x00\x88\x01\x01\x12\x12\n\navp_map_id\x18\r \x01(\t\x12\'\n\x05\x65xtra\x18\x0e \x03(\x0b\x32\x18.avp.Metadata.ExtraEntry\x12\x1d\n\x10payload_checksum\x18\x0f \x01(\rH\x01\x88\x01\x01\x1a,\n\nExtraEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x0e\n\x0c_compressionB\x13\n\x11_payload_checksumJ\x04\x08\x0c\x10\r\"\xcc\x01\n\x10TransmitResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\x12\x14\n\x07message\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x17\n\nrequest_id\x18\x03 \x01(\tH\x01\x88\x01\x01\x12/\n\x05\x65xtra\x18\x04 \x03(\x0b\x32 .avp.TransmitResponse.ExtraEntry\x1a,\n\nExtraEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\n\n\x08_messageB\r\n\x0b_request_id*-\n\x0bPayloadType\x12\x10\n\x0cHIDDEN_STATE\x10\x00\x12\x0c\n\x08KV_CACHE\x10\x01*.\n\x11\x43ommunicationMode\x12\n\n\x06LATENT\x10\x00\x12\r\n\tJSON_MODE\x10\x01*<\n\x08\x44\x61taType\x12\x0b\n\x07\x46LOAT32\x10\x00\x12\x0b\n\x07\x46LOAT16\x10\x01\x12\x0c\n\x08\x42\x46LOAT16\x10\x02\x12\x08\n\x04INT8\x10\x03\x62\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -36,11 +36,11 @@ _globals['_TRANSMITRESPONSE_EXTRAENTRY']._loaded_options = None _globals['_TRANSMITRESPONSE_EXTRAENTRY']._serialized_options = b'8\001' _globals['_PAYLOADTYPE']._serialized_start=703 - _globals['_PAYLOADTYPE']._serialized_end=763 - _globals['_COMMUNICATIONMODE']._serialized_start=765 - _globals['_COMMUNICATIONMODE']._serialized_end=811 - _globals['_DATATYPE']._serialized_start=813 - _globals['_DATATYPE']._serialized_end=873 + _globals['_PAYLOADTYPE']._serialized_end=748 + _globals['_COMMUNICATIONMODE']._serialized_start=750 + _globals['_COMMUNICATIONMODE']._serialized_end=796 + _globals['_DATATYPE']._serialized_start=798 + _globals['_DATATYPE']._serialized_end=858 _globals['_METADATA']._serialized_start=19 _globals['_METADATA']._serialized_end=494 _globals['_METADATA_EXTRAENTRY']._serialized_start=407