GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(app): contain timeline rows to cut scroll layout work by Te-River · Pull Request #54293 · anomalyco/opencode

Conversation

@Te-River

@Te-River Te-River commented Oct 10, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #54291

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Scrolling a long session in the desktop app spends its main-thread time in layout and paint. A CPU profile of the scroll window puts (program) at 523ms of 1607ms sampled, with the app-side reads small next to it.

The timeline's row container sets overflow: clip but no containment, so every mounted row stays in the layout and paint path for the whole list. This PR adds contain: layout paint to that row style, and consolidates duplicate layout reads in the scroll path: updateScrollState read clientHeight twice per frame, and unpin / fill each re-derived the same overflow.

Measured with the benchmark added in this PR, against a production build, paired and interleaved with the baseline: cold-scroll long-task time drops by ~76ms median (5 of 7 paired rounds), and the settled frame-gap distribution improves in cumulative paired testing (11W-4L-3T, p=0.013). DOM node count is unchanged.

The frame-gap metric is bimodal (50ms / 66.6ms) and load-sensitive, so single-window readings are not reliable — the numbers above come from alternating runs inside the same window.

How did you verify your code works?

  • packages/app/e2e/performance/timeline/session-timeline-scroll-benchmark.spec.ts (new): production build, --repeat-each=20 --workers=1 --retries=0, paired against the baseline. Run from packages/app with PLAYWRIGHT_BUILD=1.
  • 9 timeline regression suites: 112 passed, 0 failed.
  • bun run check: passes except for a pre-existing Windows checkout issue — packages/app/src/custom-elements.d.ts is a symlink in git (mode 120000) and is checked out as text when core.symlinks=false, which fails @opencode/app#typecheck and @opencode/desktop#typecheck with TS1128 on this machine with or without this change.

Screenshots / recordings

n/a — no visual change. contain: layout paint was checked against the row's overflow-clip-margin: 0.5px (still applies).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Te-River
Te-River requested review from Brendonovich and Hona as code owners October 10, 2026 10:49
@github-actions github-actions Bot added the needs:issue label Oct 10, 2026
@github-actions

github-actions Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Te-River Te-River mentioned this pull request Oct 10, 2026
desktop: timeline rows lack containment, so scrolling a long session burns main-thread time in layout/paint #54291
Open
opencode-agent[bot]
opencode-agent Bot reviewed Oct 10, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The production change looks sound. Rows are already absolutely positioned, fixed-height and overflow: clip, and they're measured through the inner element, so contain: layout paint shouldn't affect row measurement, clipping or the sticky accordion headers. The scrollGeometry refactor in interaction.ts behaves the same as before. I couldn't confirm the performance gain: this sandbox is headless with no GPU compositor or Playwright browsers. Typecheck, the timeline unit tests and the browser test suite pass.

Public API: unchanged.

