Skip to content

ci(browser): run a failed browser script once more and report it as flaky - #1002

Merged
devswha merged 1 commit into
mainfrom
ci/browser-retry-once
Oct 14, 2026
Merged

devswha merged 1 commit into
mainfrom
ci/browser-retry-once

Conversation

@devswha

@devswha devswha commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Change

CI's browser lanes failed about three in ten runs over the last day (57 of 192 jobs on the self-hosted runner, 29 of 89 on GitHub's before that), on main as on pull requests, at more than twenty different places. Until those races are fixed one by one (#984, #985 and the four in the companion PR are a start), every PR waits on reruns by hand.

scripts/ci-browser-parallel.ts now runs a failed script a second time. A script that then passes does not fail the lane, and is not hidden as a pass either:

  • its first log is kept as <script>.attempt-1.log (uploaded with browser-logs) and its last 400 lines are printed;
  • the summary marks it ~, and summary.json lists it under flaky with the first log's path;
  • on GitHub it gets a warning annotation and a line in the job summary.

A script that fails twice fails the lane as before. BROWSER_RETRY=0 turns the second run off. The serial lane (ci-browser.sh, bun run check browser) is unchanged: it still stops at the first failure.

The cost is real and worth saying: a failure that only happens sometimes can now merge. That is why a flaky pass is loud. This keeps one PR from waiting on another change's race; it does not make a race acceptable.

Validation

  • macOS arm64, Bun 1.4.0. bun run typecheck: pass. scripts/pages-gate.test.ts (new case for scriptOutcome), conventions.test.ts, changelog-fold.test.ts: 40 pass.
  • Run for real with BROWSER_SCRIPTS=scripts/deep-link-demo-regression.ts bun scripts/ci-browser-parallel.ts and a throwaway line that made that script exit 1:
    • failing on its first run only: exit 0, FLAKY line, ~ in the summary, flaky: ["scripts/deep-link-demo-regression.ts"] in summary.json, both logs present, the ::warning line and the job-summary text written;
    • failing every time: exit 1, "FAILED … (exit 1, twice)";
    • failing on its first run with BROWSER_RETRY=0: exit 1 after one run.
  • Not run locally: the lanes themselves beyond that one script.

…laky

A script that fails and then passes no longer fails the lane, and is not a plain pass: its first log is kept and printed, summary.json lists it, and GitHub gets a warning annotation and a job summary line. Two failures still fail the lane; BROWSER_RETRY=0 turns the second run off.
@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 06ace9be-6c0d-4c6b-bbc2-783f7f9c10b6
📥 Commits

Reviewing files that changed from the base of the PR and between 6f87b20 and a39901c.

📒 Files selected for processing: 4
  • changelog.d/browser-lane-reruns-a-failed-script.md
  • docs/development.md
  • scripts/ci-browser-parallel.ts
  • scripts/pages-gate.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devswha
devswha merged commit f3cbf59 into main Oct 14, 2026
9 checks passed
@devswha
devswha deleted the ci/browser-retry-once branch October 14, 2026 00:32
devswha added a commit that referenced this pull request Oct 14, 2026
…1009)

## Change

Since #1002 a browser script that fails is run once more and a pass on the second run is reported as flaky. Two things were still missing for whoever maintains the lanes.

**The report did not say what failed.** "FLAKY scripts/ui-regression.ts" names a script with 65 checks. The lane now reads the failed run's log for the first error line and the first stack frame in `scripts/`, and puts both in the console line, the warning annotation, the job summary and `summary.json`:

```
::warning title=Flaky browser script::scripts/ui-regression.ts: scripts/terminal-input-regression.ts:65: AssertionError: input regression timed out failed once and passed when run again. …
```

A script that fails twice gets an `::error title=Browser script failed::` annotation with the same, which it did not have. A log with no recognisable error is reported as before, by script alone.

**Nothing counted failures across runs.** `bun scripts/ci-flakes.ts [--hours 24] [--repo owner/name] [--json]` reads recent `ci.yml` runs through `gh`, every attempt of each, and prints each script and failing site with how often it failed and how often it passed only on a second run, most frequent first. It changes nothing. A failed job's log is read; a passed job's only when it carries the flaky warning, so 30 hours of this repository (242 runs, 516 browser jobs) take about 100 seconds instead of more than five minutes.

What it shows today, first rows of `--hours 30`:

| failed | flaky | script | site |
|---|---|---|---|
| 14 | 1 | ui-regression | terminal-input-regression.ts:65 (fixed in #1001) |
| 11 | 0 | ui-contexts-regression | split-view-regression.ts:81 |
| 10 | 0 | chat-virtual-browser-qa | chat-virtual-browser-qa.ts:169 |
| 9 | 0 | pane-paging-demo-regression | pane-paging-demo-regression.ts:279 |
| 8 | 0 | prompt-dock-demo-regression | (no script frame in the log) |

No change to which scripts run, to the second run, to exit codes or to what gates a merge.

## Validation

- macOS arm64, Bun 1.4.0. `bun run typecheck`: pass. `scripts/ci-flakes.test.ts` (new), `pages-gate.test.ts` (new cases for `failureSite`), `conventions.test.ts`, `changelog-fold.test.ts`: 0 fail. With `failureSite` made to return no site, 8 of those cases fail.
- The lane, run for real with `BROWSER_SCRIPTS=scripts/deep-link-demo-regression.ts GITHUB_ACTIONS=true bun scripts/ci-browser-parallel.ts` and a throwaway line that made that script fail:
  - an assertion on the first run only: exit 0, the FLAKY line, the `::warning`, the job summary and `summary.json` all carry `scripts/deep-link-demo-regression.ts:10` and `AssertionError: scratch forced failure`;
  - the assertion on both runs: exit 1, `::error title=Browser script failed::` with the same;
  - `process.exit(1)` with nothing printed, first run only: exit 0, reported flaky by script alone, no "null" or "undefined".
- `bun scripts/ci-flakes.ts --hours 30` against this repository: exit 0 in 103 s; lists `scripts/ui-regression.ts` as flaky for run 38490957637 and the pre-retry failures. `--json` parses. With `GH_TOKEN` set to a bad token it prints `gh: Bad credentials (HTTP 401)` and exits 1.
- Not run locally: the integration lane and the browser lanes as a whole.
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.

1 participant