Skip to content

test(browser): deflake relay-recovery and solo-legacy-invitation - #3681

Merged
matt2e merged 1 commit into
mainfrom
deflake-relay-recovery-solo-invitation
Nov 17, 2026
Merged

matt2e merged 1 commit into
mainfrom
deflake-relay-recovery-solo-invitation

Conversation

@matt2e

@matt2e matt2e commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Why

Two WebKit browser journeys fail now and then in CI on branches that cannot affect them. One failed test fails its shard and CI required, because the Playwright config sets retries: 0, and the only recovery is a manual re-run. Both are races in the tests themselves, not product defects.

  • tests/browser/relay-recovery.spec.mjs:9, "relay reads recover automatically after the network returns".
  • tests/browser/solo-legacy-invitation.spec.mjs:49, "Outbox Retry reconciles a recorded then removed Solo invitation without replaying it".

This PR is test-only. It changes those two spec files (+26 −9) and no production code. No journey is added or removed.

Both failures surfaced together in one CI run on #3677 (run 43995560292, attempt 1). That PR did not cause them. It renames a presence label in the profile panel, which neither journey opens or asserts. The failed jobs passed on re-run at the same commit, and the same failure signatures appear on other branches, listed below.

relay-recovery: the wait was satisfied by another community's read

The failure. toBeInViewport reports "element(s) not found" for the connection notice, on WebKit shard 5/18. Example: run 43995560292, job 133746953063.

The race. The test cuts the network, waits for the open channel's catch-up read to meet the outage, jumps the clock 30 s, and expects the connection notice to stay up. The wait accepted a refused /query from any community. In the CI trace the second community's background reads were refused first, so the wait passed on one of them and the clock jumped before the open channel's own read was refused:

ms after the outage began Event
+26 to +77 First five refused requests, all for the second community
+124 The wait passes, on a second-community /query
+146 to +271 clock.fastForward(30_000)
+272 Notice visible
+545 First refused /query for the open channel's community
+881 The failing assertion starts. The notice is gone and stays gone for 10 s

createRecovery in src/features/relay/recovery.ts hides the notice as soon as no source is failed or busy. Once the live socket returns there is an instant where nothing is failed, just before the open channel's read is queued and refused. That later refusal starts a fresh 30 s notice timer, which the test's clock never advances.

Why now. #3459 added a background session for other communities, which is the source of the early second-community refusals. In a sweep of CI runs from 14 to 17 Nov, this exact signature failed in 5 of the 126 completed runs created after #3459 merged, and in none of the 660 completed runs created before it.

The fix. The wait now passes only when a refused /query for the primary community carries the open channel's timeline head. The filter test is the one isChannelHead uses in src/features/relay/session.ts, depth_limit clause included. The comment above the wait already asked for this. Once that read is refused, the channel's head stays failed or pending while the outage holds, so recovery cannot go idle and the notice cannot clear before the network returns.

solo-legacy-invitation: a reload while the app was still booting

The failure. page.reload: WebKit encountered an internal error, on WebKit shard 6/18, followed by the fixture's console-error check failing on the resulting "Failed to load resource" message. Example: run 43995560292, job 133746953195.

The race. Each colour-mode pass did goto, a localStorage write, then reload. In the CI trace the reload began 39 ms after goto resolved, while the app was still booting. The trace shows the in-flight boot requests cancelled at that moment, then the document request hanging 3.5 s and failing. #1972 diagnosed and fixed the same pattern in settings.spec.mjs and account-profile.spec.mjs, but not in this spec.

The fix. As in #1972, the mode is written by an init script before the document loads, and the boot reload is gone. The second pass adds a second script. Scripts run in the order added, so the last mode wins. The reload the test is about, after Retry, is unchanged. The existing data-color-mode assertion still proves each pass booted in its mode.

Known limit. The trigger is established from the trace and matches #1972's diagnosis. The reason WebKit fails the document request is not established.

Occurrences on other branches

From a sweep of 1,196 CI workflow runs created between 2026-11-14 01:25Z and 2026-11-17 01:49Z, excluding the #3677 run. History before 14 Nov was not swept. The 12 Nov run was found by hand.

