Skip to content

Commit f15120c

Browse files
authored
fix(qa): carry selected runtime into flow scenarios (#119324)
* fix(qa): carry selected runtime into flow scenarios * test(qa): align compaction runtime fact assertion
1 parent 532580f commit f15120c

13 files changed

Lines changed: 44 additions & 22 deletions

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe("qa compaction scenario catalog", () => {
2727
expect(scenario.gatewayConfigPatch).toMatchObject({
2828
agents: { defaults: { compaction: { mode: "default" } } },
2929
});
30-
expect(flow).toContain("OPENCLAW_QA_FORCE_RUNTIME === 'openclaw'");
30+
expect(flow).toContain("env.runtimeId === 'openclaw'");
3131
expect(flow).toContain("initialRequests[0].errorCode === 'context_length_exceeded'");
3232
expect(flow).toContain("initialRequests.length === 2");
3333
expect(flow).toContain("compactionSummaryRequests.length === 2");
@@ -85,7 +85,7 @@ describe("qa compaction scenario catalog", () => {
8585
| undefined;
8686
expect(firstAction).toBeDefined();
8787
const conditional = firstAction?.if as Record<string, unknown> | undefined;
88-
expect(conditional?.expr).toBe("env.gateway.runtimeEnv.OPENCLAW_QA_FORCE_RUNTIME === 'codex'");
88+
expect(conditional?.expr).toBe("env.runtimeId === 'codex'");
8989
expect(conditional?.["then"]).toMatchObject([
9090
{
9191
call: "qaImport",
@@ -102,9 +102,7 @@ describe("qa compaction scenario catalog", () => {
102102
| Record<string, unknown>
103103
| undefined;
104104
expect(runtimeGuard?.assert).toMatchObject({
105-
expr: expect.stringContaining(
106-
"(env.gateway.runtimeEnv.OPENCLAW_QA_FORCE_RUNTIME ?? 'openclaw') === 'openclaw'",
107-
),
105+
expr: expect.stringContaining("env.runtimeId === 'openclaw'"),
108106
});
109107

110108
const knownGapIndex = flow.indexOf(knownGap);
@@ -115,7 +113,7 @@ describe("qa compaction scenario catalog", () => {
115113
expect(flow).toContain("new qaErrors.QaSuiteScenarioSkipError");
116114
expect(flow).toContain("seedQaSessionTranscript");
117115
expect(flow).toContain("sessions.compaction.branch");
118-
expect(flow).toContain("OPENCLAW_QA_FORCE_RUNTIME");
116+
expect(flow).toContain("env.runtimeId");
119117
expect(flow).toContain('"transcriptToolName":"write"');
120118
expect(flow).toContain('"requireSuccessfulTranscriptToolResult":true');
121119
expect(flow).toContain("outbound.text === config.finalMarker");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ describe("QA runtime-pair scenario catalog", () => {
7979
const longContextScenario = readQaScenarioById("long-context-progress-watchdog");
8080
expect(longContextScenario.execution).toMatchObject({ kind: "flow", runtime: "codex" });
8181
const longContextFlow = JSON.stringify(longContextScenario.execution.flow);
82-
expect(longContextFlow).toContain("OPENCLAW_QA_FORCE_RUNTIME");
82+
expect(longContextFlow).toContain("env.runtimeId");
8383
expect(longContextFlow).not.toContain("patchConfig");
8484
});
8585
});

‎extensions/qa-lab/src/suite-run-standard.parity-retry.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,27 @@ beforeEach(() => {
131131
});
132132

133133
describe("QA runtime parity scenario retry isolation", () => {
134+
it.each([
135+
{ forcedRuntime: undefined, expectedRuntime: "openclaw" },
136+
{ forcedRuntime: "codex" as const, expectedRuntime: "codex" },
137+
])(
138+
"records $expectedRuntime as the selected runtime fact",
139+
async ({ forcedRuntime, expectedRuntime }) => {
140+
const runScenario = vi.fn<QaSuiteScenarioRunner>().mockImplementation(async (env) => {
141+
expect(env.runtimeId).toBe(expectedRuntime);
142+
return makeRetryTestResult("pass");
143+
});
144+
145+
await runQaFlowSuiteStandard(
146+
{ lab: makeRetryTestLab(), ...(forcedRuntime ? { forcedRuntime } : {}) },
147+
makeRetryTestContext(),
148+
runScenario,
149+
);
150+
151+
expect(runScenario).toHaveBeenCalledOnce();
152+
},
153+
);
154+
134155
it("skips connected-transport readiness for intentionally unhealthy startup", async () => {
135156
const context = makeRetryTestContext();
136157
context.gatewayRuntimeOptions = { allowUnhealthyStartup: true };

‎extensions/qa-lab/src/suite-run-standard.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export async function runQaFlowSuiteStandard(
152152
lab,
153153
mock: activeMock,
154154
gateway: activeGateway,
155+
runtimeId: params?.forcedRuntime ?? "openclaw",
155156
outputDir,
156157
// YAML scenarios should see the full staged gateway config, not just
157158
// the transport fragment. Routing/session/plugin assertions depend on it.

‎extensions/qa-lab/src/suite-types.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export type QaSuiteScenarioResult = {
2626

2727
export type QaSuiteEnvironment = {
2828
lab: QaLabServerHandle;
29+
runtimeId: RuntimeId;
2930
webSessionIds: Set<string>;
3031
} & QaSuiteRuntimeEnv;
3132

‎extensions/qa-lab/src/suite.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export type QaSuiteScenarioResult = {
7474

7575
type QaSuiteEnvironment = {
7676
lab: QaLabServerHandle;
77+
runtimeId: RuntimeId;
7778
webSessionIds: Set<string>;
7879
} & QaSuiteRuntimeEnv;
7980

‎qa/scenarios/models/codex-harness-no-meta-leak.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ flow:
6565
message:
6666
expr: "`expected live primary model ${config.requiredModel}, got ${env.primaryModel}`"
6767
- assert:
68-
expr: "env.gateway.runtimeEnv.OPENCLAW_QA_FORCE_RUNTIME === config.harnessRuntime"
68+
expr: "env.runtimeId === config.harnessRuntime"
6969
message:
70-
expr: "`expected suite runtime ${config.harnessRuntime}, got ${env.gateway.runtimeEnv.OPENCLAW_QA_FORCE_RUNTIME}`"
71-
detailsExpr: "`provider=${selected?.provider} model=${selected?.model} runtime=${env.gateway.runtimeEnv.OPENCLAW_QA_FORCE_RUNTIME}`"
70+
expr: "`expected suite runtime ${config.harnessRuntime}, got ${env.runtimeId}`"
71+
detailsExpr: "`provider=${selected?.provider} model=${selected?.model} runtime=${env.runtimeId}`"
7272
- name: keeps codex coordination chatter out of the visible reply
7373
actions:
7474
- call: reset

‎qa/scenarios/runtime/compaction-empty-response-recovery.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ flow:
3939
- name: retries an empty compaction summary at the compaction owner
4040
actions:
4141
- assert:
42-
expr: "env.providerMode === 'mock-openai' && env.gateway.runtimeEnv.OPENCLAW_QA_FORCE_RUNTIME === 'openclaw' && Boolean(env.mock)"
42+
expr: "env.providerMode === 'mock-openai' && env.runtimeId === 'openclaw' && Boolean(env.mock)"
4343
message: compaction output recovery requires the mock-openai OpenClaw runtime
4444
- call: waitForGatewayHealthy
4545
args:

‎qa/scenarios/runtime/compaction-reasoning-only-recovery.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ flow:
3939
- name: retries a reasoning-only compaction summary at the compaction owner
4040
actions:
4141
- assert:
42-
expr: "env.providerMode === 'mock-openai' && env.gateway.runtimeEnv.OPENCLAW_QA_FORCE_RUNTIME === 'openclaw' && Boolean(env.mock)"
42+
expr: "env.providerMode === 'mock-openai' && env.runtimeId === 'openclaw' && Boolean(env.mock)"
4343
message: compaction output recovery requires the mock-openai OpenClaw runtime
4444
- call: waitForGatewayHealthy
4545
args:

‎qa/scenarios/runtime/compaction-retry-mutating-tool.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ flow:
4848
- name: compacts bulky history and mutates exactly once after overflow
4949
actions:
5050
- if:
51-
expr: "env.gateway.runtimeEnv.OPENCLAW_QA_FORCE_RUNTIME === 'codex'"
51+
expr: "env.runtimeId === 'codex'"
5252
then:
5353
- call: qaImport
5454
args:
@@ -57,7 +57,7 @@ flow:
5757
- throw:
5858
expr: "new qaErrors.QaSuiteScenarioSkipError('known-harness-gap compaction-retry-mutating-tool: provider-error recovery does not invoke Codex native compaction; native token-threshold compaction needs a separate scenario.')"
5959
- assert:
60-
expr: "(env.gateway.runtimeEnv.OPENCLAW_QA_FORCE_RUNTIME ?? 'openclaw') === 'openclaw' && env.providerMode === 'mock-openai' && Boolean(env.mock)"
60+
expr: "env.runtimeId === 'openclaw' && env.providerMode === 'mock-openai' && Boolean(env.mock)"
6161
message: compaction overflow injection requires the mock-openai OpenClaw runtime
6262
- call: waitForGatewayHealthy
6363
args:

0 commit comments

Comments
 (0)