Skip to content

Commit de3f792

Browse files
authored
test(release): harden QA and live validation (#108589)
1 parent 957cc81 commit de3f792

6 files changed

Lines changed: 65 additions & 39 deletions

File tree

‎extensions/qa-lab/src/scenario-catalog.test.ts‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ describe("qa scenario catalog", () => {
623623
const scenario = readQaScenarioById("luna-thinking-visibility-switch");
624624
const config = readQaScenarioExecutionConfig("luna-thinking-visibility-switch") as
625625
| {
626-
requiredProvider?: string;
626+
liveProvider?: string;
627627
requiredModel?: string;
628628
offDirective?: string;
629629
maxDirective?: string;
@@ -632,7 +632,7 @@ describe("qa scenario catalog", () => {
632632
| undefined;
633633

634634
expect(scenario.sourcePath).toBe("qa/scenarios/models/luna-thinking-visibility-switch.yaml");
635-
expect(config?.requiredProvider).toBe("openai");
635+
expect(config?.liveProvider).toBe("openai");
636636
expect(config?.requiredModel).toBe("gpt-5.6-luna");
637637
expect(config?.offDirective).toBe("/think off");
638638
expect(config?.maxDirective).toBe("/think medium");
@@ -939,6 +939,19 @@ describe("qa scenario catalog", () => {
939939
expect(subagentFanout.execution.suiteIsolation).toBe("isolated");
940940
});
941941

942+
it("settles subagent completions before reading the SQLite session store", () => {
943+
const scenario = requireFlowScenario(readQaScenarioById("subagent-fanout-synthesis"));
944+
const flow = JSON.stringify(scenario.execution.flow);
945+
const completionWaits = [...flow.matchAll(/expectedChildCompletionMarkers/gu)].map(
946+
(match) => match.index,
947+
);
948+
const storeReads = [...flow.matchAll(/readRawQaSessionStore/gu)].map((match) => match.index);
949+
950+
expect(completionWaits).toHaveLength(2);
951+
expect(storeReads).toHaveLength(2);
952+
expect(completionWaits.every((wait, index) => wait < (storeReads[index] ?? -1))).toBe(true);
953+
});
954+
942955
it("adds a dreaming shadow trial report scenario", () => {
943956
const scenario = readQaScenarioById("dreaming-shadow-trial-report");
944957
const config = readQaScenarioExecutionConfig("dreaming-shadow-trial-report") as

‎extensions/qa-lab/src/suite-runtime-flow.test.ts‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ const hasDiscoveryLabels = vi.hoisted(() => vi.fn());
6060
const reportsDiscoveryScopeLeak = vi.hoisted(() => vi.fn());
6161
const reportsMissingDiscoveryFiles = vi.hoisted(() => vi.fn());
6262
const hasModelSwitchContinuitySignal = vi.hoisted(() => vi.fn());
63-
const qaChannelPlugin = vi.hoisted(() => ({ id: "qa-channel" }));
6463
const scanGatewayLogSentinels = vi.hoisted(() => vi.fn());
6564
const assertNoGatewayLogSentinels = vi.hoisted(() => vi.fn());
6665

@@ -159,10 +158,6 @@ vi.mock("./model-switch-eval.js", () => ({
159158
hasModelSwitchContinuitySignal,
160159
}));
161160

162-
vi.mock("./runtime-api.js", () => ({
163-
qaChannelPlugin,
164-
}));
165-
166161
vi.mock("./gateway-log-sentinel.js", () => ({
167162
scanGatewayLogSentinels,
168163
assertNoGatewayLogSentinels,
@@ -296,7 +291,6 @@ describe("qa suite runtime flow", () => {
296291
envArg: typeof env,
297292
configArg: Record<string, unknown>,
298293
) => Promise<unknown>;
299-
qaChannelPlugin: typeof qaChannelPlugin;
300294
webOpenPage: (params: { url: string }) => Promise<unknown>;
301295
};
302296
constants: {
@@ -330,7 +324,6 @@ describe("qa suite runtime flow", () => {
330324
ensureImageGenerationConfigured,
331325
},
332326
);
333-
expect(call.deps.qaChannelPlugin).toBe(qaChannelPlugin);
334327
expect(call.constants).toEqual({
335328
imageUnderstandingPngBase64: "small",
336329
imageUnderstandingLargePngBase64: "large",

‎qa/scenarios/agents/subagent-fanout-synthesis.yaml‎

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,23 @@ flow:
111111
expr: "config.expectedReplyGroups.every((group) => group.some((needle) => normalizeLowercaseStringOrEmpty(text).includes(needle)))"
112112
- expr: "30000"
113113
- expr: "env.providerMode === 'mock-openai' ? 100 : 250"
114+
- if:
115+
# The parent reply can arrive before child transcript writes finish.
116+
# Wait before opening the store so its integrity check sees settled FTS state.
117+
expr: "Boolean(env.mock) && env.gateway.runtimeEnv.OPENCLAW_QA_FORCE_RUNTIME !== 'codex'"
118+
then:
119+
- forEach:
120+
items:
121+
expr: "config.expectedChildCompletionMarkers"
122+
item: childCompletionMarker
123+
actions:
124+
- call: waitForOutboundMessage
125+
args:
126+
- ref: state
127+
- lambda:
128+
params: [candidate]
129+
expr: "String(candidate.text ?? '').trim() === childCompletionMarker"
130+
- 30000
114131
- if:
115132
expr: "Boolean(env.mock)"
116133
then:
@@ -163,6 +180,21 @@ flow:
163180
- if:
164181
expr: "/timed out after/i.test(formatErrorMessage(attemptError))"
165182
then:
183+
- if:
184+
expr: "Boolean(env.mock) && env.gateway.runtimeEnv.OPENCLAW_QA_FORCE_RUNTIME !== 'codex'"
185+
then:
186+
- forEach:
187+
items:
188+
expr: "config.expectedChildCompletionMarkers"
189+
item: childCompletionMarker
190+
actions:
191+
- call: waitForOutboundMessage
192+
args:
193+
- ref: state
194+
- lambda:
195+
params: [candidate]
196+
expr: "String(candidate.text ?? '').trim() === childCompletionMarker"
197+
- 30000
166198
- call: readRawQaSessionStore
167199
saveAs: timeoutStore
168200
args:
@@ -240,23 +272,4 @@ flow:
240272
expr: "lastError === '__done__'"
241273
message:
242274
expr: "lastError instanceof Error ? formatErrorMessage(lastError) : String(lastError ?? 'fanout retry exhausted')"
243-
- if:
244-
# Codex completes child sessions through its app-server path but
245-
# does not relay the child marker back onto the parent QA channel.
246-
# The shared assertions above already prove both child tool calls
247-
# and child session rows; keep this transport-only proof OpenClaw-specific.
248-
expr: "Boolean(env.mock) && env.gateway.runtimeEnv.OPENCLAW_QA_FORCE_RUNTIME !== 'codex'"
249-
then:
250-
- forEach:
251-
items:
252-
expr: "config.expectedChildCompletionMarkers"
253-
item: childCompletionMarker
254-
actions:
255-
- call: waitForOutboundMessage
256-
args:
257-
- ref: state
258-
- lambda:
259-
params: [candidate]
260-
expr: "String(candidate.text ?? '').trim() === childCompletionMarker"
261-
- 30000
262275
detailsExpr: "details"

‎qa/scenarios/models/luna-thinking-visibility-switch.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ scenario:
2929
kind: flow
3030
summary: Toggle reasoning display and GPT-5.6 Luna thinking between off/none and medium, then verify visible reasoning only on the medium turn.
3131
config:
32-
requiredProvider: openai
32+
liveProvider: openai
3333
requiredModel: gpt-5.6-luna
3434
offDirective: /think off
3535
maxDirective: /think medium
@@ -57,7 +57,7 @@ flow:
5757
value:
5858
expr: splitModelRef(env.primaryModel)
5959
- assert:
60-
expr: "env.providerMode !== 'live-frontier' || (selected?.provider === config.requiredProvider && selected?.model === config.requiredModel)"
60+
expr: "env.providerMode !== 'live-frontier' || (selected?.provider === config.liveProvider && selected?.model === config.requiredModel)"
6161
message:
6262
expr: "`expected live GPT-5.6 Luna, got ${env.primaryModel}`"
6363
- sendInbound:

‎src/agents/zai.live.test.ts‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,21 @@ async function expectModelReturnsAssistantText(
3535
contextWindow: modelId === "glm-5.2" ? 1_000_000 : 202_800,
3636
maxTokens: modelId === "glm-5.2" ? 131_072 : 131_100,
3737
};
38-
const res = await completeSimple(
39-
model,
40-
{
41-
messages: createSingleUserPromptMessage(),
42-
},
43-
{ apiKey: ZAI_KEY, maxTokens: 64 },
44-
);
45-
const text = extractNonEmptyAssistantText(res.content);
38+
const runProbe = (maxTokens: number) =>
39+
completeSimple(
40+
model,
41+
{
42+
messages: createSingleUserPromptMessage(),
43+
},
44+
{ apiKey: ZAI_KEY, maxTokens },
45+
);
46+
const res = await runProbe(64);
47+
let text = extractNonEmptyAssistantText(res.content);
48+
// GLM can spend a tiny cap entirely on hidden reasoning. Retry only a
49+
// provider-declared truncation; other empty responses remain failures.
50+
if (text.length === 0 && res.stopReason === "length") {
51+
text = extractNonEmptyAssistantText((await runProbe(256)).content);
52+
}
4653
expect(text.length).toBeGreaterThan(0);
4754
}
4855

‎src/plugins/compat/registry.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const publicSdkContractNarrowingTiers = [
3333
{
3434
name: "bundled-only public export",
3535
codeSuffix: "-public-demotion",
36-
count: 158,
36+
count: 157,
3737
replacement:
3838
"subpath becomes internal (private-local-only); no external successor — no known external consumers",
3939
releaseNote: /public export.*module stays available for bundled plugins.*private-local-only/u,

0 commit comments

Comments
 (0)