Skip to content

fix(session-menu): hydrate unread and preferences from boot packet on setup and menu open - #1996

Merged
Hona merged 1 commit into
devfrom
fix/session-menu-startup-hydrate
Dec 1, 2026
Merged

Hona merged 1 commit into
devfrom
fix/session-menu-startup-hydrate

Conversation

@Hona

@Hona Hona commented Dec 1, 2026

Copy link
Copy Markdown
Member

Fixes #1977

Summary

  • Hydrate manual unread marks (notification.manual-unread) and per-session preferences (session.preferences) immediately from the in-memory boot packet (opencode.global.dat is already in BOOT_NAMESPACES), removing the boot_ready() / stage-B delay that left Menus::unread_generation == 0 on first launch and in new windows (Ctrl+Shift+N).
  • Convert unread::State and preferences::State to explicit four-state machines (Waiting → Booted / BootedDirty → Ready) so first-frame context menus show Mark as unread / Mark as read and accurate Mute / Unmute state immediately, edits made before SQLite stage B completes are queued instead of silently dropped, and stage-B reconciliation updates without clobbering live edits or triggering redundant redraws.
  • Register session_menu.hydrate during window setup (before Frame 1) and call session_menu::hydrate before building session context menus in features/session-menu, Recent, Pinned Area, Inbox, Sidebar Sections, and the session-menu story.

Investigation notes on self-dismissal in #1977

  • Audited every popup::close / popup::dismiss call site across crates/opencode-ui/src/popup, features/session-menu, and apps/desktop: background hydration (INGEST_HYDRATE, unread::poll, preferences::poll, launch::poll, apply_first) never closes an open session context menu.
  • In the attached recording, the initial 8-row menu was opened on the second row (computer use), which shows an active busy spinner (busy sessions intentionally omit Mark as unread); moving to the third row (Clash VPS, idle) and clicking outside dismissed the first menu via popup-scrim, and the subsequent right-click opened the 9-row menu for Clash VPS.

Verification

  • pwsh scripts/guardrails.ps1 — 11/11 passed
  • cargo check -p opencode-feature-session-menu -p opencode-desktop — passed
  • cargo clippy -p opencode-feature-session-menu --no-deps -- -D warnings — passed (zero diagnostics; zero new diagnostics in touched opencode-desktop files)
  • Not verified in a live Windows/macOS/Linux GUI window locally (let CI cover cross-platform builds).

Copilot AI balanced review requested due to automatic review settings December 1, 2026 10:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@Hona
Hona merged commit 7a778fb into dev Dec 1, 2026
8 checks passed
@Hona
Hona deleted the fix/session-menu-startup-hydrate branch December 1, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants