Loading a session doesn't reset RAG state: citation numbers clash and the old shortlist is reused

Open
#8 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

Research direction

Read src/chatty/ui/session_handlers.py, especially handle_session_load at line 112 and load_session_file at line 33, and compare their reset behavior with action_new_session. Trace how loaded history represents assistant turns and citations; saved sessions lack citation metadata, so the issue leaves that counter choice open. Done means both load paths reset the RAG shortlist and initialize the turn counter consistently, preventing citation clashes and reuse of another session’s papers.

Written by the indexing model from the issue text.

Description

area: rag area: sessions bug wrong-result

LitkitProvider keeps per-conversation state: _turn_number (for [T.N] citation numbers) and _last_paper_ids (the cached shortlist). action_new_session calls rag_provider.reset(), but the two session-load paths don't:

  • handle_session_load (src/chatty/ui/session_handlers.py:112, Ctrl+L)
  • load_session_file (src/chatty/ui/session_handlers.py:33, chatty chat --session FILE)

Effect:

  • Starting chatty with --session on a conversation that already cites [1.1] to [3.5] numbers the next retrieval as turn 1 again, so new [1.N] citations clash with old ones in the same conversation. Avoiding that ambiguity is the reason [T.N] numbering exists.
  • Loading session B after session A keeps A's turn counter and paper shortlist. B's first follow-up question searches A's papers (see also #7).

Fix: call rag_provider.reset() on every load, and set the turn counter from the loaded history (the highest T cited, or the number of assistant turns). Saved sessions don't store citation metadata, so decide which of those to use.

Dominant language
Python
Stars
0
Forks
2
Avg merge
1d 4h
Merged PRs (30d)
13

Getting set up

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 lanl/chatty

All issues in lanl/chatty

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.