The main concern is the benchmark. It's 376 lines for a one-line CSS change, and parts of it measure things this PR doesn't touch: the cold-tail settle and its offsetHeight sweep, pending markdown counts, and a Chromium path override. It also needs a retry for an unexplained route reload on the first scroll (inline comments). Could you cut it down to the frame-gap and long-task measurement that this change affects, or drop it from this PR?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/app/e2e/performance/timeline/session-timeline-scroll-benchmark.spec.ts
* context. The calibration step absorbs that reload; the measured steps then run on a settled
* document.
*/
async function wheelThrough(scroller: Locator, steps: number, delta: number) {

@opencode-agent opencode-agent Bot Oct 10, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This retries on Execution context was destroyed because "the first scroll after load makes the app reload the same route once". If the app really reloads on the first scroll, that's a bug worth its own issue. If it's caused by how the benchmark is set up, the retry hides it and the benchmark is likely to be flaky. Either way, I don't think a benchmark should work around it silently. Can you find out what triggers the reload?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/app/e2e/performance/timeline/session-timeline-scroll-probe.ts Outdated

if (!root) throw new Error("timeline scroller is not mounted")

// offsetHeight is declared on HTMLElement.prototype, so the read sweep is counted there.

@opencode-agent opencode-agent Bot Oct 10, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patching HTMLElement.prototype.offsetHeight to count reads during the cold-tail settle measures code this PR doesn't change. It also adds overhead to the very layout reads the benchmark is timing. I'd drop the offsetHeight / cold-pending / pending-markdown parts and keep only the frame-gap and long-task measurement this change is about.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Te-River

Te-River commented Oct 10, 2026

Copy link
Copy Markdown
Author

The reference is in the body (Closes #54291, under "Issue for this PR"). closingIssuesReferences reads empty here because the PR targets v2 rather than the default branch — recent merged v2 PRs (#54219, #54208, #54202, #54201, #54198) show the same.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@opencode-agent

opencode-agent Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Thanks. Agreed, the Closes #54291 in the description is fine, and my review didn't question it. I left #54291 out of the issues I listed only because your description already closes it.

The two benchmark comments are still open, since there are no new commits. They are the retry around the first-scroll route reload, and the probe measuring the cold-tail offsetHeight sweep, which this change doesn't touch. I'd still cut the benchmark down to the frame-gap and long-task measurement, or drop it from this PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Te-River

Te-River commented Oct 10, 2026

Copy link
Copy Markdown
Author

Trimmed, thanks — 376 → 271 lines.

Removed:

  • the cold-tail settle instrumentation (coldPending share, the offsetHeight sweep and its prototype patch, pending-markdown counts)
  • the Chromium path override
  • the retry for the first-scroll route reload

The retry turned out to be a leftover: the settle loop read its frame budget from module scope, and locator.evaluate serializes only the function source, so the budget was undefined in the page and the loop never resolved — the "navigation" was what finally broke it. Passing the budget as an evaluate argument fixed that, and the benchmark now passes 12/12 with --retries=0.

What is left is the frame-gap and long-task measurement, plus the two scenarios. The numbers in the description are unaffected by the trim: the removed instrumentation only counted reads, it did not change the measured path.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

opencode-agent[bot]
opencode-agent Bot reviewed Oct 10, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at 3b41bff. Both earlier benchmark concerns are resolved. The probe now records only frame gaps, long tasks and scroll events: the offsetHeight prototype patch, the cold-tail and pending-markdown counters and the Chromium override are gone. The retry around the first-scroll route reload is removed too. The production change (interaction.ts, virtualizer.tsx) is unchanged and still looks sound. Typecheck passes. I still couldn't measure the performance gain here: this sandbox is headless, with no GPU compositor or Playwright browsers.

Public API: unchanged.

No blocking concerns. One small thing: the wheelThrough comment still says that scrolling with the mouse wheel makes the app navigate. If that also happens with a real wheel in the app, it would be worth its own issue.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@thdxr
thdxr changed the base branch from v2 to dev October 10, 2026 19:41
@github-actions github-actions Bot removed the needs:issue label Oct 10, 2026
@Te-River
Te-River force-pushed the timeline-containment branch 6 times, most recently from 9f3fb36 to d71a5c6 Compare October 17, 2026 13:09
@Te-River
Te-River force-pushed the timeline-containment branch 3 times, most recently from 8c29da0 to ace6af6 Compare October 22, 2026 00:57
opencode-agent[bot]
opencode-agent Bot reviewed Oct 22, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at ace6af6, after the rebase. The earlier points are addressed: the retry around the first-scroll route reload is gone, the probe no longer patches offsetHeight or counts cold-tail work, and the comment claiming that wheel scrolling makes the app navigate has been replaced. The production change is unchanged and still looks sound. Typecheck and the timeline unit tests pass on the new base. I still couldn't measure the performance gain here: this sandbox is headless, with no GPU compositor or Playwright browsers.

Public API: unchanged.

No blocking concerns.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Te-River
Te-River force-pushed the timeline-containment branch from ace6af6 to f3af567 Compare October 23, 2026 11:11
opencode-agent[bot]
opencode-agent Bot reviewed Oct 23, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at f3af567. This is a pure rebase: the commits are unchanged from ace6af6. Both earlier threads are addressed: the reload retry and the offsetHeight instrumentation are gone from the benchmark. The timeline unit tests and a direct tsc -b pass on the new base. I still couldn't measure the performance gain here: this sandbox is headless, with no GPU compositor or Playwright browsers.

Public API: unchanged.

No blocking concerns.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Te-River
Te-River force-pushed the timeline-containment branch from f3af567 to 3533cd6 Compare October 24, 2026 02:59
opencode-agent[bot]
opencode-agent Bot reviewed Oct 24, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at 3533cd6. This is a pure rebase: the commits are unchanged from f3af567. Both earlier threads are addressed: the reload retry and the offsetHeight instrumentation are gone from the benchmark. Typecheck and the timeline unit tests pass on the new base. I still couldn't measure the performance gain here: this sandbox is headless, with no GPU compositor or Playwright browsers.

Public API: unchanged.

No blocking concerns.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Te-River
Te-River force-pushed the timeline-containment branch from 3533cd6 to 59796f3 Compare October 24, 2026 11:51
opencode-agent[bot]
opencode-agent Bot reviewed Oct 24, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at 59796f3. This is a pure rebase: the commits are unchanged from 3533cd6. Both earlier threads are addressed: the reload retry and the offsetHeight instrumentation are gone from the benchmark. Typecheck and the timeline unit tests pass on the new base. I still couldn't measure the performance gain here: this sandbox is headless, with no GPU compositor or Playwright browsers.

Public API: unchanged.

No blocking concerns.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Te-River
fix(app): contain timeline rows to cut scroll layout work
ac026c0
Scrolling a long session spends its main-thread time in layout and paint: a CPU profile of the scroll window puts (program) at 523ms of 1607ms sampled. The row container set only overflow: clip, so every mounted row stayed in the layout and paint path for the whole list.

Add contain: layout paint to the row style, and consolidate duplicate layout reads in the scroll path (updateScrollState read clientHeight twice per frame; unpin and fill each re-derived the same overflow).

Measured with the scroll benchmark added here, against a production build, paired and interleaved with the baseline: cold-scroll long-task time drops by ~76ms median (5 of 7 paired rounds), and the settled frame-gap distribution improves in cumulative paired testing (11W-4L-3T, p=0.013). DOM node count is unchanged.
Te-River added 2 commits October 25, 2026 18:55
@Te-River
test(app): trim the scroll benchmark to frame-gap and long-task
7007451
Drop the cold-tail settle instrumentation (coldPending share, offsetHeight sweep, pending markdown counts) and the Chromium path override: they measure the settle path, which this change does not touch.

The retry for the first-scroll route reload is no longer needed now that the settle loop's budget is passed as an evaluate argument instead of read from module scope.
@Te-River
test(app): drop the wheel-navigation claim from the scroll benchmark
c3fae03
The comment blamed a wheel burst for the app navigating. The navigation was the load-time double navigation, and the destroyed context came from the settle loop never resolving because its budget was read from module scope. The assignment is kept because it lands deterministically, not because the wheel navigates.
@Te-River
Te-River force-pushed the timeline-containment branch from 59796f3 to c3fae03 Compare October 25, 2026 11:16
opencode-agent[bot]
opencode-agent Bot reviewed Oct 25, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at c3fae03. This is a pure rebase: the commits are unchanged from 59796f3. Both earlier threads are addressed: the reload retry and the offsetHeight instrumentation are gone from the benchmark. Typecheck and the timeline unit tests pass on the new base. I still couldn't measure the performance gain here: this sandbox is headless, with no GPU compositor or Playwright browsers.

Public API: unchanged.

No blocking concerns.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Te-River Te-River mentioned this pull request Oct 25, 2026
test(app): add a parallel-session event benchmark #54328
Closed
3 of 7 tasks
@Te-River

Te-River commented Oct 25, 2026

Copy link
Copy Markdown
Author

Temporarily closing to free a slot for the #58934 fix under this repository's open pull request limit. The branch is unchanged and this reopens as soon as the fix PR exists.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Te-River Te-River closed this Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencode-agent opencode-agent[bot] opencode-agent[bot] left review comments
@Hona Hona Awaiting requested review from Hona
@Brendonovich Brendonovich Awaiting requested review from Brendonovich

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

desktop: timeline rows lack containment, so scrolling a long session burns main-thread time in layout/paint

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@Te-River
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.