From 90c3b5ee6f5ed5b5b19db0f8f3a9216014b0cf6b Mon Sep 17 00:00:00 2001 From: "tao.chen" <93983997+taochen-ct@users.noreply.github.com> Date: Wed, 5 Aug 2026 19:14:05 +0800 Subject: [PATCH] fix: save version error --- backend/src/backend/services/storage.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/src/backend/services/storage.py b/backend/src/backend/services/storage.py index 0789b43..6f72678 100644 --- a/backend/src/backend/services/storage.py +++ b/backend/src/backend/services/storage.py @@ -406,6 +406,16 @@ async def create_server_object_payload( ) session.add(item) await session.flush() + # Force SQLAlchemy to round-trip server-default columns + # (created_at / updated_at / is_deleted) in the *current* async + # context. ``eager_defaults="auto"`` on the mapper does not + # guarantee a refresh for non-PK server defaults; without this, + # ``storage_payload`` (a sync helper) would later trigger a lazy + # refresh through the async driver and raise MissingGreenlet. + await session.refresh( + item, + attribute_names=["created_at", "updated_at", "is_deleted"], + ) item.relative_path = payload.relative_path upload.storage_object_id = item.storage_object_id upload.upload_status = "completed"