Skip to content

Recent sidebar: first context menu after a window starts lacks Mark as unread and closes itself a second later #1977

Done

Description

@ausyeah

Build: OpenCode (Rune) desktop 0.0.0-dev-517, Windows 11. Sidebar layout: Settings › Experimental › Organize vertical sidebar → Recent.

Steps

  1. Open a window and right-click a session under 最近 while the window is still doing its first load — right after starting the app, or in a new window (Ctrl+Shift+N).
  2. Leave the pointer where it is.

Actual

  • The first menu is missing the mark read/unread row: Rename, Pin, Mute, Hide, Copy ▸, Export…, Archive, Delete… (8 rows). There is no 标记为未读 / Mark as unread.
  • About a second later the menu fades out on its own. In the recording the pointer comes to rest at ~0.7 s and the menu is gone by 1.4 s.
  • Right-clicking again gives the full menu, now with 标记为未读 (9 rows), and it stays open.

Recording (3.9 s, phone capture of the monitor): screen-recording.mp4

0.0 s — menu open, 8 rows 1.5 s — menu gone, pointer still 3.0 s — reopened, 9 rows

Notes

  • The mark read/unread row is gated on Menus::unread_generation != 0 (features/session-menu/src/lib.rs, read_item); that generation is set by unread::poll only after the checkout booted and storage is ready (features/session-menu/src/unread.rs), which is scheduled in INGEST_HYDRATE (apps/desktop/src/session/menu.rs, session_menu.unread). A menu opened before that first poll is built from unhydrated state — exactly the difference between the two menus in the recording.
  • The dismissal happens as that state finishes loading. The drawn popup otherwise closes on an outside press, a key, a pick or an explicit dismiss (crates/opencode-ui/src/popup/state.rs), so the rebuild that runs at that moment is worth checking.
  • The second menu is ~55 px lower only because the right-click point moved down between the two opens; it is the same row.

Expected

Either build the menu once its state is ready, or keep the open menu and let the missing row appear when it loads. It should not close while the pointer is still.

Activity

  1. Hona commented on Dec 1, 2026

    @Hona
    Member

    Fixed in #1996 (7a778fba).

    • Immediate unread & preference hydration: unread and preferences in features/session-menu now hydrate before Frame 1 during window setup (and eagerly before building any session context menu) directly from the in-memory boot packet (opencode.global.dat is already in BOOT_NAMESPACES), then reconcile cleanly when SQLite stage B finishes. First context menus after launch and in new windows (Ctrl+Shift+N) now include Mark as unread / Mark as read and accurate Mute / Unmute state right away instead of waiting for boot_ready() and INGEST_HYDRATE.
    • Self-dismissal audit: Every popup::close / popup::dismiss call site was checked — background hydration and sidebar/session refreshes do not dismiss open context menus. Note also that in the recording, the first 8-row menu was opened on the busy computer use row (busy sessions intentionally omit Mark as unread), and clicking on the idle Clash VPS row dismissed that first menu via popup-scrim before the next right-click opened the 9-row menu for Clash VPS.

    Verified locally: pwsh scripts/guardrails.ps1 (11/11), cargo check -p opencode-feature-session-menu -p opencode-desktop, and cargo clippy -p opencode-feature-session-menu --no-deps -- -D warnings. Not verified locally: live Windows/macOS/Linux GUI window interaction.

    Please reopen if you still see a missing row or unexpected dismissal on a build containing 7a778fba.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions