anomalyco / anomalyco/opencode
bug: scroll position lost when navigating between parent and child sessions in web app
@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:
-
"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.
-
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
- Open a session with a long conversation (multiple messages)
- Scroll to a specific message mid-way through the conversation
- Click a subagent task card to navigate into a child session
- In the child session, click "Back to main session" (or the parent breadcrumb title)
- 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
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.