Skip to content

Commit f2458d8

Browse files
committed
ci: isolate prompt snapshot check
1 parent bf25110 commit f2458d8

5 files changed

Lines changed: 60 additions & 35 deletions

File tree

.github/workflows/ci.yml

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ jobs:
6666
checks_node_core_dist_matrix: ${{ steps.manifest.outputs.checks_node_core_dist_matrix }}
6767
run_check: ${{ steps.manifest.outputs.run_check }}
6868
run_check_additional: ${{ steps.manifest.outputs.run_check_additional }}
69+
additional_matrix: ${{ steps.manifest.outputs.additional_matrix }}
6970
run_build_smoke: ${{ steps.manifest.outputs.run_build_smoke }}
7071
run_check_docs: ${{ steps.manifest.outputs.run_check_docs }}
7172
run_control_ui_i18n: ${{ steps.manifest.outputs.run_control_ui_i18n }}
@@ -205,6 +206,44 @@ jobs:
205206
parseBoolean(process.env.OPENCLAW_CI_RUN_CONTROL_UI_I18N) && !docsOnly;
206207
const runPromptSnapshots =
207208
parseBoolean(process.env.OPENCLAW_CI_RUN_PROMPT_SNAPSHOTS) && !docsOnly;
209+
const additionalCheckTasks = [
210+
{
211+
check_name: "check-additional-boundaries-a",
212+
group: "boundaries",
213+
boundary_shard: "1/4",
214+
},
215+
{
216+
check_name: "check-additional-boundaries-b",
217+
group: "boundaries",
218+
boundary_shard: "2/4",
219+
},
220+
{
221+
check_name: "check-additional-boundaries-c",
222+
group: "boundaries",
223+
boundary_shard: "3/4",
224+
},
225+
{
226+
check_name: "check-additional-boundaries-d",
227+
group: "boundaries",
228+
boundary_shard: "4/4",
229+
},
230+
{ check_name: "check-additional-extension-channels", group: "extension-channels" },
231+
{ check_name: "check-additional-extension-bundled", group: "extension-bundled" },
232+
{
233+
check_name: "check-additional-extension-package-boundary",
234+
group: "extension-package-boundary",
235+
},
236+
{
237+
check_name: "check-additional-runtime-topology-architecture",
238+
group: "runtime-topology-architecture",
239+
},
240+
];
241+
if (runPromptSnapshots) {
242+
additionalCheckTasks.push({
243+
check_name: "check-additional-prompt-snapshots",
244+
group: "prompt-snapshots",
245+
});
246+
}
208247
const checksFastCoreTasks = [];
209248
if (runNodeFull) {
210249
checksFastCoreTasks.push(
@@ -270,6 +309,7 @@ jobs:
270309
checks_node_core_dist_matrix: createMatrix(nodeTestDistShards),
271310
run_check: runNodeFull,
272311
run_check_additional: runNodeFull,
312+
additional_matrix: createMatrix(runNodeFull ? additionalCheckTasks : []),
273313
run_build_smoke: runNodeFull,
274314
run_check_docs: docsChanged,
275315
run_control_ui_i18n: runControlUiI18n,
@@ -1539,28 +1579,7 @@ jobs:
15391579
timeout-minutes: 20
15401580
strategy:
15411581
fail-fast: false
1542-
matrix:
1543-
include:
1544-
- check_name: check-additional-boundaries-a
1545-
group: boundaries
1546-
boundary_shard: 1/4
1547-
- check_name: check-additional-boundaries-b
1548-
group: boundaries
1549-
boundary_shard: 2/4
1550-
- check_name: check-additional-boundaries-c
1551-
group: boundaries
1552-
boundary_shard: 3/4
1553-
- check_name: check-additional-boundaries-d
1554-
group: boundaries
1555-
boundary_shard: 4/4
1556-
- check_name: check-additional-extension-channels
1557-
group: extension-channels
1558-
- check_name: check-additional-extension-bundled
1559-
group: extension-bundled
1560-
- check_name: check-additional-extension-package-boundary
1561-
group: extension-package-boundary
1562-
- check_name: check-additional-runtime-topology-architecture
1563-
group: runtime-topology-architecture
1582+
matrix: ${{ fromJson(needs.preflight.outputs.additional_matrix) }}
15641583
steps:
15651584
- name: Checkout
15661585
shell: bash
@@ -1686,6 +1705,9 @@ jobs:
16861705
boundaries)
16871706
node scripts/run-additional-boundary-checks.mjs
16881707
;;
1708+
prompt-snapshots)
1709+
run_check "prompt:snapshots:check" pnpm prompt:snapshots:check
1710+
;;
16891711
extension-channels)
16901712
run_check "lint:extensions:channels" pnpm run lint:extensions:channels
16911713
;;

