From 32805bf3d47ebd90e42a750438894bdc0d919b75 Mon Sep 17 00:00:00 2001 From: Edgar Arakelyan Date: Thu, 19 Nov 2026 00:33:17 -0800 Subject: [PATCH] test(computers): a browser recording's video may go blank at each of its tab switches, not at one alone test_each_context_is_recorded_alone_its_video_following_its_agent_while_agents_act_on_all_at_once failed on main twice on 11-18 (runs of 03:26 and 17:09 UTC) with the buyer's video holding 4 white frames: 3 at its first tab switch and 1 at its second. The test requires the video to follow exactly two switches, and a switch is blank until the new tab's first frame arrives, but it allowed 3 white frames in the whole video. It now allows a blank of at most 3 frames at each switch, and no more blanks than switches; the other videos, which switch no tab, keep the limit of 3. Co-Authored-By: Claude Opus 5.5 --- tst/integration/computer/browser_recorded.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tst/integration/computer/browser_recorded.py b/tst/integration/computer/browser_recorded.py index 8522aa308..2bd93898e 100644 --- a/tst/integration/computer/browser_recorded.py +++ b/tst/integration/computer/browser_recorded.py @@ -8,6 +8,7 @@ import asyncio import io +import itertools import json import subprocess import uuid @@ -95,6 +96,11 @@ def _colors(files: dict[str, bytes], prefix: str) -> list[str]: return found +def _runs(frames: list[str], color: str) -> list[int]: + """How many frames long each run of ``color`` in ``frames`` is.""" + return [len(list(run)) for shown, run in itertools.groupby(frames) if shown == color] + + def _registered(entry: dict) -> dict[str, bytes]: universe = Artifact.get(entry["artifact"]["id"], version=entry["artifact"]["version"]) objects = get_config().get_object_store() @@ -158,10 +164,12 @@ async def cdp(user: str, label: str | None) -> dict: # A tab switch is blank until the new tab's first frame arrives: a few white frames, never another context's colour. assert set(colors["buyer"]) - {"white"} == {"red", "orange"} and colors["buyer"][-1] == "red", colors["buyer"] assert set(colors["seller"]) - {"white"} == {"blue"} and set(colors["default"]) - {"white"} == {"green"}, colors - assert all(colors[name].count("white") <= 3 for name in colors), colors tabs = [seen["tab"] for seen in manifests["buyer"]["video"]["followed"]] followed = [tab for n, tab in enumerate(tabs) if n == 0 or tab != tabs[n - 1]] assert len(followed) == 3 and followed[0] == followed[2] != followed[1], manifests["buyer"]["video"]["followed"] + blanks = _runs(colors["buyer"], "white") + assert len(blanks) <= len(followed) - 1 and all(blank <= 3 for blank in blanks), colors["buyer"] + assert all(colors[name].count("white") <= 3 for name in ("seller", "default")), colors assert [c["made_by"] for c in child] == ["bob"] and child[0]["missing"] is None, child assert set(_colors(files["seller"], child_prefix)) <= {"yellow", "white"}, child_prefix assert "yellow" in _colors(files["seller"], child_prefix)