test(e2e): isolate prompt tests with per-worker backend#20464
Merged
kitlangton merged 5 commits intodevfrom Apr 1, 2026
Merged
test(e2e): isolate prompt tests with per-worker backend#20464kitlangton merged 5 commits intodevfrom
kitlangton merged 5 commits intodevfrom
Conversation
…ed LLM routing Spawn a dedicated backend process per Playwright worker so prompt e2e tests no longer share the dev server. Add match-based queue routing to the mock LLM server so canned responses target specific requests (e.g. title generation vs actual prompt). Extract shared mock OpenAI config into e2e/prompt/mock.ts and thread serverUrl through all helpers.
The shell invocation had `-c` before `-l`, causing zsh/bash to treat `-l` as the command string instead of the login flag. Also move the close-event listener to immediately after spawn to prevent missing the event if the process exits before the listener is attached. Also simplifies e2e fixtures (dedup withProject/withBackendProject), extracts assistantText helper, caps backend log buffers, and reverts prompt-shell test to use withProject (no isolated backend needed).
The prior change moved the close-event listener before stdout/stderr data handlers, which caused the process close to resolve before output was collected. Revert to the original inline close handling inside Effect.promise which correctly sequences data→close→finish. Keep the -l/-c arg reorder (harmless — both orders work for zsh/bash) and the new shell unit tests. Revert prompt-shell e2e to withProject since it doesn't need the isolated backend.
89b151b to
6944db8
Compare
29adc0a to
e1c29c9
Compare
Replace raw node:child_process spawn + manual event wiring with Effect's ChildProcessSpawner. Stream output is collected via Stream.runForEach for incremental metadata updates. Process cleanup uses handle.kill with forceKillAfter for reliable SIGTERM→SIGKILL escalation. Drop manual .zshrc/.bashrc sourcing — use login shell (-l) which loads .zshenv/.zprofile. Interactive rc files caused CWD changes and output capture issues. Fix cross-spawn-spawner kill() so forceKillAfter wraps the entire send+wait-for-exit sequence, not just the signal send.
e1c29c9 to
4576a00
Compare
Shell changes moved to kit/shell-effect-childprocess (#20494).
jeromelau
pushed a commit
to jeromelau/opencode
that referenced
this pull request
Apr 2, 2026
balcsida
pushed a commit
to balcsida/opencode
that referenced
this pull request
Apr 8, 2026
|
@kitlangton Side effects on non-prompt tests resulted in file-based tests being forced to use isolated backends with cold file indexes. Is this the intended behavior? |
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
pushMatch/textMatch/toolMatch) so canned responses target specific requestse2e/prompt/mock.tsand threadserverUrlthrough all e2e helperswithProject/withBackendProjectfixtures into sharedrunProjecthelperassistantTextpolling helper used by both prompt specsShell refactor split to #20494.
Test plan
bun test:e2e -- prompt/prompt.spec.ts prompt/prompt-async.spec.ts— 3/3 passbun test:e2e:local -- e2e/prompt/— passes (except prompt.spec which needs isolated backend)