feat: add SQLite transcript frontier and delta API#79972
feat: add SQLite transcript frontier and delta API#79972100yenadmin wants to merge 409 commits intoopenclaw:mainfrom
Conversation
|
Codex review: found issues before merge. Summary Reproducibility: Do we have a high-confidence way to reproduce the issue? Not applicable: this is a feature/API PR rather than a current-main bug; the blocking concern is source-visible on the PR head export surface. Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Keep the public seam read-focused, document the cursor/reset contract, and leave transcript mutation behind an internal or explicitly trusted API boundary. Do we have a high-confidence way to reproduce the issue? Do we have a high-confidence way to reproduce the issue? Not applicable: this is a feature/API PR rather than a current-main bug; the blocking concern is source-visible on the PR head export surface. Is this the best way to solve the issue? Is this the best way to solve the issue? No: the frontier/delta direction is plausible, but publishing raw transcript replacement with the read seam is not the narrowest maintainable or safest SDK boundary. Full review comments:
Overall correctness: patch is incorrect Security concerns:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 749dc78b8d74. |
|
Architecture fit for this slice: flowchart TD
A["canonical transcript_events"] --> B["frontier(agentId, sessionId)"]
B --> C["cursor"]
C --> D["delta load"]
D --> E["append"]
D --> F["reset"]
D --> G["missing"]
D --> H["future companion consumers"]
Why this slice exists:
Why it was chosen before typed projections:
Stack placement:
Lossless Claw connection:
|
|
Follow-up on the live review findings:
What changed:
Runtime proof is now in the PR body and shows:
This keeps the public seam narrow, compatibility-preserving, and durable enough for SQLite-native replay consumers like LCM. |
Summary
Implements the first raw public transcript replay seam needed for database-first companion consumers.
This PR adds a SQLite-explicit frontier and delta API on top of the canonical
transcript_eventstable:getSqliteSessionTranscriptFrontier(...)loadSqliteSessionTranscriptDelta(...)The new seam stays keyed to
{agentId, sessionId}, returns raw transcript events, and makes rewrite invalidation explicit instead of pretendingseqis a durable replay token forever.Why this is better
This improves OpenClaw as a platform, not just for LCM:
Scope
Included:
SqliteSessionTranscriptFrontier,SqliteSessionTranscriptCursor, andSqliteSessionTranscriptDeltaopenclaw/plugin-sdk/session-store-runtimeNot included:
#79903#79905Review Follow-up
This PR now keeps the replay seam additive and compatibility-preserving.
Fixes:
plugin-sdk/session-store-runtimeas compatibility adapterscreatedAtfloor so same-millisecond full rewrites still force cursor resetWhy this was necessary:
eventCountandlastSeqstill need a durable invalidation signalPrimary follow-up files:
src/plugin-sdk/session-store-runtime.tssrc/plugin-sdk/session-store-runtime.test.tssrc/config/sessions/transcript-store.sqlite.tssrc/config/sessions/transcript-store.sqlite.test.tsextensions/memory-core/src/memory/index.test.tsextensions/memory-core/src/memory/manager.fts-only-reindex.test.tsextensions/qqbot/src/state-migrations.test.tsReal Behavior Proof
Runtime proof from a direct module invocation on the PR branch:
{ "frontier": { "sessionId": "session-1", "updatedAt": 100, "eventCount": 2, "lastSeq": 1, "baseCreatedAt": 100 }, "delta": { "mode": "reset", "frontier": { "sessionId": "session-1", "updatedAt": 101, "eventCount": 2, "lastSeq": 1, "baseCreatedAt": 101 } } }That proof shows:
mode: "reset"instead of silently returning append/no-opValidation
Observed locally:
2files passed,16tests passed3internal import-boundary files passed,16tests passedStack placement
This PR is the first public replay seam in the companion-fit stack.
Related stack:
Why this is separate:
Issue
Refs openclaw/openclaw#79904.