Skip to content

Keep side panels across model switches and expose session history #1948

Open

Description

@anateus

Switching models can hide the open side panel even though its document is still stored and marked focused. I reproduced this with an isolated native TUI: the panel was visible before the switch, absent from the rendered frame afterward, and still present in the session's panel inventory.

The model-catalog response reuses History with a default empty panel snapshot. The TUI applies that snapshot as document state, even though the response only refreshes model metadata. There are related recovery gaps: local Markdown links aren't registered durably, selection and viewport can reset on reload, linked-file errors replace readable content, and tool close deletes rather than archives the document.

Expected behavior:

  • Model switches and catalog refreshes retain the document, visibility, selection, and viewport.
  • Reconnect and reload retain the last usable same-session state. A read error is shown as unavailable or potentially outdated, not treated as an empty inventory.
  • Linked Markdown and PDF panels keep their last successfully loaded content when the source fails, with an explicit retry action and an honest freshness indicator.
  • /panels provides searchable recent history for the current session, including archived documents that can be reopened.
  • UI dismissal hides the pane. Tool close archives the document. Permanent deletion requires an explicit purge and never removes an external linked source.
  • History and inactive body caches are bounded. Delayed or mismatched-session snapshots cannot overwrite current state.
  • Ctrl+R recovery carries retained documents with provenance, while /clear still starts a genuinely empty new session.

Regression coverage should exercise the real model-change/catalog sequence, source failure and recovery, archive/reopen/purge, per-client reload state, A/B/A session switching, and legacy/native/API wire compatibility.

Activity

  1. added
    bugSomething isn't working
    area: tuiTerminal user interface, rendering, and interactions.
    on Oct 24, 2026
  2. 1jehuang commented on Oct 24, 2026

    @1jehuang
    Owner

    Thanks for the detailed reproduction. PR #1949 is the candidate implementation. Retention across model changes is a bug, while archive/purge, freshness and per-client recovery add persistence and protocol decisions. Leaving this open for review of that PR and its real model-change/reconnect regression coverage rather than duplicating the implementation.


    Jcode agent (automated triage), on behalf of @1jehuang

  3. added
    needs-testsNeeds additional test coverage before merging.
    and removed on Oct 24, 2026
  4. 1jehuang commented on Oct 24, 2026

    @1jehuang
    Owner

    Following maintainer feedback, the proposed direction is reasonable: preserve panels across model/catalog changes, retain last-good linked content, and separate dismissal, archive and explicit purge. I have removed the product-decision label; the remaining gate is implementation review and validation of PR #1949, not whether this feature belongs.

    I checked current head 9534488. Linux/macOS CI and the quality guardrails passed. Windows CI failed in test_panel_image_preview_click_render_dismiss_and_restore at panel_image_preview.rs:49: "rendered image should have a click target" (129 passed, 1 failed in that cohort). Please resolve or establish the cause and obtain a passing Windows rerun before merge. The fixture embeds path.display() directly in a Markdown image destination, so Windows path handling is one investigation lead, not a confirmed root cause.

    The panel-state paths and regression coverage I inspected address catalog-only History, stale/session-mismatched snapshots, archive/reopen/purge, retained source failures and reload view state. This was a focused source/CI review, not an independent runtime reproduction or approval of all 153 changed files. No merge was performed.


    Jcode agent (automated triage), on behalf of @1jehuang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: tuiTerminal user interface, rendering, and interactions.bugSomething isn't workingneeds-testsNeeds additional test coverage before merging.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions