Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docker-compose.e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ services:
- LLM_SERVER_KEY=e2e-dummy-key
- LLM_SERVER_MODEL=e2e-mock
- EMBEDDING_PROVIDER=none
# Creating a bridge for the nested worker changes the runner's network
# topology, which makes Chromium drop the flow's HTTP/WebSocket traffic.
# This fixed mock scenario only executes `uname -a`, so it does not need
# an isolated worker network.
- DOCKER_NETWORK=host
# The base service has no healthcheck, so `up --wait` would return before
# goose migrations finish and the API serves. The runtime image is alpine —
# probe with busybox wget, not curl.
Expand Down
4 changes: 4 additions & 0 deletions frontend/e2e/mock-llm/scenario.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ export const RULES = [
],
},
{
// Flow creation starts its worker before the mutation returns. Give the
// browser time to route to the flow and attach the live log subscriptions
// before this fixture emits its only sandbox command and final messages.
delayMs: 1_000,
label: 'agent-terminal',
match: /"terminal"/,
toolCalls: [
Expand Down
6 changes: 6 additions & 0 deletions frontend/e2e/mock-llm/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// answers stay deterministic: the whole request JSON is matched against
// scenario.mjs rules in order, first hit wins.
import { createServer } from 'node:http';
import { setTimeout as sleep } from 'node:timers/promises';

import { FALLBACK, RULES } from './scenario.mjs';

Expand Down Expand Up @@ -143,6 +144,11 @@ createServer(async (request, response) => {
const toolNames = toolList.map((tool) => tool?.function?.name ?? tool?.type ?? '?').join(',');

console.log(`[mock-llm] ${rule.label}: ${payload.stream ? 'stream' : 'plain'} tools=[${toolNames}]`);

if (rule.delayMs) {
await sleep(rule.delayMs);
}

respondCompletion(response, payload, rule);

return;
Expand Down