fix(web): expanded tool lists no longer crash the thread at fractional zoom #47145
main fromrefs/pull/47145/head·merged by juliusmarminge View on GitHubAt some browser or desktop zoom levels (for example 105%), expanding a tool-call list in the timeline crashed the thread view with React error #185 ('Maximum update depth exceeded'). Chromium rounds a list that fits to 1px taller than its viewport. The list's height-allowance check had no tolerance, so it switched the allowance on and off forever. The check now allows 1px of rounding, so the list settles at a stable height.
Fixes pingdotgg/t3code#47121
Reproduction on main#
Commit 63f7006a05 (origin/main). Ran T3CODE_DEV_SEED=0 vp run dev (web) in a fresh worktree with a fresh database. Added a scratch git project with t3 project add, then started a thread on the free Replay (dev) provider with the bench-heavy scenario. That gives one work group of 13 tool calls. In headless Chromium through Playwright (1280x800): paired, opened the thread, clicked 'Worked for 1.7s', then 'Changed 4 files, ran 3 commands, and performed 6 other actions' to expand the tool-call list. At 100% the list settles with scrollHeight 312 and clientHeight 312. I then set document.documentElement.style.zoom = '1.05', which stands in for 105% browser or Electron zoom. The app crashed straight away into the 'Something went wrong' screen: 'Maximum update depth exceeded', stack dispatchSetState <- updateLayout (TimelineWorkGroupRows.tsx) <- commitHookLayoutEffects, error in . This happened every time at viewport height 800 and at 440. With a temporary debug log in updateLayout (removed afterwards), the values alternated forever: allowance on gives sh=313, ch=312, overflow 1 > 0, so it turns off. Allowance off gives sh=313, ch=288, overflow 25 <= 48, so it turns back on. The content box measured 327.59px at 1.05 zoom. The reporter's exact setup (Playwright deviceScaleFactor 1.1/0.9 swept over viewport heights 500-640) did not trigger it for me. Root zoom 1.1, 0.9, 1.25, 0.8, 1.5, 0.75, 0.67, 1.75 and 2 at heights 440-640 did not either. Root zoom 1.05 did. A 1px tolerance (overflow <= (fitsWithAllowance ? 1 : workGroupOverflowAllowance - 1)) made the new test and the existing height-cap tests pass. That change was reverted and is not on the branch. Failing test on branch factory/repro-47121 (0570999ea2), in apps/web/src/components/chat/MessagesTimeline.browser.test.tsx: 'settles an expanded group whose scrollHeight rounds 1px above its clientHeight'. It renders 13 tool rows, expands them, and makes the group's scrollHeight 1px larger, the rounding seen in the real run. On main it fails with 'Maximum update depth exceeded'.
Evidence#
On each commit, start the real web dev stack with a fresh isolated database and no copied user state. Seed a scratch git project and a Replay (dev) bench-heavy thread; open it, click “Worked for 1.7s”, then “Changed 4 files, ran 3 commands, and performed 6 other actions” to show all 13 tool calls. Capture at 100%, set document.documentElement.style.zoom = "1.05", and capture again. Check that the expanded group remains visible.
Environment: Linux, headless Chromium, 1280×800 viewport, light theme, identical recorded replay and fresh databases.
Scenario: Expanded tool calls remain visible at 105% zoom#
Proven: the scenario fails on base 63f7006a05 and passes on head 8d8a04e58e.
| Base 63f7006a05 | Head 8d8a04e58e | |
|---|---|---|
| Result | ❌ failed ASSERTION_FAILED: expect.toBeVisible failed locator: getByRole("button", name: /Changed 4 files, ran 3 commands, and performed 6 other actions/) expected: visible observed: no node (match count 0) | ✅ passed |
| expanded at 100 percent | ![]() | ![]() |
| expanded at 105 percent | ![]() | ![]() |
| failure | ![]() |
Scenario driver · Before recording · After recording
Not shown:
- Native Electron zoom, constrained-height windows, and zoom factors other than 105% were not exercised; this proof covers the deterministic 105% root-zoom web reproduction.
Tests#
vp test run src/components/chat/MessagesTimeline.browser.test.tsx -t "rounds 1px above"before the fix: failed with Maximum update depth exceeded, which reproduces the bugvp test run src/components/chat/MessagesTimeline.browser.test.tsxafter the fix: 108/108 passedvp run check:changed: format, lint, knip, typecheck, test and react compiler all pass- PR CI: all 39 checks passed
Not in this change#
- The reporter's exact setup (deviceScaleFactor 1.1/0.9) did not trigger the bug in the repro step; zoom/height combinations beyond what the 1px tolerance covers were not investigated.
Who did the work#
- Written by Claude Opus 5.5, in Claude Code
- Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
- Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5
Run by the t3code factory in T3 Code.
- 1
tanstack-source added labelsbug
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
Approvability#
Verdict: Approved at
8d8a04eMacroscope's review found this PR approvable — Adds one-pixel tolerance to expanded tool-list measurements to prevent layout oscillation at fractional zoom. The change is limited to local display sizing, with no product-default or data-handling changes.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review.
Walkthrough
-
The work group layout calculation now uses 1px slack in its overflow thresholds. A browser regression test simulates a one-pixel scroll-height difference and checks that an expanded 13-item group settles without a maximum-update-depth error.
Changes: Work group layout stability
Layer / File(s) Summary Overflow threshold and regression test
apps/web/src/components/chat/TimelineWorkGroupRows.tsx,apps/web/src/components/chat/MessagesTimeline.browser.test.tsxupdateLayoutaccepts overflow up to 1px when content fits and reduces the alternate threshold by 1px. The browser test simulates scroll-height rounding and checks that the expanded group gets positive client height without a maximum-update-depth error.Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers:
yash-singh1,macroscopeapp
Merge Risk:
Minimal · up to8d8a0-
This change adds 1px of slack to the expanded tool-call list's fit check, which should stop the thread-view crash at fractional zoom. The inspected code shows no remaining oscillation path, and a browser regression test covers the rounding case. Merge risk is minimal.
Pre-merge checks:
4-
Check name Status Explanation Title check The title names the fix and its scope: expanded tool lists no longer crash the thread at fractional zoom. The diff adds a 1px tolerance to the height-allowance check in ExpandedWorkGroupEntries, which… Linked Issues check Issue #47121requires that the expanded tool-call list in ExpandedWorkGroupEntries settle without a synchronous layout-effect state loop. The root cause is a 0px tolerance: the hysteresis threshold de…Out of Scope Changes check All changes connect to issue #47121. The production change in TimelineWorkGroupRows.tsx (+3/-1) alters only the overflow thresholds in ExpandedWorkGroupEntries, which is the loop site named in the iss…Description check The description explains the problem (React error #185when expanding a tool-call list at 105% zoom), the cause (no tolerance in the height-allowance check, so it toggles forever), the change (1px rou…Full details: Title check
-
Explanation
The title names the fix and its scope: expanded tool lists no longer crash the thread at fractional zoom. The diff adds a 1px tolerance to the height-allowance check in ExpandedWorkGroupEntries, which addresses that crash. The title is specific and matches the main change. It uses the conventional commit form the template requests.
Full details: Linked Issues check
-
Explanation
Issue
#47121requires that the expanded tool-call list in ExpandedWorkGroupEntries settle without a synchronous layout-effect state loop. The root cause is a 0px tolerance: the hysteresis threshold delta (48) equals the maxHeight delta (48px). The change in apps/web/src/components/chat/TimelineWorkGroupRows.tsx applies 1px of slack in the overflow checks (<= 1 while fitting, <= workGroupOverflowAllowance - 1 while not fitting). This matches the issue's suggested 1-2px hysteresis margin. Analysis of the state transitions: a true-to-false flip needs overflow > 1, and a false-to-true flip needs overflow <= 47. Both can hold together only if the clientHeight difference changes by 2px or more. A 1px rounding difference cannot cause that, so the oscillation from#47121is blocked. The added browser test in MessagesTimeline.browser.test.tsx reproduces the 1px scrollHeight rounding on 13 expanded tool rows, and the PR reports it fails on main with 'Maximum update depth exceeded'. Limitations: the real-app zoom evidence is not captured yet (the Evidence section is a placeholder). The reporter's exact deviceScaleFactor setup was not reproduced, and the test simulates the rounding by overriding scrollHeight rather than using real zoom. These limits leave the real-world coverage unverified, but the mechanism named in the issue is addressed.
Full details: Out of Scope Changes check
-
Explanation
All changes connect to issue
#47121. The production change in TimelineWorkGroupRows.tsx (+3/-1) alters only the overflow thresholds in ExpandedWorkGroupEntries, which is the loop site named in the issue. The test change in MessagesTimeline.browser.test.tsx (+35/-0) is a regression test for that loop. It overrides scrollHeight only for [data-tool-group-scroll] and restores the original descriptor afterward. No unrelated files or refactors are listed in the summary.
Full details: Description check
-
Explanation
The description explains the problem (React error
#185when expanding a tool-call list at 105% zoom), the cause (no tolerance in the height-allowance check, so it toggles forever), the change (1px rounding allowance), a detailed reproduction, a failing and passing test, and CI status. It follows the template's Problem, Change, Scope, Verification sections in substance. Gaps: the Scope section links issue#47121in the title line only and in the body text, but does not state a bug-fix justification beyond that, which is acceptable since an issue is linked. The Evidence section is extensive and includes a recording and screenshots. The author also notes the reporter's exact setup was not reproduced. The template's conventional commit title is not present in the description, and the agent/model attribution is provided. Overall the description is substantively complete.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: factory/issue-47121
- File: .coderabbit.config.ts
- Commit: 8d8a04e
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Team
- Run ID:
84f17e25-3cbb-4f2b-9908-d9c045372ddf
Commits-
Reviewing files that changed from the base of the PR and between 2b2bc06316d6ccdc2cff7e20cb3184a9407dd8d7 and 8d8a04e58e8c044bac3e00d9c85b66dc20f866c7.
Files selected for processing: 2-
apps/web/src/components/chat/MessagesTimeline.browser.test.tsxapps/web/src/components/chat/TimelineWorkGroupRows.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
-
-
juliusmarminge merged thisbe3cc6c
juliusmarminge closed this
Sign in to join this conversation.





macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes