anomalyco / anomalyco/opencode

web: deleted session still appears in home list after browser back navigation

Open
#49,419 0 comments 0 reactions 1 assignee View on GitHub

@Brendonovich is already working on this.

Since Sep 16, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Summary

Deleting a session in the web UI leaves the deleted session visible in the home session list when navigating back. The list appears stale until a hard reload or until the TanStack query goes stale/refetches.

Environment

  • opencode version: 2.0.3
  • OS: Linux 7.2.3-arch1-3 (linux x64)
  • Terminal: TERM=xterm-256color
  • Shell: /usr/bin/fish
  • Install/channel: latest
  • Active plugins: local MCPs configured (claude, chrome, dune, ekubo, workspace-mcp, vfat, v12, ekubo_wallet, alchemy, rentcast); no UI plugin overriding sessions

Reproduction

  1. Open web UI, open a session from the home list.
  2. Delete that session from the session view.
  3. Hit browser back to return to the home session list.
  4. The just-deleted session is still listed. Clicking it fails/errors instead of showing not-found.

Expected Behavior

After delete, back-navigation to the home list should not show the deleted session. If a stale ID is visited directly, the UI should show a graceful “session not found” state and drop the reference, not a global error or a ghost row.

Actual Behavior

Deleted session persists in the home list on back navigation. Likely cache is not invalidated on the delete path, so the stale entry renders until refetch.

Additional Context

Code pointers from anomalyco/opencode@dev:

  • packages/app/src/pages/session/timeline/message-timeline.tsx:817deleteSession removes from sync().data.session, evicts, and calls notifySessionTabsRemoved, but unlike the archive path it never calls serverSync().homeSessions.remove(...).
  • Compare archive path: packages/app/src/pages/session/session-archive.ts:61 and packages/app/src/pages/home/home-sessions-controller.tsx:229 both call homeSessions().remove(session.id).
  • Home list query in packages/app/src/pages/home/home-sessions-controller.tsx:61 uses staleTime: 30_000 with refetchOnMount: true; browser back may restore without remount/refetch, exposing the stale index entry. createHomeSessionIndexCache.remove exists in packages/app/src/context/global-sync/home-session-index.ts:121.
  • Related but distinct: #47683 covers deleted-session refs outliving deletion (address bar gated on params.dir in packages/app/src/context/tabs.tsx:310, recent-tab pointer, persisted handoff, global ErrorBoundary). #42538 covers slow/hung deletion with ghost sessions on desktop. This issue is specifically the home-list stale entry on back navigation after a successful delete.

Suggested fix: reduce staleTime significantly in packages/app/src/pages/home/home-sessions-controller.tsx:78 (currently 30_000) — e.g. to 05_000 — plus refetchOnWindowFocus / pageshow refetch so back navigation cannot render a 30s-stale list. Showing a brief loading state is better than showing a stale list with a ghost deleted session. Also call homeSessions.remove() on the delete path (see below) so the entry is gone even before refetch.

Workaround: hard reload the home page after deleting.

Contributor guide

Open the contributing guide

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.