Skip to content

Commit 197e6ec

Browse files
committed
test: use the canonical Codex runtime for live MCP proof
1 parent 27c5a8d commit 197e6ec

1 file changed

Lines changed: 36 additions & 51 deletions

File tree

‎test/e2e/qa-lab/runtime/gateway-node-mcp.live.test.ts‎

Lines changed: 36 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -44,45 +44,6 @@ function stdioServer(
4444
},
4545
};
4646
}
47-
function modelConfig(workspace: string): OpenClawConfig {
48-
return {
49-
secrets: { providers: { default: { source: "env" } } },
50-
models: {
51-
mode: "replace",
52-
providers: {
53-
openai: {
54-
baseUrl: "https://api.openai.com/v1",
55-
api: "openai-responses",
56-
apiKey: { source: "env", provider: "default", id: "OPENAI_API_KEY" },
57-
models: [
58-
{
59-
id: MODEL_ID,
60-
name: MODEL_ID,
61-
api: "openai-responses",
62-
reasoning: true,
63-
input: ["text"],
64-
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
65-
contextWindow: 48_000,
66-
contextTokens: 48_000,
67-
maxTokens: 8_192,
68-
},
69-
],
70-
},
71-
},
72-
},
73-
agents: {
74-
defaults: {
75-
workspace,
76-
model: { primary: MODEL_REF },
77-
timeoutSeconds: Math.ceil(REQUEST_TIMEOUT_MS / 1_000),
78-
},
79-
},
80-
tools: { profile: "full", toolSearch: false, codeMode: false },
81-
memory: { search: { enabled: false } },
82-
plugins: { enabled: false },
83-
channels: {},
84-
};
85-
}
8647
function expectCompletedTool(
8748
messages: HistoryMessage[],
8849
params: { name: string; marker: string; label: string },
@@ -98,7 +59,10 @@ function expectCompletedTool(
9859
return JSON.stringify(block.arguments ?? block.input).includes(params.marker);
9960
});
10061
});
101-
expect(called, `chat.history omitted tool call ${params.name}`).toBe(true);
62+
expect(
63+
called,
64+
`chat.history omitted tool call ${params.name}: ${JSON.stringify(messages).slice(-16_384)}`,
65+
).toBe(true);
10266
const result = messages.find(
10367
(candidate) =>
10468
candidate.role === "toolResult" &&
@@ -182,18 +146,27 @@ describe.skipIf(!LIVE_ENABLED)("OpenAI cross-placement MCP model proof", () => {
182146
},
183147
transportBaseUrl: "http://127.0.0.1",
184148
controlUiEnabled: false,
149+
providerMode: "live-frontier",
150+
primaryModel: MODEL_REF,
151+
alternateModel: MODEL_REF,
152+
enabledPluginIds: ["codex"],
185153
runtimeEnvPatch: {
186154
OPENAI_API_KEY,
187155
OPENCLAW_SKIP_CHANNELS: "1",
188156
},
189157
mutateConfig: (cfg) => {
190-
const live = modelConfig(cfg.agents?.defaults?.workspace ?? gatewayParent);
191158
return {
192-
...live,
159+
...cfg,
193160
agents: {
194161
...cfg.agents,
195-
...live.agents,
196-
defaults: { ...cfg.agents?.defaults, ...live.agents?.defaults },
162+
defaults: {
163+
...cfg.agents?.defaults,
164+
timeoutSeconds: Math.ceil(REQUEST_TIMEOUT_MS / 1_000),
165+
mediaModels: undefined,
166+
// Authored QA transport params select the built-in runtime.
167+
// Keep the official route unmodified to prove the default Codex harness.
168+
models: { [MODEL_REF]: {} },
169+
},
197170
entries: {
198171
...cfg.agents?.entries,
199172
qa: {
@@ -203,6 +176,13 @@ describe.skipIf(!LIVE_ENABLED)("OpenAI cross-placement MCP model proof", () => {
203176
},
204177
},
205178
},
179+
tools: { ...cfg.tools, profile: "full", toolSearch: false, codeMode: false },
180+
memory: { search: { enabled: false } },
181+
plugins: {
182+
...cfg.plugins,
183+
slots: { ...cfg.plugins?.slots, memory: "none" },
184+
entries: { ...cfg.plugins?.entries, "memory-core": { enabled: false } },
185+
},
206186
mcp: { servers: gatewayServers },
207187
gateway: {
208188
...cfg.gateway,
@@ -244,18 +224,22 @@ describe.skipIf(!LIVE_ENABLED)("OpenAI cross-placement MCP model proof", () => {
244224
const sessionKey = `agent:qa:mcp-live-${randomUUID()}`;
245225
const idempotencyKey = randomUUID();
246226
const prompt =
247-
`Call gatewayLive__parity_probe with marker ${gatewayMarker}. ` +
227+
`Call parity_probe on MCP server gatewayLive with marker ${gatewayMarker}. ` +
248228
`Call nodeLive_parity_probe with marker ${nodeMarker}. ` +
249229
`Only after both calls return successfully, reply with exactly ${expectedToken} and nothing else.`;
250-
const started = (await gateway.call(
230+
const completed = (await gateway.call(
251231
"agent",
252232
{ sessionKey, message: prompt, deliver: false, idempotencyKey },
253-
{ timeoutMs: 30_000 },
233+
{ expectFinal: true, timeoutMs: REQUEST_TIMEOUT_MS + 5_000 },
254234
)) as { runId?: unknown; status?: unknown };
255-
if (started.status !== "accepted" || typeof started.runId !== "string") {
256-
throw new Error(`live Gateway run did not start: ${JSON.stringify(started)}`);
235+
expect(completed, gateway.logs()).toMatchObject({
236+
status: "ok",
237+
result: { meta: { agentMeta: { agentHarnessId: "codex" } } },
238+
});
239+
if (typeof completed.runId !== "string") {
240+
throw new Error(`live Gateway run omitted its identity: ${JSON.stringify(completed)}`);
257241
}
258-
const runId = started.runId;
242+
const runId = completed.runId;
259243
const terminal = await gateway.call(
260244
"agent.wait",
261245
{ runId, timeoutMs: REQUEST_TIMEOUT_MS },
@@ -268,7 +252,8 @@ describe.skipIf(!LIVE_ENABLED)("OpenAI cross-placement MCP model proof", () => {
268252
})) as { messages?: HistoryMessage[] };
269253
const messages = history.messages ?? [];
270254
expectCompletedTool(messages, {
271-
name: "gatewayLive__parity_probe",
255+
// Codex owns configured Gateway MCP and records its native server.tool name.
256+
name: "gatewayLive.parity_probe",
272257
marker: gatewayMarker,
273258
label: "gateway-live",
274259
});

0 commit comments

Comments
 (0)