Repository navigation
In-object conversation APIs for Durable Object subclasses: read history, settlements and attachments; truncate or replace the tail #944
greghunt
started this conversation in
Feature Request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Public, in-object APIs for an agent's Durable Object to read its own conversation (history, settlements, attachments) and to edit its tail (truncate, or replace the tail with a delivery) inside one storage transaction, so subclasses made with
extend()stop reading and writing Flue's private SQLite tables.Background & Motivation
We run Flue 2.3.1 on Cloudflare and subclass the agent Durable Object with
extend(). Several product features need the object to look at or change its own conversation from inside the object, whereclient.history()(an HTTP round trip to itself) is either unavailable or the wrong boundary. Today each of them reads or writes Flue's private tables directly:flue_agent_submissions, falling back to folding the history.flue_conversation_stream_batchesinto messages is not exported, so we re-implement enough of it to read records.flue_attachments/flue_attachment_chunks.flue_conversation_fold_checkpoints, stamp a new stream incarnation, delete the removed submissions' rows, thenctx.abort()the object because its cached writer still holds the old incarnation's producer claim.dispatch({ idempotencyKey }). Because the writer must restart between the cut and the admission, another message can be admitted in between. To keep order we predict the keyed submission id by re-derivingderiveKeyedSubmissionId, and hold other admissions until it appears.Each of these breaks silently when the storage layout or the id derivation changes. We check the schema on every upgrade, and a test finds
deriveKeyedSubmissionIdin the build by name.Goals
Example
All reactions