anomalyco / anomalyco/opencode

bug: scroll position lost when navigating between parent and child sessions in web app

Open
#42,806 0 comments 0 reactions 1 assignee View on GitHub

@Brendonovich is already working on this.

Since Aug 15, 2026.

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

Description

Description

When navigating between parent and child sessions in the web app, the scroll position is always lost. This affects two scenarios:

  1. "Back to main session" click: When viewing a subagent/child session and clicking "Back to main session" in the composer area, the parent session scrolls to the bottom instead of restoring the position the user was at before they clicked into the child session.

  2. Breadcrumb parent title click: Clicking the parent session title in the timeline header breadcrumb has the same behavior — it scrolls to the bottom of the parent session.

Both navigation paths use navigate() to route to the parent session URL, and the newly mounted session always calls autoScroll.resume() which forces a scroll to the bottom.

Steps to reproduce
  1. Open a session with a long conversation (multiple messages)
  2. Scroll to a specific message mid-way through the conversation
  3. Click a subagent task card to navigate into a child session
  4. In the child session, click "Back to main session" (or the parent breadcrumb title)
  5. Observe: the parent session scrolls to the bottom instead of returning to the position you were at
Root cause

The timelineCache in message-timeline.tsx saves measurements and tool open state per session key, but does not save the scroll offset. When the session remounts, there is no saved position to restore, and the shouldAnchorBottom() logic kicks in, scrolling to the end.

Additionally, window.history.scrollRestoration is explicitly set to "manual" in use-session-hash-scroll.ts, so the browser's native scroll restoration is disabled.

Platform

Web app (http://localhost:4444)

OpenCode version

dev (current HEAD)

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.