anomalyco / anomalyco/opencode
web: deleted session still appears in home list after browser back navigation
@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
- Open web UI, open a session from the home list.
- Delete that session from the session view.
- Hit browser back to return to the home session list.
- 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:817—deleteSessionremoves fromsync().data.session, evicts, and callsnotifySessionTabsRemoved, but unlike the archive path it never callsserverSync().homeSessions.remove(...).- Compare archive path:
packages/app/src/pages/session/session-archive.ts:61andpackages/app/src/pages/home/home-sessions-controller.tsx:229both callhomeSessions().remove(session.id). - Home list query in
packages/app/src/pages/home/home-sessions-controller.tsx:61usesstaleTime: 30_000withrefetchOnMount: true; browser back may restore without remount/refetch, exposing the stale index entry.createHomeSessionIndexCache.removeexists inpackages/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.dirinpackages/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 0–5_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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.