Skip to content

Treat unreadable TUI session JSON as non-empty so GC cannot drop it - #350

Merged
tylerreckart merged 3 commits into
mainfrom
fix/session-json-parse-error-not-empty
Sep 21, 2026
Merged

tylerreckart merged 3 commits into
mainfrom
fix/session-json-parse-error-not-empty

Conversation

@cursor

@cursor cursor Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

session_json_is_empty treated a json_parse throw (and a non-object blob) as an empty transcript. Untitled conversations older than 24h were then hard-deleted on store open, and create_or_reuse reused the row and overwrote the stored session.

Fail closed: only an empty string or a JSON object with empty index / agents counts as empty. Truncated or non-object session JSON is kept. Canonical empty objects still reuse; 24h empty Untitled rows still GC.

unit_conversation_store 27/27 locally (+ ASan, 120 assertions). arbiter compiles.

merge-tree vs main: CLEAN. vs #321–#349: CLEAN (including CHANGELOG this run). Isolated to conversation_store.cpp / its existing test file.

Open in Web View Automation 

Note

Low Risk
Localized change to empty-session detection in ConversationStore with regression tests; reduces risk of accidental data loss rather than introducing new behavior paths.

Overview
Unreadable TUI session blobs are no longer treated as empty transcripts. session_json_is_empty now fails closed: JSON parse errors and non-object shapes return non-empty, so only a blank string or a v2 object with empty index / agents counts as empty.

That stops 24h Untitled GC from hard-deleting conversations whose session JSON is truncated or corrupt, and stops create_or_reuse from reusing the active row and overwriting the stored blob. Canonical empty sessions still reuse; truly empty stale Untitled rows still GC.

CHANGELOG updated; unit_conversation_store adds coverage for corrupt JSON, array-shaped sessions, and GC behavior.

Reviewed by Cursor Bugbot for commit 918c0d4. Bugbot is set up for automated code reviews on this repo. Configure here.

session_json_is_empty treated json_parse failures (and non-object
blobs) as empty transcripts, so Untitled 24h GC hard-deleted them and
create_or_reuse overwrote the stored session. Fail closed: only a
true empty object (or empty string) is empty.

Co-authored-by: Tyler Reckart <tylerreckart@users.noreply.github.com>
…e-error-not-empty

# Conflicts:
#	CHANGELOG.md
@tylerreckart
tylerreckart marked this pull request as ready for review September 21, 2026 12:58
@tylerreckart
tylerreckart enabled auto-merge (squash) September 21, 2026 12:58
…e-error-not-empty

# Conflicts:
#	CHANGELOG.md
@tylerreckart
tylerreckart merged commit fea1e04 into main Sep 21, 2026
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