docs/ci.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Scope logic lives in `scripts/ci-changed-scope.mjs` and is covered by unit tests
5656
- **CI routing-only edits, selected cheap core-test fixture edits, and narrow plugin contract helper/test-routing edits** use a fast Node-only manifest path: `preflight`, security, and a single `checks-fast-core` task. That path skips build artifacts, Node 22 compatibility, channel contracts, full core shards, bundled-plugin shards, and additional guard matrices when the change is limited to the routing or helper surfaces the fast task exercises directly.
5757
- **Windows Node checks** are scoped to Windows-specific process/path wrappers, npm/pnpm/UI runner helpers, package manager config, and the CI workflow surfaces that execute that lane; unrelated source, plugin, install-smoke, and test-only changes stay on the Linux Node lanes.
5858

59-
The slowest Node test families are split or balanced so each job stays small without over-reserving runners: channel contracts run as three weighted shards, core unit fast/support lanes run separately, core runtime infra is split between state, process/config, cron, and shared shards, auto-reply runs as balanced workers (with the reply subtree split into agent-runner, dispatch, and commands/state-routing shards), and agentic gateway/server configs are split across chat/auth/model/http-plugin/runtime/startup lanes instead of waiting on built artifacts. Broad browser, QA, media, and miscellaneous plugin tests use their dedicated Vitest configs instead of the shared plugin catch-all. Include-pattern shards record timing entries using the CI shard name, so `.artifacts/vitest-shard-timings.json` can distinguish a whole config from a filtered shard. `check-additional` keeps package-boundary compile/canary work together and separates runtime topology architecture from gateway watch coverage; the boundary guard list is striped across four matrix shards, each running selected independent guards concurrently and printing per-check timings. The expensive Codex happy-path prompt snapshot drift check runs for manual CI and for prompt-affecting changes only, so normal unrelated Node changes do not wait behind cold prompt snapshot generation while prompt drift is still pinned to the PR that caused it; the same flag skips prompt snapshot Vitest generation inside the built-artifact core support-boundary shard. Gateway watch, channel tests, and the core support-boundary shard run concurrently inside `build-artifacts` after `dist/` and `dist-runtime/` are already built.
59+
The slowest Node test families are split or balanced so each job stays small without over-reserving runners: channel contracts run as three weighted shards, core unit fast/support lanes run separately, core runtime infra is split between state, process/config, cron, and shared shards, auto-reply runs as balanced workers (with the reply subtree split into agent-runner, dispatch, and commands/state-routing shards), and agentic gateway/server configs are split across chat/auth/model/http-plugin/runtime/startup lanes instead of waiting on built artifacts. Broad browser, QA, media, and miscellaneous plugin tests use their dedicated Vitest configs instead of the shared plugin catch-all. Include-pattern shards record timing entries using the CI shard name, so `.artifacts/vitest-shard-timings.json` can distinguish a whole config from a filtered shard. `check-additional` keeps package-boundary compile/canary work together and separates runtime topology architecture from gateway watch coverage; the boundary guard list is striped across four matrix shards, each running selected independent guards concurrently and printing per-check timings. The expensive Codex happy-path prompt snapshot drift check runs as its own additional job for manual CI and for prompt-affecting changes only, so normal unrelated Node changes do not wait behind cold prompt snapshot generation and the boundary shards stay balanced while prompt drift is still pinned to the PR that caused it; the same flag skips prompt snapshot Vitest generation inside the built-artifact core support-boundary shard. Gateway watch, channel tests, and the core support-boundary shard run concurrently inside `build-artifacts` after `dist/` and `dist-runtime/` are already built.
6060

