mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-07 10:45:59 -10:00
Every save replays the event log before it appends, and the reader refused a log past 128 MiB. Images were stored inline as data URLs, so a session with about 2 MiB of images per turn crossed the budget around turn 63: from then on LoadSession failed and every Save failed with the same error, and later turns never reached disk. New records write each data-URL image to <id>.blobs/<sha256>, fsynced before the record that names it, and carry an image_blobs side table instead. Replay reads each blob back byte for byte and verifies its hash. Such records are stamped schema_version 3, so older studio and 1.x builds refuse the log instead of loading it without its images and saving that loss back. A missing blob is restored from the copy the .jsonl checkpoint still inlines and written back. With no copy left, the message keeps its text and records the lost image as provider.UnavailableImage (hash and position); only ModelMessages renders a note, and the blob reappearing restores the image. A transcript missing an image never rewrites a checkpoint that still holds it, and a runtime still holding an image whose blob vanished writes it back instead of being reported as diverged; what cannot be restored fails under ErrSessionImagesUnavailable. The reader ceiling is 512 MiB. A save folds a log past 128 MiB only when the fold drops at least 64 MiB, so a legacy inline-image log is folded to its text once, while a large text-only log is not rewritten on every save. A compaction sweeps blobs that neither the published log nor a salvage or recovery sidecar (.events.jsonl.damaged, .superseded, .context.json) names, and stale temp files; a sidecar it cannot read whole stops the sweep. The stored compaction projection is built with ProjectionMessages, so an unavailable image stays a host record there instead of rendered text. The blob directory is a session sidecar dir: delete, rename (blobs before the log), recovery trash, native re-homing and sub-agent delete take it along. Refs #10965