Skip to content

Session messages#1510

Merged
rumpl merged 2 commits intomainfrom
session-messages
Jan 28, 2026
Merged

Session messages#1510
rumpl merged 2 commits intomainfrom
session-messages

Conversation

@rumpl
Copy link
Member

@rumpl rumpl commented Jan 27, 2026

Refactor session persistence. A new PersistentRuntime wrapper intercepts runtime events (new events, not sent back to the caller: MessageAddedEvent, SubSessionCompletedEvent, SummaryAddedEvent) and persists session changes to the store. The runtime has very little store things left, to be removed in a followup.

The database schema is normalized with a new session_items table for messages, summaries, and sub-session references, replacing the previous JSON-encoded messages column. Migrations handle data conversion from the legacy format.

rumpl added 2 commits January 27, 2026 21:51
We had only one "sessions" table that contained a json blob with all the
messages of a session. This was bad, especially for session updates.
This change extracts the session messages into its own table.

A nice change that comes with this is that we now save the messages in
real time and not only when the loop ends.

This also marks a slow start of moving things out of the runtime which
is starting to get crowded.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
When the session store fails to open or migrate, backup the existing
database file (and WAL/SHM files) and attempt to start fresh. This
prevents users from being locked out due to corrupt or incompatible
database files.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
@rumpl rumpl requested a review from a team as a code owner January 27, 2026 20:52
@Pnkcaht
Copy link
Contributor

Pnkcaht commented Jan 27, 2026

Refactor session persistence. A new PersistentRuntime wrapper intercepts runtime events (new events, not sent back to the caller: MessageAddedEvent, SubSessionCompletedEvent, SummaryAddedEvent) and persists session changes to the store. The runtime has very little store things left, to be removed in a followup.

The database schema is normalized with a new session_items table for messages, summaries, and sub-session references, replacing the previous JSON-encoded messages column. Migrations handle data conversion from the legacy format.

Is there anything I can do? Whether it's related to this or something general. @rumpl

@rumpl
Copy link
Member Author

rumpl commented Jan 27, 2026

@Pnkcaht here's what you can do:

  • get my branch
  • compile
  • cp -r ~/.cagent ~/.cagent-old (to backup your session database)
  • run cagent run and see if you can load past sessions

Thanks

@dgageot
Copy link
Member

dgageot commented Jan 28, 2026

@rumpl works for me. cagent took a second or two to start

@rumpl rumpl merged commit 86efabb into main Jan 28, 2026
13 of 14 checks passed
@rumpl rumpl deleted the session-messages branch January 31, 2026 21:02
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.

3 participants