Repository navigation
fix: regenerate the stale avp_pb2 so import avp works with the protobuf 5.x runtime - #2
Open
LuMarans30 wants to merge 1 commit into
Open
LuMarans30 wants to merge 1 commit into
LuMarans30 wants to merge 1 commit into
Conversation
…ads 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).
LuMarans30
force-pushed
the
fix/protobuf-gencode-runtime
branch
from
September 25, 2026 15:27
d43bb86 to
0ee71a2
Compare
This branch has not been deployed
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.
Problem
import avpfails with aVersionErrorwhenever the installed protobuf isolder than the linked gencode:
Root cause
pyproject.tomldeclared onlyprotobuf>=4.21, while the checked-insrc/avp/avp_pb2.pywas compiled with gencode 6.31.1, whose runtime guardrejects any
protobufolder than 6.31.1. So every environment constrainedbelow 6.31.1 failed at
import avp. Theallextra hits it deterministicallybecause
autogen-corerequiresprotobuf~=5.29.3, sopip install "avp[all]"can never supply the runtime the stale gencode demands.
While regenerating, I also noticed the checked-in file had drifted from the
schema. It was last generated on 2026-03-24 (
658aca2), right before6f7d04eremoved
EMBEDDINGin v0.5.0. Since it was never recompiled,avp_pb2.PayloadTypestill definedEMBEDDING = 2.Fix
src/avp/avp_pb2.pyusing protoc 5.29 (gencode 5.29.0).protobufrequirement from>=4.21to>=5.29.grpcio-toolsto>=1.71.2,<1.72. grpcio-tools 1.72+ targetsprotobuf>=6.30(1.84+ targets>=7.35.1), neither of which can coexistwith
autogen-core's pin (~=5.29.3). Left unpinned, the nextmake protowould reintroduce the mismatch and break installing
devalongsideall.proto/avp.protois untouched. The only change in the generated code isdropping the unused
EMBEDDINGvalue. The publicPayloadTypeenum intypes.pynever had it, so there are no public API changes.Compatibility
protobuffloor moves from>=4.21to>=5.29: environments pinned to4.21-5.28 must upgrade. protobuf 4.x is end-of-life, and a 5.29-generated
module cannot load on those runtimes.
on 7.36.1).
EMBEDDING = 2;codec.pyalreadyrejects unknown
payload_typevalues, so decoding behavior is unchanged.Verification
import avpsucceeds,avp_pb2.PayloadTypecontains only
{HIDDEN_STATE, KV_CACHE}.make protowithgrpcio-tools==1.71.2reproduces the committed file exactly(
git diffclean).tests/test_codec.pyandtests/test_codec_v2.pypass (28 tests total).