Skip to content

Commit ae47b34

Browse files
authored
fix(qa): preserve Doctor health discovery in packaged fixtures (#134944)
* fix(qa): preserve Doctor discovery during MCP bootstrap * test(qa): preserve plugin isolation in packaged Gateway fixtures * test: use the canonical Codex runtime for live MCP proof
1 parent f212c91 commit ae47b34

11 files changed

Lines changed: 88 additions & 78 deletions

‎extensions/qa-lab/src/gateway-child-command.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ async function readQaGatewayCliCommand(
146146
if (exitCode !== 0 && !failure) {
147147
const stderrText = formatQaChildOutputTail(stderr, "stderr");
148148
failure = createQaGatewayCliError(
149-
`OpenClaw CLI exited ${exitCode}: ${stderrText || stdoutText}`,
149+
`OpenClaw CLI exited ${exitCode}: ${[stderrText, stdoutText].filter(Boolean).join("\n")}`,
150150
);
151151
}
152152
if (stopped.errors.length) {

‎extensions/qa-lab/src/gateway-child.test.ts‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,42 @@ describe("runQaGatewayCliCommand", () => {
306306
}),
307307
).rejects.toThrow("OpenClaw CLI exited 7: fixture failure");
308308
});
309+
310+
it("retains bounded redacted stdout failures alongside stderr panels", async () => {
311+
const lifetime = new QaGatewayChildLifecycle();
312+
try {
313+
const error = await runQaGatewayCliCommand({
314+
lifetime,
315+
executablePath: process.execPath,
316+
argsPrefix: [
317+
"--input-type=module",
318+
"--eval",
319+
`await new Promise((resolve) => process.stderr.write(
320+
"Doctor panel: Authorization: Bearer fixture-panel-secret\\n" + "diagnostic ".repeat(400), resolve));
321+
await new Promise((resolve) => process.stdout.write(JSON.stringify({
322+
status: "error", reason: "readiness execution failed", apiKey: "fixture-result-secret",
323+
}), resolve));
324+
process.exit(7);`,
325+
],
326+
args: [],
327+
cwd: process.cwd(),
328+
env: process.env,
329+
}).catch((caught: unknown) => caught);
330+
331+
expect(error).toBeInstanceOf(Error);
332+
if (!(error instanceof Error)) {
333+
throw new Error("expected CLI failure");
334+
}
335+
expect(error.message).toContain("OpenClaw CLI exited 7: Doctor panel:");
336+
expect(error.message).toContain('"reason":"readiness execution failed"');
337+
expect(error.message.length).toBeLessThanOrEqual(2_048);
338+
expect(error.message).toContain("Bearer <redacted>");
339+
expect(error.message).toContain('"apiKey":"<redacted>"');
340+
expect(inspect(error, { depth: null })).not.toMatch(/fixture-(panel|result)-secret/u);
341+
} finally {
342+
await expect(lifetime.stop()).resolves.toEqual({ process: "confirmed-stopped", errors: [] });
343+
}
344+
});
309345
});
310346

311347
describe("monitorQaGatewayChildFailure", () => {

‎test/e2e/qa-lab/runtime/agent-session-dedup-reconnect.e2e.test.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,10 @@ describe("agent session deduplication across reconnect", () => {
231231
controlUiEnabled: false,
232232
fastMode: true,
233233
runtimeEnvPatch: {
234-
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "1",
235234
OPENCLAW_SKIP_CHANNELS: "1",
236235
OPENCLAW_TEST_MINIMAL_GATEWAY: "1",
237236
},
238-
mutateConfig: ({ plugins: _plugins, ...config }) => config,
237+
mutateConfig: (config) => ({ ...config, plugins: { enabled: false } }),
239238
});
240239

241240
const clientA = await connectOperator(gateway, "Session dedup client A");

‎test/e2e/qa-lab/runtime/agent-session-scope-continuity.e2e.test.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,10 @@ describe("agent session scope continuity", () => {
319319
controlUiEnabled: false,
320320
fastMode: true,
321321
runtimeEnvPatch: {
322-
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "1",
323322
OPENCLAW_SKIP_CHANNELS: "1",
324323
OPENCLAW_TEST_MINIMAL_GATEWAY: "1",
325324
},
326-
mutateConfig: ({ plugins: _plugins, ...config }) => config,
325+
mutateConfig: (config) => ({ ...config, plugins: { enabled: false } }),
327326
});
328327
const client = await connectOperator(gateway);
329328
cleanups.push(() => client.stopAndWait({ timeoutMs: 1_000 }));

‎test/e2e/qa-lab/runtime/agent-session-streaming.e2e.test.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,10 @@ describe("agent session streaming", () => {
304304
controlUiEnabled: false,
305305
fastMode: true,
306306
runtimeEnvPatch: {
307-
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "1",
308307
OPENCLAW_SKIP_CHANNELS: "1",
309308
OPENCLAW_TEST_MINIMAL_GATEWAY: "1",
310309
},
311-
mutateConfig: ({ plugins: _plugins, ...config }) => config,
310+
mutateConfig: (config) => ({ ...config, plugins: { enabled: false } }),
312311
});
313312

314313
const gatewayEvents: GatewayEvent[] = [];

‎test/e2e/qa-lab/runtime/gateway-node-control-plane.e2e.test.ts‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,14 @@ describe("Gateway node control plane", () => {
112112
transportBaseUrl: "http://127.0.0.1",
113113
controlUiEnabled: false,
114114
runtimeEnvPatch: {
115-
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "1",
116115
OPENCLAW_SKIP_CHANNELS: "1",
117116
OPENCLAW_SKIP_PROVIDERS: "1",
118117
OPENCLAW_TEST_MINIMAL_GATEWAY: "1",
119118
},
120119
mutateConfig: (cfg) => {
121-
const { plugins: _plugins, ...withoutPlugins } = cfg;
122120
return {
123-
...withoutPlugins,
121+
...cfg,
122+
plugins: { enabled: false },
124123
gateway: {
125124
...cfg.gateway,
126125
nodes: {
@@ -529,19 +528,18 @@ describe("Gateway node control plane", () => {
529528
transportBaseUrl: "http://127.0.0.1",
530529
controlUiEnabled: false,
531530
runtimeEnvPatch: {
532-
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "1",
533531
OPENCLAW_SKIP_CHANNELS: "1",
534532
OPENCLAW_SKIP_PROVIDERS: "1",
535533
OPENCLAW_TEST_MINIMAL_GATEWAY: "1",
536534
},
537535
mutateConfig: (cfg) => {
538536
// This control-plane fixture must not request unrelated QA runtime plugin installs.
539-
const { plugins: _plugins, ...withoutPlugins } = cfg;
540537
return {
541-
...withoutPlugins,
538+
...cfg,
542539
plugins: {
543540
enabled: true,
544541
allow: [FIXTURE_PLUGIN_ID],
542+
slots: { memory: "none" },
545543
load: { paths: [fixture.pluginDir] },
546544
entries: { [FIXTURE_PLUGIN_ID]: { enabled: true } },
547545
},

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,14 @@ describe("Gateway and node-host MCP live process parity", () => {
122122
transportBaseUrl: "http://127.0.0.1",
123123
controlUiEnabled: false,
124124
runtimeEnvPatch: {
125-
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "1",
126125
OPENCLAW_SKIP_CHANNELS: "1",
127126
OPENCLAW_SKIP_PROVIDERS: "1",
128127
OPENCLAW_TEST_MINIMAL_GATEWAY: "1",
129128
},
130129
mutateConfig: (cfg) => {
131-
const { plugins: _plugins, ...withoutPlugins } = cfg;
132130
return {
133-
...withoutPlugins,
131+
...cfg,
132+
plugins: { enabled: false },
134133
mcp: { servers: sessionMcpServers },
135134
agents: {
136135
...cfg.agents,
@@ -167,7 +166,6 @@ describe("Gateway and node-host MCP live process parity", () => {
167166
OPENCLAW_CONFIG_PATH: nodeConfigPath,
168167
OPENCLAW_GATEWAY_TOKEN: gateway.token,
169168
OPENCLAW_ALLOW_INSECURE_PRIVATE_WS: "1",
170-
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "1",
171169
OPENCLAW_SKIP_CHANNELS: "1",
172170
OPENCLAW_SKIP_PROVIDERS: "1",
173171
},

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

Lines changed: 36 additions & 52 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,19 +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,
187-
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "1",
188155
OPENCLAW_SKIP_CHANNELS: "1",
189156
},
190157
mutateConfig: (cfg) => {
191-
const live = modelConfig(cfg.agents?.defaults?.workspace ?? gatewayParent);
192158
return {
193-
...live,
159+
...cfg,
194160
agents: {
195161
...cfg.agents,
196-
...live.agents,
197-
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+
},
198170
entries: {
199171
...cfg.agents?.entries,
200172
qa: {
@@ -204,6 +176,13 @@ describe.skipIf(!LIVE_ENABLED)("OpenAI cross-placement MCP model proof", () => {
204176
},
205177
},
206178
},
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+
},
207186
mcp: { servers: gatewayServers },
208187
gateway: {
209188
...cfg.gateway,
@@ -245,18 +224,22 @@ describe.skipIf(!LIVE_ENABLED)("OpenAI cross-placement MCP model proof", () => {
245224
const sessionKey = `agent:qa:mcp-live-${randomUUID()}`;
246225
const idempotencyKey = randomUUID();
247226
const prompt =
248-
`Call gatewayLive__parity_probe with marker ${gatewayMarker}. ` +
227+
`Call parity_probe on MCP server gatewayLive with marker ${gatewayMarker}. ` +
249228
`Call nodeLive_parity_probe with marker ${nodeMarker}. ` +
250229
`Only after both calls return successfully, reply with exactly ${expectedToken} and nothing else.`;
251-
const started = (await gateway.call(
230+
const completed = (await gateway.call(
252231
"agent",
253232
{ sessionKey, message: prompt, deliver: false, idempotencyKey },
254-
{ timeoutMs: 30_000 },
233+
{ expectFinal: true, timeoutMs: REQUEST_TIMEOUT_MS + 5_000 },
255234
)) as { runId?: unknown; status?: unknown };
256-
if (started.status !== "accepted" || typeof started.runId !== "string") {
257-
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)}`);
258241
}
259-
const runId = started.runId;
242+
const runId = completed.runId;
260243
const terminal = await gateway.call(
261244
"agent.wait",
262245
{ runId, timeoutMs: REQUEST_TIMEOUT_MS },
@@ -269,7 +252,8 @@ describe.skipIf(!LIVE_ENABLED)("OpenAI cross-placement MCP model proof", () => {
269252
})) as { messages?: HistoryMessage[] };
270253
const messages = history.messages ?? [];
271254
expectCompletedTool(messages, {
272-
name: "gatewayLive__parity_probe",
255+
// Codex owns configured Gateway MCP and records its native server.tool name.
256+
name: "gatewayLive.parity_probe",
273257
marker: gatewayMarker,
274258
label: "gateway-live",
275259
});

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,14 @@ describe("Gateway/node MCP real-process stress", () => {
119119
transportBaseUrl: "http://127.0.0.1",
120120
controlUiEnabled: false,
121121
runtimeEnvPatch: {
122-
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "1",
123122
OPENCLAW_SKIP_CHANNELS: "1",
124123
OPENCLAW_SKIP_PROVIDERS: "1",
125124
OPENCLAW_TEST_MINIMAL_GATEWAY: "1",
126125
},
127126
mutateConfig: (cfg) => {
128-
const { plugins: _plugins, ...withoutPlugins } = cfg;
129127
return {
130-
...withoutPlugins,
128+
...cfg,
129+
plugins: { enabled: false },
131130
gateway: {
132131
...cfg.gateway,
133132
nodes: {
@@ -148,7 +147,6 @@ describe("Gateway/node MCP real-process stress", () => {
148147
OPENCLAW_CONFIG_PATH: nodeConfigPath,
149148
OPENCLAW_GATEWAY_TOKEN: gateway.token,
150149
OPENCLAW_ALLOW_INSECURE_PRIVATE_WS: "1",
151-
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "1",
152150
OPENCLAW_SKIP_CHANNELS: "1",
153151
OPENCLAW_SKIP_PROVIDERS: "1",
154152
},

‎test/e2e/qa-lab/runtime/gateway-node-pending-work.e2e.test.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,14 @@ describe("Gateway node pending work", () => {
7272
transportBaseUrl: "http://127.0.0.1",
7373
controlUiEnabled: false,
7474
runtimeEnvPatch: {
75-
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "1",
7675
OPENCLAW_SKIP_CHANNELS: "1",
7776
OPENCLAW_SKIP_PROVIDERS: "1",
7877
OPENCLAW_TEST_MINIMAL_GATEWAY: "1",
7978
},
8079
mutateConfig: (cfg) => {
81-
const { plugins: _plugins, ...withoutPlugins } = cfg;
8280
return {
83-
...withoutPlugins,
81+
...cfg,
82+
plugins: { enabled: false },
8483
gateway: {
8584
...cfg.gateway,
8685
nodes: {

0 commit comments

Comments
 (0)