Repository navigation
Test Workshop against a real Gateway, its window, and two Pack joins - #32
rogers-andrew wants to merge 8 commits into
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
bb354be to
1368f4b
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The live-test helpers can select non-chat models, mistake WebDriver errors for successful results, and leave descendant processes running after teardown.
3 open issues
What changed in this PR
Adds test coverage for Workshop’s Pack configuration and its integration with a real Gateway, model, and desktop window. No production code changes.
Changes:
- Adds two default-run regression tests for MCP configuration and per-call Gateway lookup.
- Adds ten opt-in live tests covering agent runs, authentication, Gateway failure, program discovery, and window behavior.
- Documents test setup, platform requirements, and verification results.
| File | Description |
|---|---|
plan/2026-11-20-1-pack-hand-offs-and-real-gateway.plan.md |
Records scope, test design, and verification results. |
crates/workshop/server/tests/it/main.rs |
Registers live-test modules with platform gates. |
crates/workshop/server/tests/it/live.rs |
Adds six real-Gateway agent socket tests. |
crates/workshop/server/tests/it/live_window.rs |
Adds window typing and close-behavior tests. |
crates/workshop/server/tests/it/live_stop.rs |
Tests interrupted streaming and continued server operation. |
crates/workshop/server/tests/it/live_program.rs |
Tests Gateway discovery and chat through the Workshop program. |
crates/workshop/server/src/agents/tests.rs |
Checks configured MCP servers reach the Pack. |
crates/workshop/server/src/agents/tests-gateway.rs |
Checks web searches use the currently registered Gateway. |
Review effort: Balanced
| if matches!(self.0.try_wait(), Ok(Some(_))) { | ||
| return; |
| .json() | ||
| .await | ||
| .ok()?; | ||
| let model = listed["data"][0]["id"].as_str()?.to_owned(); |
| .await? | ||
| .json() |
1368f4b to
1a79c7a
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The live tests can load an executable-adjacent configuration and modify unrelated Workshop state, while model-selection, process-cleanup, and timeout defects can also cause failures or hangs.
6 open issues
Prevent tests from loading adjacent real configuration · New Probe a chat-capable model during readiness checks · New Bound the final probe to prevent test hangs · New Reject failed WebDriver responses before decoding results Filter catalog to chat-capable models before selection Clean up the process group even if the supervisor exited
Review effort: Balanced
| /// listens on, so a Gateway the program uses can only be one it found | ||
| /// through a discovery file or started itself. | ||
| pub(crate) fn settings_folder() -> tempfile::TempDir { | ||
| let folder = tempfile::TempDir::new().expect("tempdir"); |
| .await; | ||
| if let Ok(listed) = listed | ||
| && let Ok(body) = listed.json::<serde_json::Value>().await | ||
| && let Some(model) = body["data"][0]["id"].as_str() |
| .expect("Workshop stops serving its page once its window is closed"); | ||
|
|
||
| assert!( | ||
| answering_model(&base_url, &key).await.is_some(), |
Two joins in the code that builds Workshop's Host can be broken while every test passes: the one that hands the mcp Pack its configured servers, and the one that lends a web search the Gateway registered when the search starts. And nothing runs Workshop against a real Gateway. The plan adds two tests that run in a normal test run, with the three breaks that must fail them, and ten that are ignored unless asked for. Those ten run against a real Gateway whose chat model is CheapSeek, a test server that answers by rule. Plan: /plan/2026-11-20-1-pack-hand-offs-and-real-gateway.plan.md Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`server_host` reads the servers of the configured `mcp.json` and hands them to the mcp Pack. With an empty object handed over in their place, every test passed. One test now builds the Host from a file that names two servers and reads the Pack's listing of them. No production code changes. - `the_servers_of_the_configured_mcp_file_reach_the_mcp_pack`: a prompt that requires the mcp Pack and lists its servers returns `docs,search`, the two the file names. - The servers point at a loopback port where nothing listens, so the test starts no server. The listing names a server whatever its status. Plan: /plan/2026-11-20-1-pack-hand-offs-and-real-gateway.plan.md Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`a_prompts_web_search_asks_the_gateway_registered_when_the_search_starts` builds Workshop's Host under one stand-in Gateway, replaces it with a second, and runs a prompt whose script calls `web/search` through the web library. The answer must hold the second Gateway's results, under the second Gateway's key, marked as untrusted. No production code changes. The key check of the file's stand-in Gateways is now one helper, `carries`. Plan: /plan/2026-11-20-1-pack-hand-offs-and-real-gateway.plan.md Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Six tests bind Workshop's router to the Gateway that `RUNVIL_E2E_GATEWAY` names, launch an agent over the agents socket, and read the frames a client reads. Each is ignored unless asked for, because it needs a running Gateway that serves a chat model. The model they are run on is CheapSeek, a test server that answers by rule, which the Gateway reaches as a remote endpoint. No production code changes. - The shipped hello prompt ends with text. - The built-in chat agent recalls a name from an earlier message. - A prompt that drafts under `creative` and critiques under `strong` gets two replies. - A model calls a tool the prompt offers, and the round after the call replies. - A larger prompt with an argument, the store, a tool, and a fanout of two tasks gets three replies. - A request with no key is answered 401, and Workshop's own run still ends with text. The tests share one Gateway, so they are run one at a time with `-j 1`. Plan: /plan/2026-11-20-1-pack-hand-offs-and-real-gateway.plan.md Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
One test starts the Gateway program that `RUNVIL_E2E_GATEWAY_BIN` names, launches an agent whose reply is 100,000 pieces long, and kills every process of the Gateway once the reply has started. It is ignored unless asked for, it refuses to start when a Gateway already answers at the address, and the module is built on Unix only. No production code changes. - The client reads an error frame that says the model turn failed. - The run log records the run as ended with an error. - Workshop still lists its agents and acknowledges a launch, and says the model catalog could not be fetched. The reply is scripted. The agent's one message is a `say` directive of 100,000 dots, which CheapSeek sends back one dot to a piece. CheapSeek answers a plain request at once, so no other reply is still in flight when the kill lands. The Gateway is killed, not asked to stop: its `POST /shutdown` lets a reply in flight finish, so a run sees no failure from it. The kill goes to a process group, because the program the test starts only supervises the process that serves: with the supervisor alone killed, the serving process shuts down in good order, and a short reply finishes first. Four helpers of the `live` module become visible to the test crate so this module can use them. Plan: /plan/2026-11-20-1-pack-hand-offs-and-real-gateway.plan.md Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
One test starts the program that `RUNVIL_E2E_WORKSHOP_BIN` names, with the home folder of a Gateway that is already running, and talks to the program's local server. It is ignored unless asked for, and the module is built on Linux only. No production code changes. - `GET /gateway/origin` answers the running Gateway's address. The settings file names an address nothing listens on, so the answer can only have come from the Gateway's discovery file. - The built-in chat agent, launched over the agents socket, replies to one message. The program is started in a session of its own, on a display that `xvfb-run` makes and a message bus that `dbus-run-session` makes, without `WAYLAND_DISPLAY`. So no window opens on the person's screen, and the program's single-instance check cannot reach a Workshop the person has open. The test kills the whole session when it ends and waits until it is empty. Plan: /plan/2026-11-20-1-pack-hand-offs-and-real-gateway.plan.md Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Two tests start `tauri-driver` on a display and a message bus of their own and have it open the Workshop program's window. They speak WebDriver with the HTTP client the suite already uses. Both are ignored unless asked for, and the module is built on Linux only. No production code changes. - `a_message_typed_in_the_workshop_window_gets_a_reply_in_the_chat_panel`: with a Gateway running, a message typed in the chat box shows in the chat panel, followed by a reply. The test types once the model picker names the Gateway's model and the chat box's button offers to send, because Workshop ignores Enter until the agent's run has started. - `closing_workshops_window_leaves_the_gateway_it_started_answering`: with no Gateway running, Workshop starts the one beside it; the test clicks the title bar's Close button, Workshop stops serving, and the Gateway still answers a chat request. The test clicks once the model picker names the Gateway's model, because a click on a page that is still loading does nothing. The helpers of `live_program.rs` that start a program in a session of its own now take any command, so both modules share them. Plan: /plan/2026-11-20-1-pack-hand-offs-and-real-gateway.plan.md Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Each of the three breaks fails the test the plan names, on `upstream/master` at `3c12833c`. The ten tests that need a real Gateway pass there with CheapSeek as the chat model. The plan also records what the earlier runs on a small local model found, the tests that were corrected after failing some runs, what the runs found about Workshop and the Gateway, the one test that fails on unchanged code, and which checks ran locally and which in CI. Plan: /plan/2026-11-20-1-pack-hand-offs-and-real-gateway.plan.md Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
1a79c7a to
c002d7d
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved test-harness defects can leave child processes running, mask WebDriver failures, hang requests indefinitely, and permit false-positive or configuration-dependent results.
9 open issues
Prevent tests from loading adjacent real configuration Require tool_call, tool_call_update, and the final reply in order · New Prevent adjacent workshop.toml from overriding isolated test settings · New Check WebDriver HTTP status before decoding command results · New Bound the final probe to prevent test hangs Probe a chat-capable model during readiness checks Reject failed WebDriver responses before decoding results Filter catalog to chat-capable models before selection Clean up the process group even if the supervisor exited
Review effort: Balanced
| let called = kinds.iter().position(|kind| kind.starts_with("tool_call")); | ||
| let replied = kinds.iter().rposition(|kind| *kind == "agent_message"); | ||
| assert!( | ||
| called.is_some() && called < replied, | ||
| "the model calls the tool, and a reply follows the call: {kinds:?}" | ||
| ); |
| std::env::var("RUNVIL_E2E_WORKSHOP_BIN") | ||
| .expect("RUNVIL_E2E_WORKSHOP_BIN is the Workshop program to start") |
| .send() | ||
| .await? |


This pull request adds twelve tests to
workshop-server, the crate that holds Workshop's server. The only files it touches are seven test files and the plan, the document that states what the change does and how it was checked.Of the twelve, two run in every normal test run. I wrote each of the two against a break, which is a deliberate fault put into the code that sets up Workshop's Packs. The existing tests gave the same results with the break in place as without it, and the new test fails. The other ten are live tests: they run Workshop against a real Gateway, through Workshop's server, through the Workshop program, and through Workshop's window. They are marked
#[ignore], so a normal test run skips them, and a person runs them by hand. The chat model behind the Gateway is CheapSeek, a test server that speaks the OpenAI chat API and computes each reply from fixed rules.The live runs also showed that Workshop could not start a Gateway built from the Gateway repository's
masterat commit52fd92d: that Gateway exited after it had waited ten seconds for a lock that Workshop held. Separately, one existing test ofworkshop-server,stalled_browser_cleanup_is_bounded_after_gateway_disconnect, fails on Linux on unchanged code.Terms
/agents/wsWebSocket of Workshop's server. A client such as Workshop's page launches an agent and reads its replies over it.mcp.jsonfile.#[ignore], so a normal test run skips it.saydirective: text in a message that makes CheapSeek send back the text the directive holds.strong, by which a prompt asks for a kind of model.The two tests that always run check what Workshop gives its mcp and web Packs
the_servers_of_the_configured_mcp_file_reach_the_mcp_packcrates/workshop/server/src/agents/tests.rsa_prompts_web_search_asks_the_gateway_registered_when_the_search_startscrates/workshop/server/src/agents/tests-gateway.rsEach of the two tests fails under a break that the existing tests let pass. A break is a deliberate fault that I put into the code to see whether any test fails. Under each of these two breaks, the existing tests gave the same results as on unchanged code, which showed that they did not check what the break changed. I reverted each break after its run.
Workshop must hand the configured MCP servers to the mcp Pack. An agent is a prompt that Workshop is running. An agent can get tools from MCP servers, which are servers that offer tools to a model over the Model Context Protocol. A person lists those servers in an
mcp.jsonfile, and the mcp Pack makes their tools available to prompts.server_host, the function incrates/workshop/server/src/agents.rsthat sets up Workshop's Packs, reads the file and hands its servers to the mcp Pack in one line. For the break, I changed that line to hand over an empty object. A Workshop with configured MCP servers then ran without them. The new test, the MCP test, writes anmcp.jsonthat names two servers, sets up the Packs, and checks that the mcp Pack lists both servers.Each web search must go to the Gateway that Workshop is using when the search starts. The web Pack sends each web search to a Gateway, and it gets that Gateway from Workshop. Workshop keeps the address and key of its current Gateway in a registry, and another Gateway can replace the current one while Workshop runs. Workshop reads the registry again as each tool call starts, so the next search after a replacement goes to the new Gateway. For the break, I changed the code to read the registry once, when Workshop sets up its Packs. Searches then kept going to the first Gateway after a second one replaced it. The new test, the web search test, uses two stand-in Gateways, which are small test servers that answer a search as a Gateway would. It sets up the Packs with the first one in the registry, replaces it with the second, runs a prompt that searches, and checks that the second one answered.
The plan has a third break, in which Workshop never gives the web Pack a Gateway. The web search test fails under it, and so does the existing test
a_message_sent_while_a_tool_call_runs_is_a_user_message_the_next_request_holds.The ten live tests run Workshop against a real Gateway
crates/workshop/server/tests/it/live.rscrates/workshop/server/tests/it/live_stop.rscrates/workshop/server/tests/it/live_program.rscrates/workshop/server/tests/it/live_window.rsBesides these four files and the two files of the MCP test and the web search test, this pull request touches
crates/workshop/server/tests/it/main.rs, which declares the four new modules.Socket tests. A client such as Workshop's page launches an agent and reads its replies over the agents socket, which is the
/agents/wsWebSocket of Workshop's server. Each of the six tests runs Workshop's server inside the test, points it at a running Gateway, launches one agent over the agents socket, and reads what a client would read. In five of the tests the agent is a different kind of prompt each time:hello.md;strongby which a prompt asks for a kind of model;The sixth test checks keys. With the Gateway set to require a key from every caller, a chat request sent without a key is refused with status 401, and Workshop's own run, which sends its key, still ends with a reply that is not empty.
Kill test. This test checks what Workshop does when the Gateway dies while a reply is streaming. It starts a Gateway, launches an agent whose reply is long enough to be cut off part way, and kills every process of the Gateway once the reply has started. It then checks three things: the client is told that the request to the model failed, Workshop's run log records the run as ended with an error, and Workshop still answers a new connection and a new launch.
Program test. This test starts the Workshop program beside a Gateway that is already running. It checks that the program finds that Gateway and reports its address, and that a chat with Workshop's built-in chat agent gets a reply.
Typing test and closing test. These two tests drive Workshop's real window through
tauri-driver, Tauri's WebDriver server. The typing test types a message in the chat box and reads the reply in the chat panel. The closing test has Workshop start a Gateway and closes the window with the Close button of the title bar that Workshop draws. Closing the window is meant to leave that Gateway running, so the test then checks that the Gateway still answers a chat request.The doc comment at the top of each of the four files gives the environment variables its tests read and the command that runs them. The program test and the two window tests start Workshop on a display of its own (
xvfb-run) and a message bus of its own (dbus-run-session), so the window stays off the screen of the person who runs the tests.With CheapSeek behind the Gateway, each live test passed every run
Before a live test runs, a person starts CheapSeek and adds it to the Gateway's settings as a remote endpoint with one chat model. The settings declare a context of 32,768 tokens for that model. CheapSeek's wording can change between its releases, so each test checks a property of the reply and never its exact words. For example, a test checks that the reply is not empty, that it contains a name given earlier, or that it follows a tool call.
The runs used CheapSeek release 1.1.0 and the current test code. The Gateway was built from
cppalliance/runvil-gatewayat commit52fd92d, with two exceptions. In the closing test Workshop starts the Gateway itself, and it started the Gateway release that Workshop is pinned to,gateway-v0.3.1. The kill test ran with both Gateways.gateway-v0.3.1Changes since review was requested: the live tests moved from Qwen3 0.6B to CheapSeek
The move was made on 2026-11-23. Before it, the live tests ran on Qwen3 0.6B, a small model that the Gateway loaded and ran itself. On that model the six socket tests took 22 to 25 seconds, and the kill test took about 5 seconds. With CheapSeek they take 2.5 to 2.7 seconds and 1.0 to 1.8 seconds.
Of the ten live tests, seven work with CheapSeek as they were written. Three changed, in
live.rs,live_stop.rs, andlive_window.rs:saydirective that holds 100,000 dots, so CheapSeek sends the dots back. CheapSeek sends its whole reply to an ordinary request at once, so such a reply is over before the test can kill the Gateway.The MCP test and the web search test are the same as before. For anyone who read the earlier commits: I rebuilt the branch, so its commits are new. The ones with new content are the first commit, which adds the plan, the three commits that add those three files, and the last commit, which adds the results to the plan.
The live runs showed a lost click, a Gateway that Workshop could not start, and one test that fails on unchanged code
document.readyStatewasinteractive, which means the page had not finished loading), the window stayed open, and a second click two seconds later closed it. I recorded this as a fault in the test, and the test now waits for the model picker before it clicks.master. I found this with the Gateway at commit52fd92dand Workshop'smasterat commit68c7249of 2026-11-20, an earlier base of this branch (four rebases ago). I have not tried it again since. Workshop takes a lock, the launch lock, before it starts a Gateway, and it holds the lock until that Gateway has written its discovery file. The discovery file is the file a running Gateway writes so that other programs can find it. The Gateway built frommastertries to take the same lock when it starts. It waits ten seconds and exits, and Workshop reports "the launched gateway exited (exit status: 1) without writing a gateway discovery file". Workshop can start the Gateway release it is pinned to.stalled_browser_cleanup_is_bounded_after_gateway_disconnect, incrates/workshop/server/tests/it/realtime_relay/overload.rs. On my Linux machine it fails after about ten seconds, at the step that the test namesthe Gateway fills the relay's browser send. It fails on this branch, and it fails the same way on unchangedmasteratf40a4fce, the base just before the current one. That test and the code it tests are the same on this branch as onmaster. CI runs the server's tests on Windows only, and CI passes.I have not filed issues for any of these.
In the normal run 342 of 343 tests pass, and the one failure also occurs on unchanged code
I measured the test counts and the results of the breaks on this branch, which was rebased onto
masterat commit3c12833con 2026-11-23.cargo nextest run --locked -p workshop -p workshop-server -p workshop-server-apiran 343 tests and skipped 14 more. Of the 343, 342 passed. The one failure isstalled_browser_cleanup_is_bounded_after_gateway_disconnect, which also fails on unchangedmaster. The 14 skipped tests are the ten live tests and four others that were skipped before this change.cargo nextest run --locked --workspace --exclude workshop --exclude workshop-server --exclude workshop-server-api --all-featuresran 704 tests, and all of them passed. It skipped 1.cargo clippy -p workshop -p workshop-server -p workshop-server-api --all-targets,cargo fmt --all --check,cargo test -p build-xtask, and the check of the repository's rules for its defined terms,node --test crates/workshop/ui/test/docs-claims.mjs.clippy,docs, anddylintchecks, and they pass on this branch.The plan lists the breaks and records every result
plan/2026-11-20-1-pack-hand-offs-and-real-gateway.plan.mdlists the three breaks and records every result. Anyone who saw this pull request before 2026-11-21 saw six plans, which were merged into this one that day.🤖 Generated with Claude Code