Skip to content

ui-react: hygiene-media stale-at-apply layout test intermittently hangs to its timeout #3657

Closed

Description

@schlessera

Context

packages/ui-react/tests/browser/hygiene-media.layout.tsx:211 ("stale at apply re-previews with a focused banner; the commit waits for the current preview") failed in hosted CI for an unrelated change. It came to main with #3594 (epic #1777, sub-PR #3592).

Observed: ready-candidate proof for #3653, run 42228513642, job layout (1) (127928485126). The checkout was 491095f1b, with parents main 75ca2730c and head e3b92f202.

  • light 320 and light 1280 failed after about 31.6 s each, so they hit the 30 s test timeout.
  • dark 320 and dark 1280 passed in under 0.8 s in the same run, as did the other 33 tests in the file.
  • The log has no failure-detail block for the two tests. The run reported an unhandled rejection, TypeError: fetch failed caused by HeadersTimeoutError (UND_ERR_HEADERS_TIMEOUT). Undici's default headers timeout is 300 s, so some Node-side request apparently got no response for minutes. The test's fixture calls (set, packages/ui-react/tests/browser/hygiene-media.layout.tsx:47) are one candidate, not established.
  • refactor: land epic #2539 batch 2 — policy proposals split frontmatter with the shared helper (#2507) #3653 changes only packages/ui-server/src/brain/policy-proposal.ts and the frontmatter lint gate. The hygiene fixture uses neither.

Passing runs of the same test:

The test turns on holdPlans with applyMode: "stale" (packages/ui-react/tests/fixtures/hygiene-browser-server.ts:226-230, released at :526). It then waits for the banner, focus and checking, and releases the held plans.

It blocks the epic batches landing on main. #3653 is waiting on this fix and was not rerun.

Scope

  • Find why this test can hang until the test timeout.
  • Make it deterministic, in the test, the fixture or the component, whichever is wrong.

Out of scope

  • Changing what the card does on a stale apply, unless the hang is a product bug.
  • Other tests in the file.
  • Raising the 30 s test timeout to hide a hang.

Acceptance criteria

  • The cause of the hang is named, with evidence: the step that waited and the request that never answered.
  • The fix removes the cause. A timeout increase alone does not count.
  • A failing-first or mutation receipt shows the test can still fail on the stale-banner and commit-waits assertions.
  • hygiene-media.layout.tsx passes in a hosted layout job on the fix's head.

Verification

Run the file repeatedly with the pinned Chromium host recipe, and in the hosted layout shard that holds it.

Contract impact

None.

Activity

  1. added this to the 0.45.0 milestone on Nov 6, 2026
  2. added
    type: test
    area: ui-react
    priority: p1
    on Nov 6, 2026
  3. added
    agent-ready
    on Nov 6, 2026
  4. self-assigned this
    on Nov 6, 2026
  5. schlessera commented on Nov 6, 2026

    @schlessera
    OwnerAuthor

    Claimed (claim token c3657-t3-510f). Branch test/3657-stale-apply-hang from main 75ca2730c. No path collisions with open PRs on the test file or its fixture.

  6. schlessera commented on Nov 6, 2026

    @schlessera
    OwnerAuthor

    Fixed by #3659, squash-merged as 501e93e21 (milestone 0.45.0).

    • Cause: on a stale apply, the media card set the banner in a passive effect and focused it on the next animation frame. Under load that frame ran before React committed the banner, so bannerRef was null and focus stayed on the destination input. The banner-focus poll failed in about 1 s.
    • Why it looked like a hang: the re-preview was still held (holdPlans). afterEach → stop drains every forwarded route before it sends SIGTERM, and only SIGTERM releases the holds. The drain therefore waited on that request until Node's 300 s HeadersTimeoutError, and the test was reported as a 30 s timeout with no detail.
    • Fix: the banner is now focused in an effect after the commit that mounts it. Teardown releases held plans before stop.
    • Proof: failing-first under a forced frame-before-commit order; 50/50 soak runs under CPU load (5 runs in 46 failed before the fix); and four mutation receipts, one each for focus, banner text, re-preview and commit-waits. All are in the PR. Hosted layout (1) in candidate run 42242569817 passed all four stale at apply variants.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyarea: ui-reactpriority: p1type: test

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions