Skip to content

Keep the timeline attached when a navigation, resize or restore lands at the end - #6195

Merged
ymichael merged 2 commits into
mainfrom
bb/fix-thread-scroll-position-inconsistency-thr_nbqpibci7w
Oct 23, 2026
Merged

ymichael merged 2 commits into
mainfrom
bb/fix-thread-scroll-position-inconsistency-thr_nbqpibci7w

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

#5951 made ScrollPositionKeeper the only owner of the timeline's reading position. In doing so it changed when the timeline counts as following the bottom (attached). Before, any scroll that left the view within 4 px of the end attached it. Since #5951 only a reader scroll down into the end attaches it, or a wheel or End/PageDown while already at the end. Anything else that left the view at the end kept the reader detached: the jump-to-bottom arrow showed even at the very bottom, and new output was not followed. Each case below is a regression from #5951.

  • Opening an unread finished thread whose new reply fits on screen. The NEW-divider reveal goes through scrollTo, which always recorded a row anchor. Rows that settled taller a moment later left the view short of the end with the last lines clipped. The anchor was also saved, so the next visit restored to that row.
  • Window resizes near the end. This covers a taller window, a closed side panel, a phone rotated to portrait, and a dismissed keyboard. The viewport grew and the browser clamped to the end, but the keeper kept the anchor.
  • Restoring onto the end. A saved position that restored onto the end stayed detached.
  • Touch screens. On Android and touchscreen Chrome, dragging toward the end while already at the end moves nothing and fires no scroll event. The jump button was the only way back.
  • Saving the position. savedPosition() saved a row whenever the reader was detached, even while sitting at the end. Returning after more output landed above it.

What changed

All changes are in apps/app/src/components/ui/scroll-position-keeper.ts:

  • scrollTo attaches when it lands at the end, like revealElement already does.
  • A reconcile after a viewport resize (width or height), or one that completes a pending restore, attaches when the reading position's target is at or past the end.
  • A touch drag of at least 8 px toward the end attaches when the reader is already at the end, like a wheel or PageDown.
  • savedPosition() saves a reader who is at the end as at the bottom.

Kept from #5951: a detached reader whose content shrinks onto the end stays detached until they scroll toward it.

docs/timeline-pagination.md describes the new attach rules and the save rule.

Client only: no wire, CLI or plugin API change.

How you verified

  • Tests: 7 new tests in scroll-position-keeper.test.ts. Five fail without the fix: the navigation clamp, viewport growth, a touch drag at the end, saving while at the end, and a restore onto the end. Two guards pass either way: a navigation above the end stays detached, and viewport growth that still leaves the reader's row on screen keeps them on that row.
  • Commands: pnpm exec turbo run typecheck lint --filter=@bb/app passes. The keeper, bottom-anchored-scroll-body and TimelineWindowedItems tests pass (61).
  • Production data, headless Chrome at 1500×1040: I served each build through a proxy in front of a real bb, with mark-read blocked. On a finished thread with only its last reply unread, main opened at the divider detached and settled 43 px short of the end with the last message clipped. This branch stayed at the end, attached, on every run. Unread content longer than a screen still stops at the NEW divider, detached, on both builds.
  • Window resize, on a start:worktree instance: I scrolled up 150 px near the end and grew the viewport from 900 to 1200 px. The build before Give the timeline's reading position one owner so scrolling stops jumping #5951 attaches, main stays detached with the arrow showing, and this branch attaches.
  • Sending after scrolling up: after scrolling up 1,800 px and sending, the view jumps to the end and follows the streamed reply on this branch.
  • Not run on a device: the Android touch-drag fix is covered by its unit test only.

Not changed: "Show more" on a long user message while following the bottom now keeps the bottom fixed and grows the message upward. Before #5951 it held the message's top and grew downward. That trade-off is left for a separate decision.

AGENT GENERATED

🤖 Generated with Claude Code

ymichael and others added 2 commits October 23, 2026 16:25
Opening an unread thread reveals the NEW divider through
ScrollPositionKeeper.scrollTo. Since #5951 that always recorded a row
anchor, even when the target clamped to the bottom because the new
content fits on screen. The reader was detached at the end, so rows that
settled taller afterwards left the view short of the bottom with the
last message clipped, and the anchor was saved as the thread's restore
position. scrollTo now attaches when it lands at the end, as the reveal
did before #5951 and as revealElement already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e end

Since #5951 only a reader scroll down into the end attached the
timeline. Anything else that left the view at the end kept the reader
detached, with the jump arrow showing and new output not followed:

- a taller window, closing a side panel, rotating to portrait or
  dismissing the keyboard while near the end;
- a saved position restored onto the end after a thread switch;
- on touch screens, a drag toward the end while already at the end,
  which moves nothing and so fires no scroll event.

Leaving a thread while detached at the end also saved a row instead of
the bottom, so returning after more output landed above it.

A viewport resize or restore whose target is at or past the end now
attaches, a touch drag toward the end attaches when at the end, and a
reader at the end is saved as at the bottom. Content shrinking onto the
end still leaves a detached reader detached, as #5951 intended.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the needs-issue PR does not close an open issue label Oct 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the pull request, @ymichael. It was closed automatically because it does not meet the requirements below yet. This is an automated check, not a review of the change.

Linked issue. Every pull request must close an open issue in this repository. The issue keeps the problem tracked even if this pull request closes or we take a different approach. Open an issue for the change, or find an existing one, and add Fixes #<number> to the pull request description. Feature requests and UI changes need a maintainer's sign-off on the issue first. This pull request reopens on its own once you save the description.

See CONTRIBUTING.md for details.

@github-actions github-actions Bot closed this Oct 23, 2026
ymichael added a commit that referenced this pull request Oct 23, 2026
…#6197)

## Human comments

## What was wrong

The linked-issue check from #6189 exempts authors whose
`author_association` is `OWNER` or `MEMBER`. For an org member with
private membership, `pull_request_target` reports `COLLABORATOR`. So
maintainer pull requests from branches in this repository were closed
with `needs-issue`. #6195 was closed this way: run 40039656279 logged
`PR_ASSOCIATION: COLLABORATOR` and `HEAD_REPO: get-bb/bb`. Details in
#6196.

## What changed

`.github/workflows/pr-gate.yml` now runs the linked-issue check only
when the head repository is not this repository.
- **Same-repo pull requests:** only accounts with write access can push
branches here, so these are exempt whatever the author's membership
visibility.
- **Fork pull requests:** handled exactly as before. Approval,
maintainer edits and the issue requirement are unchanged.
- **Closed `needs-issue` same-repo pull requests:** an edit now reopens
them, because the `edited` path uses the same check. That covers #6195.

`CONTRIBUTING.md` already describes the rule as "pull requests from
outside the bb team", so it needs no change.

## How you verified

- **Cause:** confirmed from the gate run log for #6195: `PR_ASSOCIATION:
COLLABORATOR` and `HEAD_REPO: get-bb/bb`.
- **Org membership:** `gh api orgs/get-bb/memberships/ymichael` reports
an active admin, and `public_members` returns 404.
- **Workflow file:** it still parses as YAML. The change is one extra
condition on the existing `issue_missing` guard.

Fixes #6196

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@ymichael ymichael reopened this Oct 23, 2026
@github-actions github-actions Bot removed the needs-issue PR does not close an open issue label Oct 23, 2026
@ymichael
ymichael merged commit 038f78a into main Oct 23, 2026
96 checks passed
@ymichael
ymichael deleted the bb/fix-thread-scroll-position-inconsistency-thr_nbqpibci7w branch October 23, 2026 23:39
@ymichael ymichael mentioned this pull request Oct 24, 2026
ymichael added a commit that referenced this pull request Oct 24, 2026
## Human comments

## What was wrong

`main` has 14 commits since 0.47.0, including #6195, which fixes the
timeline staying detached at the bottom (a regression from #5951 that
shipped in 0.47.0). `bb-app` and `@bb/desktop` were still at 0.47.0, so
the publish and desktop workflows can't ship them.

## What changed

- `packages/bb-app/package.json`, `apps/desktop/package.json`: 0.47.0 →
0.47.1 (`node scripts/bump-version.mjs --patch`).
- No `CHANGELOG.md` or `RELEASE_META` entry: like earlier fix-only
patches, these changes go into the 0.48.0 notes.

The release commit sits directly on `b17bfc8fdd` (#6217). Everything
below was tested on `22d41249ee`, and the sidebar was tested again on
`b17bfc8fdd`. This release includes the daemon protocol bump from #6185
(251 → 252), so enrolled machines will update their daemon.

## How you verified

- `node .github/workflows/check-version-lockstep.mjs`: `bb-app=0.47.1
@bb/desktop=0.47.1`.
- Typecheck, tests and the `bb-app` tarball smoke run in CI on this PR,
instead of locally.
- `git diff --check`, and `oxfmt --check` on the changed files: clean.
- Manual QA of `22d41249ee` with `pnpm start:worktree` (production
bundle) and headless Chrome, on a fresh data dir:
- **Timeline (#6195):** a long unread reply stops at NEW, detached. A
short unread reply opens at the end with no jump arrow. Scrolling up 150
px and growing the viewport 900 → 1200 attaches. Scrolling up 400 px and
growing it stays detached. Sending after scrolling up 1,800 px jumps to
the end and follows the streamed Claude Code reply. The view is still at
the end after a reload.
- **Docs (#6146):** typing in a note while `bb docs pull`/`push`
appended a paragraph kept both edits on disk and in the editor. A stale
push after a UI edit was refused as a conflict. A new note was renamed
from its first line and kept its Markdown after a reload.
- **Skills (#6185):** `bb project commands` lists project skills from
the documented roots for Claude Code and Codex, with no duplicate names.
A Codex `/skill` turn ran the skill.
- **Storage & retention (#6190, #6205):** two outside worktrees were
listed. Bulk removal removed the clean one, kept its branch, and kept
the dirty one. The table fits a 390 px viewport.
- **Sidebar multi-select (#6191, #6217), on `b17bfc8fdd`:** with the
experiment on, Cmd+Shift-click selected a second thread without
navigating ("Actions for 2 threads"). Pressing it again on the same
thread deselected it. Shift-click selected a range of 4. Escape cleared
the selection. Cmd-click cleared the selection and opened a split. Bulk
Pin applied to the two selected threads (checked with `bb thread list`).
With the experiment off, Cmd-click opens a split.
- **omp (#6186):** the picker labels GPT-5.6 Terra rows `openai` and
`openai-codex`.

Not exercised: the Ultrafast icon (#6198), because no Codex model on the
test account offers Ultrafast. Also not exercised: the Android
touch-drag attach, the desktop app, the SDK realtime reconnect (#6183)
and retryable host RPCs (#6184). Those last two are covered by unit
tests only.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant