fix(memory): use MessagePart::Summary for summary serialization (#2257)#2271
Merged
fix(memory): use MessagePart::Summary for summary serialization (#2257)#2271
Conversation
…ply_tool_pair_summaries
Replaces hardcoded externally-tagged JSON literal with proper
MessagePart::Summary serialization. The MessagePart enum uses
so the old {"Summary": {"text": "..."}} format was incompatible with
deserialization, causing "missing field 'kind'" errors when loading
compacted messages from SQLite.
Closes #2257
…tion format (#2257) Adds three tests: - apply_tool_pair_summaries_parts_deserialize_as_summary_variant: verifies that apply_tool_pair_summaries writes internally-tagged parts that round-trip through load_history as MessagePart::Summary - old_external_tag_summary_format_fails_to_deserialize: documents that the pre-fix externally-tagged format is incompatible with the current schema - summary_roundtrip: verifies MessagePart::Summary serializes to {"kind":"summary","text":"..."} and deserializes back correctly
bug-ops
added a commit
that referenced
this pull request
Mar 27, 2026
…ePart format (#2278) SQLite records written before v0.17.1 use the old externally-tagged format ({"Summary":{"text":"..."}}). After #2271 introduced the internally-tagged format ({"kind":"summary","text":"..."}), these rows silently deserialized to vec![] — 80 failures observed in a single session log. - Add `try_parse_legacy_parts()` compat fallback in `parse_parts_json()`: recognizes all 12 old-format variant keys and converts to new format; emits tracing::warn on the legacy path for observability. - Add migration 045 that resets legacy-format `parts` rows to `[]`; the plain-text `content` column is preserved as the display fallback. - Update and extend unit tests; rename test that previously asserted the old format fails to assert it now succeeds via the compat path.
bug-ops
added a commit
that referenced
this pull request
Mar 27, 2026
…ePart format (#2278) SQLite records written before v0.17.1 use the old externally-tagged format ({"Summary":{"text":"..."}}). After #2271 introduced the internally-tagged format ({"kind":"summary","text":"..."}), these rows silently deserialized to vec![] — 80 failures observed in a single session log. - Add `try_parse_legacy_parts()` compat fallback in `parse_parts_json()`: recognizes all 12 old-format variant keys and converts to new format; emits tracing::warn on the legacy path for observability. - Add migration 045 that resets legacy-format `parts` rows to `[]`; the plain-text `content` column is preserved as the display fallback. - Update and extend unit tests; rename test that previously asserted the old format fails to assert it now succeeds via the compat path.
bug-ops
added a commit
that referenced
this pull request
Mar 27, 2026
…ePart format (#2278) SQLite records written before v0.17.1 use the old externally-tagged format ({"Summary":{"text":"..."}}). After #2271 introduced the internally-tagged format ({"kind":"summary","text":"..."}), these rows silently deserialized to vec![] — 80 failures observed in a single session log. - Add `try_parse_legacy_parts()` compat fallback in `parse_parts_json()`: recognizes all 12 old-format variant keys and converts to new format; emits tracing::warn on the legacy path for observability. - Add migration 045 that resets legacy-format `parts` rows to `[]`; the plain-text `content` column is preserved as the display fallback. - Update and extend unit tests; rename test that previously asserted the old format fails to assert it now succeeds via the compat path.
bug-ops
added a commit
that referenced
this pull request
Mar 27, 2026
…ePart format (#2278) (#2287) SQLite records written before v0.17.1 use the old externally-tagged format ({"Summary":{"text":"..."}}). After #2271 introduced the internally-tagged format ({"kind":"summary","text":"..."}), these rows silently deserialized to vec![] — 80 failures observed in a single session log. - Add `try_parse_legacy_parts()` compat fallback in `parse_parts_json()`: recognizes all 12 old-format variant keys and converts to new format; emits tracing::warn on the legacy path for observability. - Add migration 045 that resets legacy-format `parts` rows to `[]`; the plain-text `content` column is preserved as the display fallback. - Update and extend unit tests; rename test that previously asserted the old format fails to assert it now succeeds via the compat path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
apply_tool_pair_summariesincrates/zeph-memory/src/sqlite/messages/mod.rswas writing parts as a hardcoded externally-tagged JSON literal{"Summary":{"text":"..."}}, which is incompatible with the internally-tagged serde representation used byMessagePart(#[serde(tag = "kind", rename_all = "snake_case")]). On next session restore, these records failed to deserialize with "missing field 'kind'", falling back to empty — causing silent context loss for compacted messages.serde_json::json!({"Summary": ...})withMessagePart::Summary { text: summary.clone() }so the correct{"kind":"summary","text":"..."}format is written.apply_tool_pair_summaries, correct JSON key assertion inprovider.rs, and a negative test documenting that old externally-tagged records cannot be deserialized (known limitation — requires a DB migration for pre-fix records).Test plan
cargo +nightly fmt --checkpassescargo clippy --workspace --features full -- -D warnings— 0 warningscargo nextest run --workspace --features full --lib --bins— 6779/6779 passedCloses #2257