6161
Android CI runs both `testPlayDebugUnitTest` and `testThirdPartyDebugUnitTest` and then builds the Play debug APK. The third-party flavor has no separate source set or manifest; its unit-test lane still compiles the flavor with the SMS/call-log BuildConfig flags, while avoiding a duplicate debug APK packaging job on every Android-relevant push.
6262

docs/concepts/system-prompt.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,10 @@ collaboration-mode instructions inside the Codex runtime after OpenClaw sends
137137
thread and turn params.
138138

139139
Regenerate them with `pnpm prompt:snapshots:gen` and verify drift with
140-
`pnpm prompt:snapshots:check`. CI runs the drift check in the additional
141-
boundary shard so prompt changes and snapshot updates stay attached to the same
142-
PR.
140+
`pnpm prompt:snapshots:check`. CI runs the drift check as a dedicated
141+
additional check for manual CI and prompt-affecting changes so prompt changes
142+
and snapshot updates stay attached to the same PR without slowing unrelated
143+
boundary shards.
143144

144145
## Workspace bootstrap injection
145146

scripts/run-additional-boundary-checks.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { spawn } from "node:child_process";
33
import { performance } from "node:perf_hooks";
44

55
export const BOUNDARY_CHECKS = [
6-
["prompt:snapshots:check", "pnpm", ["prompt:snapshots:check"]],
76
["plugin-extension-boundary", "pnpm", ["run", "lint:plugins:no-extension-imports"]],
87
["lint:tmp:no-random-messaging", "pnpm", ["run", "lint:tmp:no-random-messaging"]],
98
["lint:tmp:channel-agnostic-boundaries", "pnpm", ["run", "lint:tmp:channel-agnostic-boundaries"]],
@@ -58,6 +57,11 @@ export const BOUNDARY_CHECKS = [
5857
].map(([label, command, args]) => ({ label, command, args }));
5958

6059
export const PROMPT_SNAPSHOT_CHECK_LABEL = "prompt:snapshots:check";
60+
export const PROMPT_SNAPSHOT_CHECK = {
61+
label: PROMPT_SNAPSHOT_CHECK_LABEL,
62+
command: "pnpm",
63+
args: ["prompt:snapshots:check"],
64+
};
6165

6266
export function resolveConcurrency(value, fallback = 4) {
6367
const parsed = Number.parseInt(String(value ?? ""), 10);

test/scripts/run-additional-boundary-checks.test.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { describe, expect, it } from "vitest";
22
import {
33
BOUNDARY_CHECKS,
4+
PROMPT_SNAPSHOT_CHECK,
45
filterChecksForEnvironment,
56
formatCommand,
67
parseShardSpec,
@@ -23,22 +24,19 @@ function createOutputBuffer() {
2324
}
2425

2526
describe("run-additional-boundary-checks", () => {
26-
it("runs prompt snapshot drift checks in CI", () => {
27-
expect(BOUNDARY_CHECKS).toContainEqual({
27+
it("keeps prompt snapshot drift checks as a dedicated CI check", () => {
28+
expect(PROMPT_SNAPSHOT_CHECK).toEqual({
2829
label: "prompt:snapshots:check",
2930
command: "pnpm",
3031
args: ["prompt:snapshots:check"],
3132
});
33+
expect(BOUNDARY_CHECKS.map((check) => check.label)).not.toContain("prompt:snapshots:check");
3234
});
3335

34-
it("skips prompt snapshot drift checks when preflight says they are unrelated", () => {
36+
it("leaves boundary checks unchanged when prompt snapshots are unrelated", () => {
3537
expect(
3638
filterChecksForEnvironment(BOUNDARY_CHECKS, { OPENCLAW_RUN_PROMPT_SNAPSHOTS: "false" }),
37-
).not.toContainEqual({
38-
label: "prompt:snapshots:check",
39-
command: "pnpm",
40-
args: ["prompt:snapshots:check"],
41-
});
39+
).toEqual(BOUNDARY_CHECKS);
4240
});
4341

4442
it("normalizes concurrency input", () => {

0 commit comments

Comments
 (0)