Saved session label (/save) lost after resume + new prompt
Bug
/save [label] writes saved: true and save_label into the session's own JSON file (~/.jcode/sessions/<id>.json). But the session picker reads a separate local index cache (~/.jcode/session-metadata-v1.sqlite3, table recent_sessions), not the session JSON directly.
When a saved session is resumed and a new prompt is sent, the sqlite cache row for that session gets refreshed (updated_at_ms bumps) but the saved flag is not carried over from the JSON file — it resets to 0 in the cache. The label becomes invisible in /resume's saved section even though the underlying session JSON still has saved: true and the correct save_label.
Repro
- In a session, run
/save my-label. - Confirm it shows up under the saved section in
/resume. - Resume that session, send any new chat prompt.
- Open
/resumeagain — the session no longer appears as saved.
Confirmed on my machine
- Session
session_hedgehog_...JSON file:saved: true,save_label: "DC 2nd Shop Auth". - Same session's row in
session-metadata-v1.sqlite3recent_sessionstable:saved = 0, withupdated_at_msnewer than the save itself. - Zero rows in the sqlite cache currently have
saved = 1, despite at least one session's JSON havingsaved: true.
Expected
The metadata cache writer should preserve saved/save_label on every session update (e.g. after each new prompt), not only at the moment /save is run, so bookmarked sessions stay discoverable in the resume picker across the session's lifetime.
Environment
- Jcode v0.81.2-dev (8e7b304)
- macOS, aarch64
Source: 1jehuang/jcode