← Back to Pull requests

Sessions: deleting the open chat opens the next one listed (fixes #427) #463

Closed
unknown closed this pull request without merging on Nov 20, 2026 21:41 UTC
View on GitHub
unknown unknown commented on Nov 20, 2026 19:12 UTC
Author

What and why

When you deleted the chat you were in, Kyllene put you on a new empty chat. Most chat apps open the next chat in the list, and now Kyllene does too.

Deleting the open chat, from the sidebar or from the chat's ⋯ options, now opens the chat listed after it in the list you're looking at. If it was the last row, the one before it opens. A new chat starts only when no other chat is listed.

Fixes #427

How

  • neighbourAfterRemoving (next to stepChat in Shortcuts.kt) chooses which row replaces the deleted one.

  • The sidebar keeps a ShownChats holder up to date with the rows it shows, top to bottom. The chat options menu reads the same holder, so both delete paths use the same order.

  • The neighbour is picked before SessionsViewModel.delete, because the delete removes the row from the list straight away.

  • App.kt opens the neighbour with openSession, carrying the "New messages" read point. If there is no neighbour, it calls newChat() as before.
  • Each view

  • Recent: Threads, then Pinned, then the rest, the way the sidebar shows them. The attention filter (Running, Needs you) and folded Threads and Pinned sections apply too.

  • A project: that project's list.

  • Archived: the archived list, pinned first, as shown.

  • Search with results: the results, pinned first, as shown.

  • Views with no chat list: the Bots side, and a phone's search before anything is typed, use the Recent order.

  • A chat the current view doesn't list: for example, deleting it from ⋯ while the sidebar shows Archived, or while the attention filter hides it. A new chat opens, as before, rather than a guessed neighbour.
  • If the delete fails

    The neighbour has already opened by the time the gateway answers. If the delete then fails, the existing rollback puts the deleted chat back in the list and shows the error, and the user stays in the neighbour, which is a working chat. I kept this simple: no jumping back, and nothing is left half-open.

    How I tested it

  • New unit tests in DesktopUxTest:

  • - aRemovedRowHandsOverToTheNextOrThePrevious: a middle row, the first, the last, the only row, a row that isn't in the list, an empty list.
    - aDeletedChatOpensTheOneListedInItsPlace: ShownChats.after before the sidebar has reported, the next and previous rows, a chat not listed, the only chat.
  • Full CI command from CONTRIBUTING, plus :desktopApp:compileKotlinJvm: passes, with no test failures. I ran it with --no-daemon, and with the stray " stripped from this machine's PATH (the known Windows problem in CONTRIBUTING).

  • Emulator: the Dev build against a throwaway local hermes-agent v0.23.0 gateway with a fake model, using test chats only.

  • - With chat B open and C listed under it, deleting B from the sidebar opened C, and C was highlighted.
    - Deleting C from the ⋯ menu opened the next chat in the list.

    Not checked on a device:

  • The last-row case (the previous row opens) and the Archived, project and search views. The unit tests cover the helper, but the code that builds each view's list wasn't run on a device.

  • A failed delete.

  • The desktop app was compiled but not run.
  • Review fixes

    A review of this PR found four cases, fixed in two follow-up commits:

  • Desktop: a chat that has a window of its own is skipped, so the neighbour never opens in two windows. The chat after it opens, or a new chat when the rest all have windows.

  • A search left open in a closed sidebar no longer picks the neighbour. On a phone, searching, swiping the drawer shut and then deleting from ⋯ opened the nearest search hit; now the Recent order decides. The same holds for results a closed search left behind on the Bots side.

  • A thread whose chat was compressed: its row carries a later id than the open chat. It is now matched by lineage, so its neighbour opens and not a new chat.

  • ListFocus has its doc comment back.
  • The list the neighbour comes from is now chatsInView, a plain function, with ChatsInViewTest covering each view (Recent, another filter, search with and without results, a closed sidebar, the Bots side, windowed chats, a thread's later id).

    Checked on the emulator against the throwaway gateway: the closed-drawer search case failed on the first commit (the search hit opened) and passes now (the next chat in Recent opens). Deleting the last row opens the one before it. Deleting a chat that isn't open leaves the open chat alone. The desktop cases are covered by unit tests only; the desktop app was compiled, not run.

    Not changed: after a failed delete the user stays in the neighbour, and the end of the loaded page counts as the end of the list.

    Reviewed with a Gemini loop: 1 round with gemini-4-neon-high. Verdict: approved.

    Created with Claude Opus 5.5 in Claude Code.

    Diff: 603 lines (+452 / -151) across 7 files Reviewer: Giton22 Review duration: 148m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 603 lines diff across 7 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.383
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #463"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 50.1% (MEDIUM) · Higher = larger blast radius
    50.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.8% · Safe to merge
    19.8%