Signature Other occurrences Where
relay-recovery.spec.mjs:9, line 83 on main, toBeInViewport "element(s) not found" 4, all WebKit 5/18 Runs 43969555290 (#3050), 43988980663 (#3035), 43990605700, 43991562525 (#3043), between 16 Nov 22:35Z and 17 Nov 00:57Z
solo-legacy-invitation.spec.mjs:49, page.reload: WebKit encountered an internal error 0 in the window, 1 older Run 43294609776 attempt 1 on #3400, 12 Nov, job 131450781682

One more run failed relay-recovery.spec.mjs:9 at other lines: run 43683311686 on #3551's own branch, which rewrites the test's navigation. It is not counted above.

Evidence

All local: macOS 27.2, Playwright 1.63.0, on 23d1d7045b plus this change, with --no-deps and the config's two workers.

Check Result
relay-recovery, forced CI ordering, previous wait 20 of 20 fail, 10 Chromium and 10 WebKit, each at the toBeInViewport assertion with "element(s) not found"
relay-recovery, forced CI ordering, new wait 20 of 20 pass, 10 Chromium and 10 WebKit
relay-recovery, committed spec, --repeat-each=10 20 of 20 pass, 10 Chromium and 10 WebKit
solo-legacy-invitation, committed spec, --repeat-each=10 20 of 20 pass, 10 Chromium and 10 WebKit
solo-legacy-invitation, init script removed The "dark" pass fails on both engines at the data-color-mode assertion: expected "dark", received "light"
pnpm typecheck passed
pnpm lint passed, no notes in the touched files
biome format on the two files, git diff --check no changes, clean
  • Forced ordering. The two forced runs used temporary copies of the spec outside the repository. Each copy had the same two additions: a refused second-community /query recorded at the moment of the outage, and a one second pause before the toBeInViewport assertion, as on a slower runner. The only difference between the two runs is the wait.
  • Init script removed. This run shows the init script is what sets the mode, and that the data-color-mode assertion is live.

Not proven and not run

  • No fail-before run for solo-legacy-invitation. The CI failure has not been reproduced on macOS WebKit. The 20 passing runs show the journey still works, not that the flake is gone. That proof is the error staying absent from CI. The known rate is low: two occurrences, on 12 and 17 Nov.
  • Nothing ran on Linux WebKit. Hosted CI runs Linux WebKit. Every run above is macOS. CI on this PR is the first Linux run of the change.
  • The relay-recovery failure was reproduced by forcing the order. The unmodified spec did not fail locally without forcing.
  • Not run locally. The rest of the browser suite and the unit tests.
  • Pre-push hook. The branch was pushed with git push --no-verify, so the hook did not run.
  • Base. The checks ran on 23d1d7045b. main has since gained one commit, a release CI change (ci(release): keep release Rust caches from being evicted #3665) that touches neither spec. The branch was not rebased.
  • Human testing. No human has tested this, so the review-completed marker is not set.

Not included, and related PRs

🤖 Generated with Claude Code

Two WebKit journeys fail now and then in CI on branches that cannot
affect them. Both are races in the tests, not product defects. This
changes the two spec files only; no production code.

relay-recovery.spec.mjs: wait for the open channel's own refused read

The test cuts the network, waits for the open channel's catch-up read
to meet the outage, jumps the clock 30 s and expects the connection
notice to stay up. The wait accepted a refused /query from any
community. CI traces show the second community's background reads
refused first, so the clock jumped before the open channel's read was
refused. The notice then cleared once the live socket returned, and the
later refusal started a fresh 30 s timer that the test's clock never
advances. The failure is toBeInViewport "element(s) not found" on the
notice, for example run 43995560292 job 133746953063 (webkit 5/18). It
began after PR #3459 added a background session for other communities.

The wait now passes only when a refused primary /query carries the open
channel's timeline head. The filter test is the one isChannelHead uses
in src/features/relay/session.ts, depth_limit clause included. The
comment above the wait already asked for this; the condition now does
what it says.

solo-legacy-invitation.spec.mjs: seed the colour mode before boot

Each colour-mode pass did goto, a localStorage write, then reload about
40 ms later, while the app was still booting. In WebKit that reload can
fail the document request with "WebKit encountered an internal error"
(run 43995560292 job 133746953195, webkit 6/18). PR #1972 fixed the same
pattern in settings.spec.mjs and account-profile.spec.mjs. As there, the
mode is now written by an init script before the document loads, and
the boot reload is gone. The second pass adds a second script; scripts
run in the order added, so the last mode wins. The reload the test is
about, after Retry, is unchanged, and the existing data-color-mode
assertion still proves each pass booted in its mode.

Not touched: find-on-screen.spec.mjs. Its race is fixed by a commit in
open PR #3647.

Evidence. All local, macOS 27.2, Playwright 1.63.0, on 23d1d70 plus
this change, with --no-deps and the config's two workers. Hosted CI
runs Linux WebKit and was not run.

relay-recovery, forced ordering. Temporary copies of the spec outside
the repository, each with the same two additions: a refused
second-community /query recorded at the moment of the outage, and a one
second pause before the toBeInViewport assertion, as on a slower runner.

- Previous wait (the spec at 23d1d70): 20 of 20 fail, 10 Chromium
  and 10 WebKit, every one at the toBeInViewport assertion with
  "element(s) not found", the CI error.
- New wait (the spec in this commit): 20 of 20 pass, 10 Chromium and 10
  WebKit.

relay-recovery, unforced. The committed spec with --repeat-each=10:
20 of 20 pass, 10 Chromium and 10 WebKit.

solo-legacy-invitation. The committed spec with --repeat-each=10:
20 of 20 pass, 10 Chromium and 10 WebKit. There is no fail-before run:
the CI failure has not been reproduced on macOS WebKit, so these runs
show the journey still works, not that the flake is gone. That proof is
the error staying absent from CI.

One guard check for the new seeding, in a temporary copy with the init
script removed: the "dark" pass fails on both engines at the
data-color-mode assertion (expected "dark", received "light"). So the
init script is what sets the mode, and that assertion is live.

Static checks, in the new worktree:

- pnpm typecheck (tsc --noEmit) passed.
- pnpm lint (biome lint --error-on-warnings plus the icon check)
  passed. It reports 39 infos, none in the touched files.
- biome format on the two files reports no changes.
- git diff --check is clean.

Not run: the rest of the browser suite, the unit tests, and any hosted
CI job.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@matt2e
matt2e requested a review from a team as a code owner November 17, 2026 02:40

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤖 Star Lord: no blocking findings at fd57e82; recommend approval once required CI passes. Source review only; CI was still running at the single status snapshot.

@matt2e
matt2e merged commit 90eef5b into main Nov 17, 2026
93 of 95 checks passed
@matt2e
matt2e deleted the deflake-relay-recovery-solo-invitation branch November 17, 2026 03:56
tellaho added a commit that referenced this pull request Nov 17, 2026
Co-authored-by: Carl <acda9e433d19dcd0e6b6840f7f4b98f3a56f1fab98049d444c087019e6d36560@feedback.communities.buzz.xyz>

* origin/main:
  test(browser): deflake relay-recovery and solo-legacy-invitation (#3681)
  Align message and composer typography (#2990)
  fix(repos): fix commit counts, file sizes and commit heading copy (#3686)
  fix(usage): count standalone timer and watch turns (#3518)
  Avoid rewriting unchanged artifact indexes (#3672)
  ci(release): keep release Rust caches from being evicted (#3665)
  Give the community join dialog a navigation visit (#3063)

Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
joshfriend added a commit that referenced this pull request Nov 17, 2026
…-navigation

* origin/main: (41 commits)
  fix: open threads at the first unread reply (#3689)
  Share channel media viewers and icons with panels (#3626)
  ci(deny): accept the chrono and humantime unmaintained advisories (#3710)
  feat(messages): forward readable message snapshots (#3631)
  ci(release): cache Rust in the Linux release build (#3692)
  feat(agents): transparent emoji avatar background (#2895)
  feat(agents): pan and zoom agent avatars (#2611)
  feat(agents): expose safe model settings in agent_read (#3639)
  fix(codex): steer waiting messages into one turn instead of a turn each (#3624)
  feat(builderlab): read a remote agent's stored sessions (#3601)
  ci: give Chromium shards headroom so 7/9 stops hitting the job cap (#3691)
  fix(agents): drop "Work with unconfirmed thread" from the Working now card (#3693)
  test(browser): deflake relay-recovery and solo-legacy-invitation (#3681)
  Align message and composer typography (#2990)
  fix(repos): fix commit counts, file sizes and commit heading copy (#3686)
  fix(usage): count standalone timer and watch turns (#3518)
  Avoid rewriting unchanged artifact indexes (#3672)
  ci(release): keep release Rust caches from being evicted (#3665)
  Give the community join dialog a navigation visit (#3063)
  feat(plugins): expose the host sharing picker (#2761)
  ...

Signed-off-by: Josh Friend <jfriend@block.xyz>

# Conflicts:
#	src/bundled/channels/PageTabs.tsx
joshfriend added a commit that referenced this pull request Nov 17, 2026
* origin/main: (50 commits)
  Remove the bundled Todos plugin (#3729)
  Name GitHub panel tabs after the pull request (#3712)
  fix: open threads at the first unread reply (#3689)
  Share channel media viewers and icons with panels (#3626)
  ci(deny): accept the chrono and humantime unmaintained advisories (#3710)
  feat(messages): forward readable message snapshots (#3631)
  ci(release): cache Rust in the Linux release build (#3692)
  feat(agents): transparent emoji avatar background (#2895)
  feat(agents): pan and zoom agent avatars (#2611)
  feat(agents): expose safe model settings in agent_read (#3639)
  fix(codex): steer waiting messages into one turn instead of a turn each (#3624)
  feat(builderlab): read a remote agent's stored sessions (#3601)
  ci: give Chromium shards headroom so 7/9 stops hitting the job cap (#3691)
  fix(agents): drop "Work with unconfirmed thread" from the Working now card (#3693)
  test(browser): deflake relay-recovery and solo-legacy-invitation (#3681)
  Align message and composer typography (#2990)
  fix(repos): fix commit counts, file sizes and commit heading copy (#3686)
  fix(usage): count standalone timer and watch turns (#3518)
  Avoid rewriting unchanged artifact indexes (#3672)
  ci(release): keep release Rust caches from being evicted (#3665)
  ...
joshfriend added a commit that referenced this pull request Nov 17, 2026
…ation-links

* origin/main: (75 commits)
  Sidebar sections contributed by plugins, no visible change. (#3695)
  feat(dms): add people and agents to a DM (#2670)
  feat(search): revamped search UI with ranked groups, preview (#3547)
  fix(github): read pull request states in small requests so checks survive many links (#3713)
  Remove the bundled Todos plugin (#3729)
  Name GitHub panel tabs after the pull request (#3712)
  fix: open threads at the first unread reply (#3689)
  Share channel media viewers and icons with panels (#3626)
  ci(deny): accept the chrono and humantime unmaintained advisories (#3710)
  feat(messages): forward readable message snapshots (#3631)
  ci(release): cache Rust in the Linux release build (#3692)
  feat(agents): transparent emoji avatar background (#2895)
  feat(agents): pan and zoom agent avatars (#2611)
  feat(agents): expose safe model settings in agent_read (#3639)
  fix(codex): steer waiting messages into one turn instead of a turn each (#3624)
  feat(builderlab): read a remote agent's stored sessions (#3601)
  ci: give Chromium shards headroom so 7/9 stops hitting the job cap (#3691)
  fix(agents): drop "Work with unconfirmed thread" from the Working now card (#3693)
  test(browser): deflake relay-recovery and solo-legacy-invitation (#3681)
  Align message and composer typography (#2990)
  ...

Signed-off-by: Josh Friend <jfriend@block.xyz>

# Conflicts:
#	src/features/channel-navigation/ChannelInventory.test.tsx
wpfleger96 added a commit that referenced this pull request Nov 17, 2026
* origin/main: (93 commits)
  fix(unread): narrow a full evidence window instead of emptying it (#3716)
  Sidebar sections contributed by plugins, no visible change. (#3695)
  feat(dms): add people and agents to a DM (#2670)
  feat(search): revamped search UI with ranked groups, preview (#3547)
  fix(github): read pull request states in small requests so checks survive many links (#3713)
  Remove the bundled Todos plugin (#3729)
  Name GitHub panel tabs after the pull request (#3712)
  fix: open threads at the first unread reply (#3689)
  Share channel media viewers and icons with panels (#3626)
  ci(deny): accept the chrono and humantime unmaintained advisories (#3710)
  feat(messages): forward readable message snapshots (#3631)
  ci(release): cache Rust in the Linux release build (#3692)
  feat(agents): transparent emoji avatar background (#2895)
  feat(agents): pan and zoom agent avatars (#2611)
  feat(agents): expose safe model settings in agent_read (#3639)
  fix(codex): steer waiting messages into one turn instead of a turn each (#3624)
  feat(builderlab): read a remote agent's stored sessions (#3601)
  ci: give Chromium shards headroom so 7/9 stops hitting the job cap (#3691)
  fix(agents): drop "Work with unconfirmed thread" from the Working now card (#3693)
  test(browser): deflake relay-recovery and solo-legacy-invitation (#3681)
  ...

# Conflicts:
#	src/features/relay/unread.test.ts
#	src/features/relay/unread.ts
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