Skip to content

fix(memory): old Summary message parts fail to deserialize with missing field 'kind' #2257

@bug-ops

Description

@bug-ops

Summary

On agent startup, messages loaded from SQLite that were stored with the old Summary MessagePart schema fail to deserialize with:

WARN zeph_memory::sqlite::messages: failed to deserialize message parts, falling back to empty
  role=assistant parts_json=[{"Summary":{"text":"..."}}]
  error=missing field 'kind' at line 1 column NNN

Root Cause

A kind field was added to MessagePart::Summary (or a related variant) without a #[serde(default)] attribute, breaking deserialization of messages stored before the change.

Impact

  • Affected messages fall back to empty (role=assistant, no content) — effective context loss for older sessions
  • No crash — graceful fallback exists
  • Observed: 6 messages affected in the CI-223 test DB (stored during CI-219/220 sessions)
  • May affect production users upgrading across the schema change

Expected Behavior

Old Summary messages should deserialize correctly (add #[serde(default)] to new fields, or add a DB migration to backfill the kind field).

Reproduction

  1. Run agent sessions before the schema change (any session storing deferred summaries)
  2. Upgrade and start a new session on the same DB
  3. Observe WARN lines at startup during restored N message(s)

Config

.local/config/testing.toml, SQLite backend, history_limit=50

Metadata

Metadata

Assignees

Labels

P3Research — medium-high complexitybugSomething isn't workingmemoryzeph-memory crate (SQLite)

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions