Skip to content

fix(runtime): store SQL sessions as entries with chunked blobs#241

Open
mhart wants to merge 1 commit into
withastro:mainfrom
mhart:mhart/split-session-data
Open

fix(runtime): store SQL sessions as entries with chunked blobs#241
mhart wants to merge 1 commit into
withastro:mainfrom
mhart:mhart/split-session-data

Conversation

@mhart

@mhart mhart commented Jun 11, 2026

Copy link
Copy Markdown

Fixes session persistence failures on Cloudflare Durable Object SQLite when session history contains large inline image/blob content.

This changes SQL-backed session storage from one JSON blob per session to:

  • one metadata row per session
  • one row per session entry
  • chunked external rows for image/blob/document/file content

Large image data is rehydrated on session load, so model context remains unchanged while avoiding Cloudflare SQLite’s 2MB per-cell string/blob limit in normal usage.

Fixes #240

NOTE This is just one approach – another would be to persist large attachments to an external object store, like R2 – will explore that in a separate PR

@mhart mhart force-pushed the mhart/split-session-data branch 2 times, most recently from cec8df8 to 20fcf5e Compare June 11, 2026 07:07
@mhart mhart force-pushed the mhart/split-session-data branch from 20fcf5e to a45259a Compare June 11, 2026 09:10
Fixes session persistence failures on Cloudflare Durable Object SQLite when session history contains large inline image/blob content.

This changes SQL-backed session storage from one JSON blob per session to:

- one metadata row per session
- one row per session entry
- chunked external rows for image/blob/document/file content

Large image data is rehydrated on session load, so model context remains unchanged while avoiding Cloudflare SQLite’s 2MB per-cell string/blob limit in normal usage.

Fixes withastro#240
@mhart mhart force-pushed the mhart/split-session-data branch from a45259a to da94b41 Compare June 11, 2026 09:17
@FredKSchott

Copy link
Copy Markdown
Member

Closed, fixed in 1815fb9.

@FredKSchott FredKSchott reopened this Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLITE_TOOBIG when sessions are larger than 2MB

2 participants