Skip to content

test: cover the code host startup step and find Playwright's Chromium like cld - #495

Merged
ValentinKolb merged 2 commits into
mainfrom
test/code-host-startup-step
Oct 1, 2026
Merged

ValentinKolb merged 2 commits into
mainfrom
test/code-host-startup-step

Conversation

@ValentinKolb

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #493. Two test gaps around the CLI code host start:

  • The startup step in the deadline error had no test. test: start the CLI code host reliably on CI runners #493 made the 45-second startup error name the last step the code host child reported ("…exceeded 45 seconds while loading the host runtime…"). Nothing checked that wiring. If the child stopped sending progress, the browser host reordered its progress calls, or the parent stopped recording the step, the error would fall back to "starting the code host process" or name the wrong step. CI would stay green, and the next stalled start would be as opaque as run 36785664096.
  • The standalone cld test only found Playwright's Chromium through HOME. Since test: start the CLI code host reliably on CI runners #493 the test relies on Playwright's own browser lookup, like cld by default. That lookup reads PLAYWRIGHT_BROWSERS_PATH and, on Linux, XDG_CACHE_HOME before HOME. The test runs the compiled cld with a minimal environment and forwarded only HOME. So with browsers in a custom location it failed with "Code mode could not start Chromium", although cld itself works in that environment.

Change

  • packages/assistant/src/cli/code-host.test.ts: a new test starts the real child and Chromium and lets the runtime download hang. It then fires the 45-second deadline with fake timers and expects the error to name "loading the host runtime". It takes about 1 s.
  • packages/cloud-cli/src/standalone.test.ts: forwards PLAYWRIGHT_BROWSERS_PATH and XDG_CACHE_HOME to the child when they are set, the same way it already forwards CLOUD_CLI_CHROMIUM.

No runtime code changes. The deadline, retries, and timeouts stay as they were.

Docs

No Fibel or cloud-dev skill change: this PR only changes tests. #493 already documented the behavior that the new test covers, in the Assistant app page and the cld Assistant reference.

Verification

  • The new test fails when the parent stops recording the reported step: it gets "…while starting the code host process…" instead of "…while loading the host runtime…".
  • The new test alone passed 10 times in a row, then 18 more times with six copies running in parallel, about 1 s each.
  • code-host.test.ts (20 tests) passed in 4 of 5 local runs. The failing run happened while other work kept the machine's load average around 14. Its log was truncated, so the failing test is unknown. The new test passed in every isolated and parallel run, and it calls no page.evaluate, so it cannot have caused the leftover "Target page, context or browser has been closed" error from that run.
  • Standalone test: passes as before. With HOME pointing to an empty directory and PLAYWRIGHT_BROWSERS_PATH set, the version on main fails with "Code mode could not start Chromium". This branch passes.
  • bun run check passes, and git diff --check is clean. No server code changed, so there is no integration suite to run.

The startup deadline error names the last step the code host child
reported, but nothing checked that wiring. A refactor that dropped the
progress callback in the child, reordered the progress calls in the
browser host, or stopped recording the step in the parent would fall
back to "starting the code host process" or name the wrong step while CI
stayed green, and the next CI stall would be as opaque as run
36785664096.

The test starts the real child and Chromium, lets the runtime download
hang, and fires the 45-second deadline with fake timers. It expects the
error to name "loading the host runtime". Each of the three regressions
above makes it fail.
…tandalone test

The standalone test runs the compiled cld with a minimal environment and,
since it stopped falling back to a system Chrome, relies on Playwright's
own browser lookup. That lookup reads PLAYWRIGHT_BROWSERS_PATH and, on
Linux, XDG_CACHE_HOME before HOME. Only HOME was passed through, so with
browsers in a custom location the child failed with "Code mode could not
start Chromium" although cld itself works in that environment.

Forward those two variables when they are set, like CLOUD_CLI_CHROMIUM.
@ValentinKolb
ValentinKolb enabled auto-merge October 1, 2026 00:51
@ValentinKolb
ValentinKolb added this pull request to the merge queue Oct 1, 2026
Merged via the queue into main with commit ea2056b Oct 1, 2026
17 checks passed
@ValentinKolb
ValentinKolb deleted the test/code-host-startup-step branch October 1, 2026 01:14
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