Ctrl+R can delete the wrong turn's citations and the wrong message

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

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli

Research direction

Start in src/chatty/ui/app.py, especially ChatApp.action_regenerate around lines 436–475, and trace how augment updates the RAG turn counter and how turn widgets are added to the chat log. Check the Ctrl+R behavior for turns with and without citations and for a system line after a reply. Done means regeneration only removes that assistant turn’s widgets and reverses its counter change.

Written by the indexing model from the issue text.

Description

area: rag area: sessions bug wrong-result

ChatApp.action_regenerate (src/chatty/ui/app.py:436) assumes the last response produced citations and is the last message on screen:

  • it removes the last CitationsWidget in the chat log (line 468), whichever turn it belongs to;
  • it removes the last MessageWidget (line 471), whatever its role;
  • it decrements the RAG turn counter (line 475), but augment only increments it when chunks were found.

Effect:

  • Turn 1 has sources, turn 2 found no chunks, then Ctrl+R: turn 1's citation list is deleted, and the counter drops from 1 to 0, so the regenerated answer reuses turn 1's [1.N] numbers.
  • If a system line follows the reply (for example Session saved: ... after Ctrl+S), Ctrl+R removes that line and leaves the old assistant reply on screen, while the conversation no longer contains it.

Fix: record, per assistant turn, whether it added citations and incremented the counter, and undo only that. Remove the specific widgets that belong to the turn instead of "the last one".

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.