Rudy Celekli

Upstream contribution · agno-agi/agno

agno · Keeping the last good Agno session table after a failed write

Rudy Celekli’s engineering portfolio · AI-assisted summary

Problem

JsonDb started overwriting the live session table before serialization and writes completed. A file-size limit could leave a partial JSON document where a previously readable session table had been.

Engineering response

The normal file path stages the serialized table in a unique sibling file and publishes it with an atomic replace after a successful close. Error cleanup removes the writer's own staging file, and the implementation preserves existing behavior for nonregular paths and file metadata described in the PR.

Evidence and scope

A subprocess reproduced a native EFBIG through the public session API. The PR records a 347-byte valid table becoming a 411-byte partial file on the baseline. With the patch, the original bytes remain readable and get_session returns the saved session.