Repository navigation
test(sandbox): cover the Playwright MCP launcher's start-time paths - #5119
Closed
tale-code-bot wants to merge 6 commits into
Closed
tale-code-bot wants to merge 6 commits into
tale-code-bot wants to merge 6 commits into
Conversation
The launcher tests spread process.env into every launcher they spawn. A developer who exported TALE_PLAYWRIGHT_MCP_EAGER=1 or a PLAYWRIGHT_MCP_* setting saw 8 of the 45 tests fail. One with a PLAYWRIGHT_BROWSERS_PATH of their own, which the managed-shell check reads, saw 2 fail. Every spawn now starts from the runner's environment less those settings. Refs #4160
The #4140 review found three start-time paths of the launcher that no test held. Each new test fails on its broken variant and passes on the launcher as it is: - A server that answers the replayed start outlives the deadline. With deadline.cancel() removed, it is SIGKILLed at the deadline and the launcher exits 137 mid-turn. - A notification sent before the server starts reaches it after the replayed start. The test fails when the launcher stops holding the notification or stops replaying it. - A request sent while the server starts reaches it after the request that started it. The test fails when lines after the start are dropped, or when the launcher answers a ping itself instead of the server. The stand-in's STAND_IN_HANG becomes STAND_IN_INIT_DELAY (seconds), so the hang and the slow start share one knob. The one-second-deadline loader is shared by both deadline tests. Refs #4160
When the started server answered the replayed initialize with an error, the launcher logged "the server speaks None, the client was told <v>". It now logs the refusal and the server's error. The turn still goes on: the client was already told the start succeeded. Each request still gets the server's own answer. Ending the server would turn one refused message into the loss of every browser tool for the turn. The test's stand-in refuses initialize under STAND_IN_INIT_REFUSED. On the launcher before this change the test fails with the "speaks None" line. Refs #4160
The #4140 review noted that configured_in_env matches any PLAYWRIGHT_MCP_ name, the Dockerfile's own build ARG PLAYWRIGHT_MCP_VERSION included. That is the intended trade, now stated where the match is made. A name the server ignores costs only the lazy start. A list of the names this server reads would miss one a later server adds, and answer from a stale manifest. Refs #4160
The image's container check compared the launcher's tool list and its prompt and resource list answers with the real server's, for every argument set. It never compared the initialize answer, as the #4140 review noted. It now compares that answer too, so a recorded start that drifts from the server it names fails the check with LAZY_INITIALIZE_DIFFERS. Refs #4160
The #4140 review noted that nobody had traced what Codex sends at the start of a turn. Traced from source at rust-v0.160.0, the image's pin, whose MCP client is rmcp 3.2.0, it sends: 1. initialize for 2025-06-18, with experimental and elicitation capabilities; 2. notifications/initialized; 3. one tools/list whose params carry only _meta.progressToken. Nothing else is sent before a tool call. The launcher answers all three without the server. The new test holds that, and it fails on a launcher that reads any tools/list params as a page request. Refs #4160
tale-review-bot
requested changes
Oct 29, 2026
tale-review-bot
left a comment
Collaborator
There was a problem hiding this comment.
Requesting changes at 263e099e674e3f54df119a649990003327a01aef. Nothing in the code needs to change: a runner time limit cut off a required check.
- The code holds. The review found nothing.
bun test src/tale-playwright-mcp.test.tspasses 50/50, and still passes with the runner's Playwright settings exported.- Each new test fails on its broken variant:
deadline.cancel()removed, the hold removed, the refusal log reverted. - The base sources fail 8 of 45 with
TALE_PLAYWRIGHT_MCP_EAGER=1exported.
- Failed:
CI ready (SAST)(SAST run 40962786204). Its Opengrep job 123759594494 ran 22:21:55–22:37:13Z and was cancelled at its 15-minute limit, in "Verify scanner reporting and blocking behavior". This PR doesn't touch the scanner. Opengrep hits that limit across the repository under the current runner load. - The other runs on this head merge into
0da082051:- Checks 40962786301 passed every job it ran; its gate is still queued.
- Security, Commitlint and CLI are green.
- E2E and Build are still pending.
To make it right: run this PR's checks again at the same head (draft→ready), preferably once the Actions queue is shorter.
Contributor
|
The autonomous cycle now lands each task through the merge train instead of its own pull request ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #4160 (task TALE-68).
The independent review of #4140 (record) left three LOW findings and four INFO notes on the Playwright MCP launcher (
services/sandbox-runtime/tale-playwright-mcp). The LOW findings are start-time paths no test covered and runner environment leaking into the unit tests. This PR:The issue's line references are from
33aa991fe. Since then #4367 added the managed headless shell. Onmain(0da08205) the paths sit at::375-377: a notification is held;:397:deadline.cancel();:408-410: the held lines are replayed;:435-462:run().LOW findings
deadline.cancel()has no testSTART_TIMEOUT_S = 1: answer a call, wait 1.5 s, answer another. Expectsclose() == 0and empty stderr.deadline.cancel()is removed. The healthy server is SIGKILLed at 1 s, the launcher logsdid not answer its start within 1 sand exits 137, and the second call is never answered.notifications/roots/list_changedis sent before the first tool call and does not start the server. The server then sees the replayedinitialize,notifications/initialized, the notification and thetools/call, in that order.self.held.append) or the replay (for line in self.held) is removed.tools/calland apingare sent back to back while the stand-in takes 0.5 s to answer the replayedinitialize. Both reach the server, in order, and the server answers each exactly once.runnerEnv:process.envwithoutPLAYWRIGHT_MCP_*,TALE_PLAYWRIGHT_MCP_*andPLAYWRIGHT_BROWSERS_PATH. It replaces the three...process.envspreads.main, the suite fails 8/45 withTALE_PLAYWRIGHT_MCP_EAGER=1exported, 8/45 withPLAYWRIGHT_MCP_CAPS=visionand 2/45 withPLAYWRIGHT_BROWSERS_PATH=/home/dev/.cache/ms-playwright. At this head it passes 50/50 under each of them and under all of them together.PLAYWRIGHT_BROWSERS_PATHis not in the issue's list. #4367, which came after the review, made the managed-shell check read it, and Playwright users commonly export it; the worker this ran on exports it too.The stand-in's
STAND_IN_HANGbecomesSTAND_IN_INIT_DELAY(in seconds), so the hang test and the slow-start test share one knob. Both deadline tests share the one-second loader.INFO notes
configured_in_envmatches anyPLAYWRIGHT_MCP_name. Decision: keep it, and its docstring now says why.PLAYWRIGHT_MCP_VERSIONis anARGof theplaywright-buildstage (Dockerfile:328), so it never reaches a turn's environment, and noENVsets aPLAYWRIGHT_MCP_name.ENVwould fail the image check withLAZY_SERVER_STARTED_EARLY.The image check never compared
initialize. Fixed.container-sandbox-runtime-test.tsnow compares the lazyinitializeresult with the real server's for every argument set, and fails withLAZY_INITIALIZE_DIFFERSwhen they differ.A replayed
initializethat errors logged "speaks None" and carried on. Fixed: the launcher now logsthe server refused its start: <the server's error>. It still carries on, and that is the decision:What Codex sends at start was not traced. Traced from source at
openai/codexrust-v0.160.0, the image'sCODEX_VERSION. Its MCP client isrmcp3.2.0 (codex-rs/Cargo.toml:446). With the default config it sends three messages:initializefor2025-06-18, withexperimental: {"codex/auth-change": {}}andelicitation(codex-rs/codex-mcp/src/rmcp_client.rs:1105-1128);notifications/initialized;tools/listwhose params carry only_meta: {"progressToken": 0}(rmcpcrates/rmcp/src/service.rs:880-893).In the default protocol mode it does not follow
nextCursor(rmcp_client.rs:675-678). It sends nothing else before a tool call;resources/*goes out only when the model asks for it. The launcher answers all three without the server. The new test Codex's start is answered as the server would, still without it holds that, and it fails on a launcher that reads anytools/listparams as a page request. This is a source trace only: the Codex binary was not run.services/platform/tests/manual/reference/automation.md(the launcher's row) now names the new coverage, the refusal log and theinitializecomparison.Checklist
bun run check: not run in full here, because it covers the whole monorepo; CI's Checks run it at this head. Run here on the touched workspaces:bun test): 635 pass, 10 skip, 4 fail at this head. The same 4 fail onmain's own sources (0da08205) in this worker. Three build the exec shim with a C compiler, which this worker lacks. The fourth expects a/healthzwithout the memory and egress fields that this worker's cgroup and environment add. None of the four touches the launcher;oxfmt --checkandoxlinton the changed files: clean;bun run lint:manual: ok;bun run lint:sast: not run locally. Its script downloads the Opengrep binary outside any lock file, and the commit hook skipped it as uncached. The SAST workflow runs it on this PR.README.md/README.de.md/README.fr.md: N/A.services/sandbox-runtime/README.mddoesn't describe the logs and needs no change.Test plan
In
services/sandbox-runtime/daemon:bun test src/tale-playwright-mcp.test.tspasses 50/50.TALE_PLAYWRIGHT_MCP_EAGER=1,PLAYWRIGHT_MCP_CAPS=visionorPLAYWRIGHT_BROWSERS_PATH=/elsewhereexported, the suite still passes 50/50. The same exports onmainfail 8, 8 and 2 tests.263e099e674e3f54df119a649990003327a01aef:deadline.cancel()removedself.held.append(line)removedthe server speaks None, the client was told 2025-06-18.tools/listparams read as a page requestinitializecomparison was run outside Docker: the node script fromcontainer-sandbox-runtime-test.ts, with the suite's stand-in asmcp-server-playwrightand this launcher astale-playwright-mcp.MCP_LAZY_OK.initializeclaims server version 0.0.40 against the server's 0.0.41, it fails withLAZY_INITIALIZE_DIFFERS.mainpasses over that drift.