Saved session label (/save) lost after resume + new prompt

Open
#1,287 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
67/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
cli

Research direction

Start at the metadata cache writer that refreshes the recent_sessions row after a new prompt, then trace how /save stores saved and save_label in the session JSON and how /resume reads the cache. Done when a resumed saved session keeps its label and remains in the saved section after another prompt.

Written by the indexing model from the issue text.

Description

area: tui autonomous: no bug needs-tests triage: needs-decision

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

  1. In a session, run /save my-label.
  2. Confirm it shows up under the saved section in /resume.
  3. Resume that session, send any new chat prompt.
  4. Open /resume again — 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.sqlite3 recent_sessions table: saved = 0, with updated_at_ms newer than the save itself.
  • Zero rows in the sqlite cache currently have saved = 1, despite at least one session's JSON having saved: 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
Dominant language
Rust
Stars
19.9k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
30

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from 1jehuang/jcode

All issues in 1jehuang/jcode

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.