Repository navigation
fix(cpp): preserve serialized session content parts - #3658
Conversation
Request changesThe loader change is good work — saved sessions now keep image content in order instead of silently flattening it to text, and the tests around it are genuinely thorough. The problem is the other half of the reported bug: nothing in the shipped app ever writes an image into a session file, so a user still can't resume a vision conversation and keep the pictures. The agent deliberately drops image parts from its conversation history at the end of every turn ("text-only retention by contract"), and the REPL saves exactly that history when it exits. So after resuming a vision session and asking one question, the next save writes text-only again — the "saving the resumed session permanently loses that context" half of #3642 is still live. Either extend the fix to the save side (a real decision, since retaining base64 images across turns grows every subsequent request), or drop the Worth adding before merge: a run through the actual REPL — start a vision session, exit, resume, ask about the image — since that is the path where this gap shows up and where the unit tests can't reach. Real-world evidenceNo evidence bundle was produced for this PR ( 🔍 Technical details🟡 ImportantThe deserializer fix can't be reached by the product's own save path (
This is a scope/claim call, not a defect in the diff: either lift the stripping for persistence (and accept the per-turn base64 growth the contract was written to avoid), or re-scope the issue closure. The header doc at 🟢 MinorPart errors don't name the file they came from ( A Session list preview is blank for vision sessions ( Strengths
|
The round trip preserves image parts the caller supplies, but the agent's history is text-only by contract, so a session saved from it still reloads without images. Says so at save(), where an SDK reader would otherwise take the load() guarantee as end-to-end, and amd#3642 stays open for the retention decision — keeping base64 across turns grows every later request, which is what the stripping contract exists to avoid.
|
Took the second option — the claim is now scoped to what the diff does, and #3642 stays open for the retention decision. You were right that the two halves are separable, and the second one is a real trade rather than a follow-up chore: keeping image parts in the agent history means carrying base64 into every later request, which is exactly what the stripping contract was written to avoid. That deserves its own decision, not a quiet extension of a loader fix. So: Left alone: the 🟢 about part errors not naming their source file. It is a fair point, but I can't build the C++ target here — CMake fetches nlohmann/json, httplib and googletest over the network — so I would be pushing an unverified change to a surface whose tests I cannot run. Better as a follow-up by someone with the toolchain, or I can do it if you want it in this PR and are happy to let CI be the first compile. |
The C++
SessionStoresaved image-bearing messages but discarded their images on load, so anything that handed it multimodal history got text back. Its save/load round trip now preserves ordered text and image parts and rejects malformed ones, while legacy text and tool histories stay readable.This is the loader half of #3642, not the whole issue. The agent strips image parts from its own history at the end of every turn, so a session saved straight from
agent.history()still has no images in it to reload. Retaining them across turns means carrying base64 into every subsequent request, which is the trade the stripping contract was written to avoid — worth deciding on its own rather than inside this fix. #3642 stays open for that.Test plan