Skip to content

Fix red browser test on main: faster software-GL rendering, isolated smoke-test scenes - #3

Merged
Mecca-Research merged 1 commit into
mainfrom
claude/dazzling-dirac-pexsyc
Sep 29, 2026
Merged

Mecca-Research merged 1 commit into
mainfrom
claude/dazzling-dirac-pexsyc

Conversation

@Mecca-Research

Copy link
Copy Markdown
Owner

Summary

After #2 merged, one job on main went red (CI run 36568871236): Every 3D scene renders (headless Chromium). The other jobs passed, including the reproducibility check that #2 fixed.

PASS kidney           220.0s
page.goto: Timeout 30000ms exceeded.
  - navigating to "about:blank", waiting until "load"

The harness reuses one page and moves between scenes through about:blank. After the kidney scene, the renderer was still busy with slow software-GL frames, so that navigation timed out and crashed the run. The same code had passed on the PR run, where kidney took 136 s instead of 220 s. The timeout therefore depends on how fast the runner is.

Reproduction

Pinning the browser to two cores (taskset -c 0,1) reproduces a slow runner: kidney takes 229 s and misses its 90 s 45-frame budget. The underlying problem is that kidney renders very slowly under SwiftShader, and every fixed timeout in the harness only just fits it.

Profile at the lowest resolution: simulation JS costs about 1 ms per frame and an empty scene about 94 ms. The confocal volume costs about 300 ms. The 3D nephron costs about 600 ms: 3,690 epithelial cells, each drawn as two icospheres, about 1.3 M triangles.

Changes

js/engine/stage.js: adaptive resolution that actually adapts on slow GPUs

  • Before: it counted frames (20 per step, −15 %, floor 0.5). At about 2 s per frame, reaching the floor took around 200 s.
  • Window: a decision window now closes after 20 frames or 0.75 s (at least 3 frames).
  • Median: each window is judged by its median frame time, so a single shader-compile stall doesn't lower the resolution.
  • Proportional steps: each step is sized to the overrun, since cost scales with pixel ratio squared.
  • Lower floor: the floor drops to 0.35.
  • Measured: software GL now reaches the floor about 6 s after the scene loads.
  • Multisampling: without bloom (H&E mode), the scene was drawn straight into the multisampled canvas. A device that had to lower its resolution now renders through the composer's single-sample target, which is several times cheaper. Fast GPUs keep exactly the old path. Previews (setFixedPixelRatio) are unaffected.

js/scenes/kidney.js

  • The epithelial and podocyte nuclei sit inside translucent membranes, so they now use an 80-triangle sphere instead of a 180-triangle one.

tests/e2e/smoke.mjs

  • Each scene gets its own browser context and renderer, so no navigation waits for the previous scene to unload. Closing the kidney context takes about 1 s.
  • page.evaluate, close and screenshot calls have explicit time limits.
  • A failing scene is recorded as FAIL and the run continues to a summary instead of crashing.
  • The pointless switch back to 3D mode at the end of each scene is gone.
  • The checks are unchanged: page load, 45 frames, a non-blank frame in each mode, and no console or scene errors.

Testing

  • Two cores, full node tests/e2e/smoke.mjs --all --modes: 28/28 PASS in 13.6 min. Kidney takes 118 s; before this change it failed at 229 s. Colony dropped from 102 s to 44 s. With the two-core pin, kidney reaches its 45 frames about 46 s after loading, well within the 90 s limit.
  • Before/after on the same two-core reproduction: colony, kidney and signaling ran in 6 m 23 s with kidney failing; they now run in 3 m 18 s with all passing.
  • H&E through the single-sample path: checked visually, and the frame statistics match the old path. For example, kidney histology mean/std is 232.5/17.7 now versus 232.4/17.8 before.
  • node --test tests/models/*.test.mjs: 98/98 pass.
  • git diff --check is clean, and the tests leave tracked files unchanged.

Not verified here: frame rates on a real GPU. On fast GPUs the new logic keeps the old full-resolution, multisampled path, because the median frame time stays under 20 ms.

🤖 Generated with Claude Code

https://claude.ai/code/session_016pbMe2Yw2abpatNN7kc6j2


Generated by Claude Code

The browser job on main failed after the kidney scene: the harness reused
one page and its page.goto('about:blank') timed out (30 s) while the
renderer was still busy with software-GL frames. Reproduced by pinning the
browser to two cores (kidney then also misses its 90 s 45-frame budget).

Root cause is how slowly kidney renders under SwiftShader:
- adaptive resolution counted frames (20 per step, -15 %, floor 0.5), so
  at ~2 s/frame it needed minutes to adapt. It now closes a window after
  20 frames or 0.75 s, judges the median frame time (a lone shader-compile
  stall does not count), steps in proportion to the overrun (cost ~ pr^2)
  and may go down to 0.35
- with bloom off (H&E mode) the scene went straight to the multisampled
  canvas; a device that had to lower its resolution now renders through
  the composer's single-sample target instead. Fast GPUs are unchanged
- kidney's ~3,700 epithelial and podocyte nuclei, inside translucent
  membranes, use an 80- instead of a 180-triangle sphere

smoke.mjs gives every scene its own browser context, so no navigation has
to wait for the previous scene to unload; it bounds page.evaluate/close,
records a failing scene instead of crashing the run, and drops the
pointless switch back to 3D mode at the end of each scene.

Two cores, every scene and view in all three modes: 28/28 pass in
13.6 min (kidney 118 s; before: kidney failed at 229 s).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016pbMe2Yw2abpatNN7kc6j2
@Mecca-Research
Mecca-Research marked this pull request as ready for review September 29, 2026 20:58
@Mecca-Research
Mecca-Research merged commit 0526ec0 into main Sep 29, 2026
3 checks passed
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.

2 participants