Skip to content

Commit d064bdf

Browse files
committed
docs(forklog): record keeping a scrolled-up reader's place in a long session
New feature and session records for 6ff168d, which re-anchors the session transcript after every layout so the 100-message prune no longer slides a scrolled-up view. Upstream PR anomalyco#53219 closes the existing issue anomalyco#41243. The stream-throttle feature gets a re-verified timeline entry. AI-Tool: opencode 1.18.33-vt-60-2fa3363c92 AI-Model: anthropic/claude-opus-5-5 AI-Variant: high AI-Platform: linux AI-Harness: Vibeterm 3ae7f02 AI-Session-ID: ses_ef81ca107ffet5DwnFLaGWlUap
1 parent dc68262 commit d064bdf

4 files changed

Lines changed: 199 additions & 0 deletions

File tree

‎.vibeterm/forklog/README.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,15 @@ carries every feature forward unchanged. That commit includes the full
4747
- [Per-turn completion time and duration in the TUI](./features/2026-10-04-tui-turn-timing.md)
4848
- [Pin the session title at the top of the sidebar](./features/2026-10-04-sidebar-pin-title.md)
4949
- [Compact sidebar Context display](./features/2026-10-04-sidebar-context-compact.md)
50+
- [Keep a scrolled-up reader's place in a long session](./features/2026-10-04-scroll-anchor.md)
5051

5152
## Session records
5253

54+
- [2026-10-04 `ses_ef81ca107ffet5DwnFLaGWlUap`](./sessions/2026-10-04-scroll-anchor.md)
55+
- Stop new AI output from sliding a scrolled-up transcript in sessions past
56+
100 messages; upstream PR #53219 closing #41243; build and install on
57+
desktop and m4max.
58+
5359
- [2026-10-04 `ses_f01c05e81ffeH39PdmzetO2pyw`](./sessions/2026-10-04-llm-test-models-read.md)
5460
- Fix `llm.test.ts`'s mock queue, which `openai`'s served-model read
5561
consumed after the `v1.18.34` rebase; no build.

‎.vibeterm/forklog/features/2026-08-25-tui-stream-throttle.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ evening-to-early-morning convention does not move this work to August 24.
8282
- 2026-10-04 [`ses_ef81db9cdffe5vRz7Y2HqCmvNs`](../sessions/2026-10-04-upstream-1.18.34.md) -
8383
rebased unchanged onto upstream `dev`
8484
`907b3bc518` (contains `v1.18.34`). Evidence: that session's gates.
85+
- 2026-10-04 [`ses_ef81ca107ffet5DwnFLaGWlUap`](../sessions/2026-10-04-scroll-anchor.md) -
86+
unchanged; it does not interact with the scrolled-up drift, which comes
87+
from the 100-message prune. Evidence: the installed
88+
`1.18.34-vt-61-907b3bc518` held a scrolled-up view through a streamed
89+
agent run, the same as vanilla `dev`.
8590

8691
## Current maintenance notes
8792

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Keep a scrolled-up reader's place in a long session
2+
3+
## Identity
4+
5+
- Status: active
6+
- Integration branch: `dev-nowaker`
7+
- Development branch(es): `fix-scroll-follow` (off upstream `dev` `907b3bc518`; also the upstream PR head)
8+
- First local commit: `6ff168d896`
9+
- Current local commit(s): `6ff168d896`
10+
- Upstream base when introduced: `907b3bc518` (upstream `dev`, contains `v1.18.34`)
11+
- Last checked against upstream: `907b3bc518` (upstream `dev`)
12+
- Upstream: existing issue [#41243](https://github.com/anomalyco/opencode/issues/41243)
13+
(root cause of #29094 / #4196), PR [#53219](https://github.com/anomalyco/opencode/pull/53219)
14+
15+
## Original request
16+
17+
Relayed by coordinator `ses_ef8235798ffejGr4sa22eXmVNv`, quoting the user:
18+
19+
> when i scroll up in chat log, and stay there, so i can read, ai activity
20+
> constantly interrupts me, and scrolls the content down as it generates
21+
> responses. this is a clear bug, needs a fix.
22+
23+
## Goals
24+
25+
- While scrolled up, new and streaming AI output does not move the viewport.
26+
- At the bottom, the transcript keeps following the stream; `End` and
27+
scrolling back down resume following.
28+
29+
## Non-goals
30+
31+
- Scrolling on prompt submit is
32+
[Keep the scroll position when a prompt is submitted](./2026-10-04-keep-scroll-on-submit.md).
33+
- No setting: this is a bug fix.
34+
35+
## Rationale and constraints
36+
37+
- Sticky scroll is not the cause. In sessions under 100 messages, wheel,
38+
PageUp and line-up already hold on vanilla `dev`, both while streaming and
39+
through tool calls.
40+
- The cause is `context/sync.tsx`, which keeps at most 100 messages per
41+
session and `shift()`s the oldest on every new one. Each drop removes rows
42+
above the viewport under a fixed `scrollTop`, so the text slides up until it
43+
reaches the bottom, where sticky scroll re-engages.
44+
- The fix measures the layout change instead of predicting the pruned height
45+
(the approach of upstream PR #41247, auto-closed without review). It needs no
46+
`id` on assistant message boxes, and it covers any height change above the
47+
viewport.
48+
- The root renderable emits `layout-changed` after computing the layout and
49+
before any renderable reads it. `ScrollBox` content's own `resize` fires too
50+
late in the frame: the test showed the drift with that hook.
51+
- The TUI streaming render throttle does not interact: it only lowers how often
52+
frames, and so this check, run.
53+
54+
## Changes
55+
56+
| Commit | Workday | Change | Stable seam |
57+
|---|---|---|---|
58+
| `6ff168d896` | 2026-10-04 | Re-anchor the first visible transcript child after every layout while not at the bottom | `keepScrollAnchor()` in `packages/tui/src/util/scroll.ts`; its call in the session `<scrollbox ref>` in `packages/tui/src/routes/session/index.tsx`; `packages/tui/test/util/scroll.test.tsx` |
59+
60+
## Verification
61+
62+
- `bun test test/util/scroll.test.tsx` in `packages/tui`: 2 pass. With the
63+
hook disabled, the anchor test fails (`item 25` expected, `item 28`
64+
received).
65+
- `bun test` in `packages/tui` on `dev-nowaker` + the fix: 219 pass, 1 skip,
66+
0 fail; `bun typecheck` passes.
67+
- Manual surface (isolated XDG dirs, tmux socket `oc-tui-scroll`, local fake
68+
OpenAI-compatible server streaming markdown, reasoning and a bash tool call
69+
per step, session past 100 messages): on vanilla `dev` the scrolled-up view
70+
slid from `Step 96` to `Step 101` in 20 s. With the fix it stayed at
71+
`Step 586 closing` / `Step 587 bullet two` for 40 s, and `End` resumed
72+
following at `Step 596`.
73+
74+
## Timeline
75+
76+
- 2026-10-04
77+
[`ses_ef81ca107ffet5DwnFLaGWlUap`](../sessions/2026-10-04-scroll-anchor.md)
78+
- `6ff168d896`: introduce; upstream PR #53219 closing #41243; build and
79+
install on desktop and m4max.
80+
81+
## Current maintenance notes
82+
83+
- Drop the fork commit once PR #53219 (or an equivalent fix for #41243) is in
84+
upstream `dev`.
85+
- If upstream removes or changes the 100-message prune in `context/sync.tsx`,
86+
keep the anchor anyway: it covers any height change above the viewport.
87+
88+
### Upstream integration checklist
89+
90+
- The session transcript `<scrollbox>` ref still calls
91+
`keepScrollAnchor(renderer, r)`.
92+
- `@opentui/core` still emits `layout-changed` from `RootRenderable` after
93+
`calculateLayout()` and before `updateLayout()`. Run
94+
`test/util/scroll.test.tsx` after every opentui bump.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Keep a scrolled-up reader's place in a long session
2+
3+
## Identity
4+
5+
- Workday: 2026-10-04
6+
- Session: `ses_ef81ca107ffet5DwnFLaGWlUap`
7+
- Agent/platform: `Sisyphus - ultraworker` on `anthropic/claude-opus-5-5` (variant high) / linux, Vibeterm
8+
- Repository: `~/projekty/webapps/opencode`
9+
- Integration branch: `dev-nowaker`
10+
- Development branch(es): `fix-scroll-follow` (worktree under `.vibeterm/worktrees/`, off upstream `dev` `907b3bc518`)
11+
- Upstream base: `907b3bc518` (upstream `dev`, contains `v1.18.34`); unchanged
12+
- Source result commit(s): `6ff168d896` (cherry-pick of `ecfa7cb318` on `fix-scroll-follow`)
13+
- Forklog commit: this file's introducing commit
14+
15+
## User requests
16+
17+
Spawned by coordinator `ses_ef8235798ffejGr4sa22eXmVNv` (item 1 of "opencode
18+
TUI improvements"), quoting the user:
19+
20+
> when i scroll up in chat log, and stay there, so i can read, ai activity
21+
> constantly interrupts me, and scrolls the content down as it generates
22+
> responses. this is a clear bug, needs a fix.
23+
24+
## Goals
25+
26+
- Reproduce on vanilla `dev`, fix it, open an upstream PR, land on
27+
`dev-nowaker`, and build both hosts.
28+
29+
## Constraints and non-goals
30+
31+
- Submit-time scrolling is item 2, another session.
32+
- No TUI tab, vibeterm tmux server or `opencode-serve-*` unit restarted.
33+
34+
## Branch and upstream movement
35+
36+
| Repository | Branch | Before | After | Action |
37+
|---|---|---|---|---|
38+
| `opencode` (GitHub fork + GitLab) | `fix-scroll-follow` | - | `ecfa7cb318` | new branch off upstream `dev` `907b3bc518`; head of PR #53219 |
39+
| `opencode` | `dev-nowaker` | `0b0357e848` | `6ff168d896` | cherry-pick, fast-forward; pushed to `origin` and `nowaker-github` |
40+
| `opencode` (m4max) | `dev-nowaker` | `0b0357e848` | `6ff168d896` | fast-forward from `origin` |
41+
42+
## Features touched
43+
44+
| Feature | Outcome | Evidence |
45+
|---|---|---|
46+
| [Keep a scrolled-up reader's place in a long session](../features/2026-10-04-scroll-anchor.md) | introduced | regression test fails without the fix; isolated TUI before/after samples |
47+
| [TUI streaming render throttle](../features/2026-08-25-tui-stream-throttle.md) | re-verified, unchanged | installed fork binary held a scrolled-up view through a streamed agent run under 100 messages, same as vanilla |
48+
49+
## Other delivered work
50+
51+
- No new upstream issue. Searching for "scroll jumps while streaming",
52+
"scrolled up auto scroll", "scroll position long session",
53+
"auto-scroll interrupts reading" and "sticky scroll" found open issue
54+
#41243. It records the same root cause; its PR #41247 was closed by
55+
`automated-pr-cleanup` on 2026-09-08 without review. PR #53219 closes
56+
#41243.
57+
58+
## Verification
59+
60+
- Vanilla `dev` from source, TUI in tmux socket `oc-tui-scroll`, isolated XDG
61+
dirs, local fake OpenAI-compatible servers in the worktree's `tmp/`:
62+
- under 100 messages, plain text, then a multi-step agent run with
63+
reasoning and bash tool calls: wheel, PageUp and line-up hold for 8-20 s
64+
while the stream continues; `End` shows the stream moved on;
65+
- a session past 100 messages, token-sized markdown: the scrolled-up view
66+
slides from `Step 96` to `Step 101` in 20 s;
67+
- instrumented run: `scrollTop` and the manual-scroll flag stay fixed while
68+
the first child's offset jumps by its height on every prune.
69+
- Fix from source, same session past 100 messages: view stays at
70+
`Step 586 closing` / `Step 587 bullet two` for 40 s; `End` resumes
71+
following at `Step 596`.
72+
- `packages/tui`: `bun test test/util/scroll.test.tsx` 2 pass (anchor test
73+
fails with the hook disabled); full `bun test` on `dev-nowaker` + fix:
74+
219 pass, 1 skip, 0 fail; `bun typecheck` passes. On upstream `dev` the full
75+
suite had one failure in `DiffViewerFileTree`, which passed twice alone.
76+
77+
## Build and install
78+
79+
- Build command: `.vibeterm/build.sh` in each host's primary checkout.
80+
- Installed artifact: desktop and m4max both `1.18.34-vt-78-907b3bc518`,
81+
built at `6ff168d896`; desktop inode `49955453`. Both binaries contain the
82+
`layout-changed` anchor and the retry-header marker.
83+
- Running services: none restarted on either host; running TUIs pick up the
84+
build only after their own restart.
85+
86+
## Commit provenance
87+
88+
- `6ff168d896` - fix and regression test.
89+
- Required trailer: `AI-Session-ID: ses_ef81ca107ffet5DwnFLaGWlUap`
90+
91+
## Unknowns and blocked verification
92+
93+
- The installed binaries were not driven in a session past 100 messages; the
94+
source build was.

0 commit comments

Comments
 (0)