Repository navigation
1107 lines (969 loc) · 41.3 KB
/
Copy pathci.yml
File metadata and controls
1107 lines (969 loc) · 41.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: CI
# Linux is the gate for every change. Behavior that can differ on macOS runs in
# .github/workflows/macos.yml only when a change needs it.
on:
workflow_dispatch:
inputs:
acp_live:
description: Also run the full ACP suite with live model calls
type: boolean
default: false
push:
branches: [main]
pull_request:
concurrency:
# A manual dispatch gets its own group so it cannot cancel the push run on
# main. A push to main runs the durable-session model check, which takes
# about 40 minutes, so a newer push waits instead of cancelling it. Without
# this, merges land faster than a run can finish and main never reports a
# result. GitHub keeps only the newest waiting run.
group: ci-${{ github.event_name == 'workflow_dispatch' && 'dispatch-' || '' }}${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
zig_mode:
name: Build & Test (${{ matrix.optimize }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- optimize: ReleaseSafe
test_timeout_seconds: 1500
steps:
- uses: actions/checkout@v4
- name: Setup Zig
id: zig
uses: ./.github/actions/setup-zig
with:
version: "0.17.1"
cache-key: ci-unit-${{ matrix.optimize }}
- name: Check formatting
run: zig fmt --check src/
- name: Validate PGSO corpus classification
run: |
python3 -m scripts.pgso.corpus --manifest scripts/pgso/corpus.json --list
python3 -m unittest scripts.pgso.tests.test_corpus
- name: Audit public surface
run: ./scripts/check-public-surface.sh
- name: Check compactor boundary
run: ./scripts/check-compactor-boundary.sh
- name: Check indexer boundary
run: ./scripts/check-indexer-boundary.sh
- name: Check agents boundary
run: ./scripts/check-agents-boundary.sh
- name: Check recovery boundary
run: ./scripts/check-recovery-boundary.sh
- name: Model-check request recovery
run: |
set -euo pipefail
jar="$RUNNER_TEMP/tla2tools.jar"
curl -fsSL -o "$jar" https://github.com/tlaplus/tlaplus/releases/download/v1.7.4/tla2tools.jar
echo "936a262061c914694dfd669a543be24573c45d5aa0ff20a8b96b23d01e050e88 $jar" | sha256sum -c -
TLA2TOOLS_JAR="$jar" tests/tla/recovery/check.sh
- name: Model-check the empty-reply nudge
run: TLA2TOOLS_JAR="$RUNNER_TEMP/tla2tools.jar" tests/tla/agent_runtime/check.sh
- name: Model-check the connection open hand-off
run: TLA2TOOLS_JAR="$RUNNER_TEMP/tla2tools.jar" tests/tla/gateway_open/check.sh
- name: Model-check session titles and the model list under a shared sign-in
run: TLA2TOOLS_JAR="$RUNNER_TEMP/tla2tools.jar" tests/tla/session_title/check.sh
- name: Model-check the compaction row's number
run: TLA2TOOLS_JAR="$RUNNER_TEMP/tla2tools.jar" tests/tla/compaction_progress/check.sh
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.4.2"
- name: Walk the recovery module along its model
run: TLA2TOOLS_JAR="$RUNNER_TEMP/tla2tools.jar" bun tests/tla/drivers/recovery/driver.ts --self-check
- name: Walk the connection open hand-off along its model
run: TLA2TOOLS_JAR="$RUNNER_TEMP/tla2tools.jar" bun tests/tla/drivers/gateway_open/driver.ts --self-check
- name: Walk the compaction row's number along its model
run: TLA2TOOLS_JAR="$RUNNER_TEMP/tla2tools.jar" bun tests/tla/drivers/compaction_progress/driver.ts --self-check
- name: Check CLI shape
run: python3 -m scripts.check_cli_shape
- name: Test CI and release scripts
run: python3 -m unittest scripts.tests.test_macos_signing scripts.tests.test_signed_macos scripts.tests.test_detect_macos_need scripts.tests.test_detect_ci_need scripts.tests.test_fuzz_nightly scripts.tests.test_check_cli_shape
- name: Test the zig skill's scripts and examples
run: python3 -m unittest discover -s .fx/skills/zig/scripts
- name: Build
run: zig build -Doptimize=${{ matrix.optimize }}
- name: Walk fx ask turns along the empty-reply model
run: TLA2TOOLS_JAR="$RUNNER_TEMP/tla2tools.jar" bun tests/tla/drivers/agent_runtime/driver.ts --self-check
- name: Walk fx ask turns along the malformed tool call model
run: TLA2TOOLS_JAR="$RUNNER_TEMP/tla2tools.jar" bun tests/tla/drivers/agent_runtime/malformed.ts --self-check
# The zsh user profile tests in src/core/execution/command_runner.zig
# skip without /bin/zsh. They start interactive zsh with no terminal,
# where Ubuntu's global zshrc runs compinit, and on this runner compinit
# aborts and writes an error to stderr, so the job turns it off. The
# shell parity tests in src/core/shell_command/command_effect.zig use
# zsh too.
- name: Install zsh
run: |
command -v zsh >/dev/null || { sudo apt-get update -qq && sudo apt-get install -y -qq zsh; }
echo 'skip_global_compinit=1' | sudo tee -a /etc/zsh/zshenv >/dev/null
- name: Test
env:
TEST_TIMEOUT_SECONDS: ${{ matrix.test_timeout_seconds }}
# Ubuntu has sh, dash, and bash, and the step above adds zsh, so the
# shell parity tests fail here if any of them is missing.
FX_TEST_SHELL_PARITY_ALL_SHELLS: "1"
run: |
started_at=$SECONDS
trap 'printf "Unit tests elapsed: %ss\n" "$((SECONDS - started_at))"' EXIT
timeout "${TEST_TIMEOUT_SECONDS}s" zig build test -Doptimize=${{ matrix.optimize }} --summary all
- name: Save Zig cache
uses: ./.github/actions/save-zig-cache
with:
cache-key: ${{ steps.zig.outputs.cache-key }}
cache-hit: ${{ steps.zig.outputs.cache-hit }}
# The SDK jobs are part of this required check because Publish libfx relies
# on them instead of rerunning the package qualification before publishing.
zig:
name: Build & Test
if: ${{ always() }}
needs: [zig_mode, sdk-node-wasm, sdk-node-napi, sdk-bun, sdk-package-guards, sdk-browser-wasm, tla-mcp, tla-mcp-host, tla-transcript-window, tla-subagent]
runs-on: ubuntu-latest
steps:
- name: Require unit tests and every SDK job
env:
RESULTS: ${{ toJSON(needs.*.result) }}
run: |
printf '%s\n' "$RESULTS"
jq -e 'length == 10 and all(.[]; . == "success")' <<<"$RESULTS"
build:
name: Build fx (ReleaseSafe)
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
AI_GATEWAY_API_KEY: ""
VERCEL_OIDC_TOKEN: ""
steps:
- uses: actions/checkout@v4
- name: Setup Zig
id: zig
uses: ./.github/actions/setup-zig
with:
version: "0.17.1"
cache-key: ci-build-ReleaseSafe
# Other runners execute this binary, and their CPUs can differ from this
# one. A native build can emit instructions such as AVX-512 that those
# runners lack, so target the baseline CPU like the release builds do.
- name: Build
run: zig build -Doptimize=ReleaseSafe -Dcpu=baseline
- name: Smoke test fresh binary
run: scripts/smoke-binary.sh zig-out/bin/fx
- name: Share the binary with E2E jobs
uses: actions/upload-artifact@v4
with:
name: fx-linux-x86_64
path: zig-out/bin/fx
if-no-files-found: error
retention-days: 1
- name: Save Zig cache
uses: ./.github/actions/save-zig-cache
with:
cache-key: ${{ steps.zig.outputs.cache-key }}
cache-hit: ${{ steps.zig.outputs.cache-hit }}
# The durable-session model check in SDK (Bun + N-API/WASM) takes about 40
# minutes, the two TLA+ MCP jobs about 20 each, and the TLA+ transcript
# window and subagent models a few each. A pull request runs each only when
# it changes the code that check covers; see scripts/detect-ci-need.sh.
# Pushes to main and manual dispatches always run all four, so the main run
# that Publish libfx waits for includes them.
ci-need:
name: Detect CI need
runs-on: ubuntu-24.04
timeout-minutes: 5
outputs:
libfx: ${{ steps.detect.outputs.libfx }}
mcp: ${{ steps.detect.outputs.mcp }}
transcript_window: ${{ steps.detect.outputs.transcript_window }}
subagent: ${{ steps.detect.outputs.subagent }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Decide which model checks this change needs
id: detect
env:
CI_NEED_REQUESTED: ${{ github.event_name == 'push' && 'push to main' || (github.event_name == 'workflow_dispatch' && 'manual dispatch' || '') }}
# A pull request's merge commit has the base branch as its first parent.
run: scripts/detect-ci-need.sh HEAD^1 HEAD
sdk-wasm:
name: SDK build (WASM)
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Setup Zig
id: zig
uses: ./.github/actions/setup-zig
with:
version: "0.17.1"
cache-key: ci-sdk-wasm
- name: Build WASM surfaces (ReleaseSmall)
run: |
zig build fx-core-wasm -Dwasm-surface=core -Doptimize=ReleaseSmall
zig build fx-term-wasm -Dwasm-surface=term -Doptimize=ReleaseSmall
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "24"
# The SDK jobs test the modules the package ships, after wasm-opt.
- name: Shrink WASM surfaces with wasm-opt
run: |
npm ci --prefix sdk/tools
node sdk/scripts/optimize-wasm.mjs zig-out/bin/fx-core.wasm zig-out/bin/fx-term.wasm
- name: Share WASM surfaces with SDK jobs
uses: actions/upload-artifact@v4
with:
name: sdk-wasm
path: |
zig-out/bin/fx-core.wasm
zig-out/bin/fx-term.wasm
if-no-files-found: error
retention-days: 1
- name: Save Zig cache
uses: ./.github/actions/save-zig-cache
with:
cache-key: ${{ steps.zig.outputs.cache-key }}
cache-hit: ${{ steps.zig.outputs.cache-hit }}
sdk-napi:
name: SDK build (N-API, ${{ matrix.platform }})
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- platform: linux-x64
target_flags: -Dtarget=x86_64-linux-gnu.2.34 -Dcpu=baseline
- platform: linux-arm64
target_flags: -Dtarget=aarch64-linux-gnu.2.34 -Dcpu=baseline
- platform: darwin-x64
target_flags: -Dtarget=x86_64-macos -Dcpu=baseline
- platform: darwin-arm64
target_flags: -Dtarget=aarch64-macos -Dcpu=baseline
steps:
- uses: actions/checkout@v4
# build.zig locates node_api.h through the node on PATH.
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Setup Zig
id: zig
uses: ./.github/actions/setup-zig
with:
version: "0.17.1"
cache-key: ci-sdk-napi-${{ matrix.platform }}
- name: Build N-API addon (ReleaseSafe)
run: |
zig build libfx-napi -Dnapi-surface=core -Doptimize=ReleaseSafe ${{ matrix.target_flags }}
mkdir -p native-addons
cp zig-out/lib/libfx.node native-addons/libfx.${{ matrix.platform }}.node
- name: Share the addon with SDK jobs
uses: actions/upload-artifact@v4
with:
name: sdk-napi-${{ matrix.platform }}
path: native-addons/libfx.${{ matrix.platform }}.node
if-no-files-found: error
retention-days: 1
- name: Save Zig cache
uses: ./.github/actions/save-zig-cache
with:
cache-key: ${{ steps.zig.outputs.cache-key }}
cache-hit: ${{ steps.zig.outputs.cache-hit }}
sdk-node-wasm:
name: SDK (Node + WASM)
needs: sdk-wasm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Download WASM surfaces
uses: actions/download-artifact@v4
with:
name: sdk-wasm
path: zig-out/bin
- name: Install terminal test dependencies
run: npm ci --prefix sdk/node
- name: Install the durable Worlds
run: npm ci --prefix sdk/durable
- name: Test Node + WASM
run: npm run --prefix sdk test:node-wasm
- name: Test libfx Wasm integrations
run: |
node --experimental-wasm-jspi sdk/tests/test-host-tools.mjs wasm
node --experimental-wasm-jspi sdk/tests/test-hooks.mjs wasm
env LIBFX_TEST_HOOKS=1 node --experimental-wasm-jspi sdk/tests/test-agent-steering.mjs wasm
node --experimental-wasm-jspi sdk/tests/test-host-tool-cancel.mjs wasm
node --experimental-wasm-jspi sdk/tests/test-mcp-adapter.mjs http wasm
node --experimental-wasm-jspi sdk/tests/test-skills-adapter.mjs host wasm
- name: Test durable sessions on Wasm
run: |
node --experimental-wasm-jspi sdk/tests/test-durable.mjs memory wasm
env LIBFX_TEST_HOOKS=1 node --experimental-wasm-jspi sdk/tests/test-durable.mjs memory wasm
node --experimental-wasm-jspi sdk/tests/test-durable.mjs local wasm
node --experimental-wasm-jspi sdk/tests/test-durable-provider-crash.mjs wasm
- name: Type-check the TypeScript declarations
run: node sdk/tests/test-types.mjs
sdk-node-napi:
name: SDK (Node + N-API)
needs: sdk-napi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Download Linux addon
uses: actions/download-artifact@v4
with:
name: sdk-napi-linux-x64
path: native-addons
- name: Install the addon
run: |
mkdir -p zig-out/lib
cp native-addons/libfx.linux-x64.node zig-out/lib/libfx.node
- name: Test Node + N-API
run: npm run --prefix sdk test:node-napi
- name: Test minimal native integrations
run: |
node sdk/tests/test-minimal-api.mjs
node sdk/tests/test-host-tools.mjs native
node sdk/tests/test-hooks.mjs native
env LIBFX_TEST_HOOKS=1 node sdk/tests/test-agent-steering.mjs native
node sdk/tests/test-host-tool-cancel.mjs native
node sdk/tests/test-mcp-adapter.mjs stdio native
node sdk/tests/test-skills-adapter.mjs disk native
- name: Install the durable Worlds
run: npm ci --prefix sdk/durable
- name: Test durable sessions on N-API
run: |
node sdk/tests/test-vercel-storage.mjs
node sdk/tests/test-durable.mjs memory native
env LIBFX_TEST_HOOKS=1 node sdk/tests/test-durable.mjs memory native
node sdk/tests/test-durable.mjs local native
node sdk/tests/test-durable.mjs world native
node sdk/tests/test-durable-provider-crash.mjs native
node sdk/tests/test-durable-core.mjs memory
node sdk/tests/test-durable-core.mjs local
node sdk/tests/test-durable-core.mjs world
node sdk/tests/test-durable-core.mjs queue
sdk-bun:
name: SDK (Bun + N-API/WASM)
needs: [ci-need, sdk-wasm, sdk-napi]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.4.2"
- name: Download WASM surfaces
uses: actions/download-artifact@v4
with:
name: sdk-wasm
path: zig-out/bin
- name: Download native addons
uses: actions/download-artifact@v4
with:
pattern: sdk-napi-*
path: native-addons
merge-multiple: true
- name: Install the Linux addon
run: |
mkdir -p zig-out/lib
cp native-addons/libfx.linux-x64.node zig-out/lib/libfx.node
- name: Install terminal test dependencies
run: npm ci --prefix sdk/node
- name: Install the durable Worlds
run: npm ci --prefix sdk/durable
- name: Test Bun + N-API
run: bun sdk/tests/test-node-napi.mjs
- name: Test Bun + WASM
run: bun sdk/tests/test-node-wasm.mjs
- name: Test Bun benchmark path
run: |
bun sdk/tests/test-libfx-benchmark.mjs
bun sdk/tests/test-durable-harness.mjs
- name: Test durable sessions on Bun
run: |
bun sdk/tests/test-durable.mjs memory native
bun sdk/tests/test-durable.mjs local native
bun sdk/tests/test-durable-core.mjs memory
bun sdk/tests/test-durable-core.mjs local
- name: Model-check durable sessions and drive the code along the model
if: needs.ci-need.outputs.libfx == 'true'
run: |
set -euo pipefail
jar="$RUNNER_TEMP/tla2tools.jar"
curl -fsSL -o "$jar" https://github.com/tlaplus/tlaplus/releases/download/v1.7.4/tla2tools.jar
echo "936a262061c914694dfd669a543be24573c45d5aa0ff20a8b96b23d01e050e88 $jar" | sha256sum -c -
TLA2TOOLS_JAR="$jar" tests/tla/sdk/check.sh
bun tests/tla/drivers/drive.mjs send --walks 40
bun tests/tla/drivers/drive.mjs send --walks 20 --seed 3 --hooks
bun tests/tla/drivers/drive.mjs lookup --walks 40 --seed 7
bun tests/tla/drivers/drive.mjs send --walks 20 --seed 3 --durability world
bun tests/tla/drivers/drive.mjs lookup --walks 20 --seed 9 --durability world
bun tests/tla/drivers/drive.mjs write --walks 20 --seed 4
bun tests/tla/drivers/drive.mjs cutoff --walks 20 --seed 5
bun tests/tla/drivers/drive.mjs leased --walks 40 --seed 12
bun tests/tla/drivers/drive.mjs queue --walks 40 --seed 4
bun tests/tla/drivers/drive-intake.mjs --walks 60 --seed 1
bun tests/tla/drivers/drive-intake.mjs --walks 30 --seed 2 --durability world
bun tests/tla/drivers/drive-images.mjs --walks 40 --seed 1
bun tests/tla/drivers/drive-images.mjs --walks 20 --seed 2 --backend wasm
bun tests/tla/drivers/drive-agents.mjs --walks 60 --seed 11
bun tests/tla/drivers/drive-tenants.mjs --walks 60 --seed 11
bun tests/tla/drivers/drive-steer.mjs ideal --walks 20 --seed 2
bun tests/tla/drivers/drive-steer.mjs faults --walks 20 --seed 4
bun tests/tla/drivers/drive-steer.mjs faults --walks 10 --seed 4 --hooks
bun tests/tla/drivers/drive-steer.mjs faults --walks 10 --seed 6 --backend wasm
bun tests/tla/drivers/drive-steer.mjs faults --walks 8 --seed 8 --stream-lag 400
- name: Test libfx on a World
run: |
# The World libfx bundles, installed above from its lockfile.
world_root=sdk/durable
node sdk/tests/test-world-persistence.mjs "$world_root" native
node --experimental-wasm-jspi sdk/tests/test-world-persistence.mjs "$world_root" wasm
bun sdk/tests/test-world-persistence.mjs "$world_root" native
bun sdk/tests/test-world-persistence.mjs "$world_root" wasm
- name: Test Bun cross-backend integrations
run: |
bun sdk/tests/test-agent-bootstrap.mjs auto
bun sdk/tests/test-checkpoint.mjs native wasm
bun sdk/tests/test-checkpoint.mjs wasm native
bun sdk/tests/test-journal.mjs native wasm
bun sdk/tests/test-journal.mjs wasm native
bun sdk/tests/test-tool-contract.mjs native
bun sdk/tests/test-tool-contract.mjs wasm
bun sdk/tests/test-host-tools.mjs native
bun sdk/tests/test-host-tools.mjs wasm
bun sdk/tests/test-host-tool-cancel.mjs native
bun sdk/tests/test-host-tool-cancel.mjs wasm
bun sdk/tests/test-mcp-adapter.mjs stdio native
bun sdk/tests/test-mcp-adapter.mjs http wasm
bun sdk/tests/test-skills-adapter.mjs disk native
bun sdk/tests/test-skills-adapter.mjs host wasm
- name: Check Linux addon compatibility
run: |
python3 sdk/tests/test-linux-abi.py
python3 sdk/scripts/check-linux-abi.py zig-out/lib/libfx.node
docker run --rm --network none --entrypoint /bin/bash \
--volume "$PWD:/workspace:ro" --workdir /workspace \
public.ecr.aws/lambda/nodejs@sha256:2472f0273d8848d8b2aa6528f5526b8a514b70703596199efe5a4b84d3d59b0b -euc '
node sdk/tests/test-native-core-ready.mjs
node sdk/tests/test-host-tools.mjs native
node sdk/tests/test-host-tool-cancel.mjs native
'
- name: Test Node package and backend diagnostics
run: |
node --experimental-wasm-jspi sdk/tests/test-backend-info.mjs
node --experimental-wasm-jspi sdk/tests/test-node-bundled-assets.mjs
node sdk/tests/test-node-package.mjs
node sdk/tests/test-term-demo-package.mjs
node sdk/scripts/package-libfx.mjs sdk/dist native-addons/libfx.linux-x64.node native-addons/libfx.linux-arm64.node native-addons/libfx.darwin-x64.node native-addons/libfx.darwin-arm64.node
node --experimental-wasm-jspi sdk/tests/test-node-async-assets.mjs sdk/dist/libfx
npm pack ./sdk/dist/libfx --ignore-scripts --json > /tmp/libfx-pack.json
mv "$(node -p 'require("/tmp/libfx-pack.json")[0].filename')" /tmp/libfx-package.tgz
mkdir -p /tmp/libfx-native
for package in sdk/dist/libfx-*/; do npm pack "./$package" --ignore-scripts --pack-destination /tmp/libfx-native; done
node sdk/tests/test-packed-example.mjs /tmp/libfx-package.tgz native esm --native-dir /tmp/libfx-native
node sdk/tests/test-packed-example.mjs /tmp/libfx-package.tgz native cjs --native-dir /tmp/libfx-native
node --experimental-wasm-jspi sdk/tests/test-packed-example.mjs /tmp/libfx-package.tgz wasm esm
node --experimental-wasm-jspi sdk/tests/test-packed-example.mjs /tmp/libfx-package.tgz wasm cjs
- name: Test package recovery and lifecycle boundaries
run: |
node sdk/tests/test-package-resilience.mjs --package /tmp/libfx-package.tgz --native-dir /tmp/libfx-native \
--cheap-cycles 100 --tool-workflows 20 --duration-ms 5000 --concurrency 4 \
--json-out "${{ runner.temp }}/libfx-package-evidence/resilience.json"
- name: Install Next fixture package manager
run: npm install --global pnpm@11.1.1
- name: Test installed package through Next
env:
LIBFX_TEST_ARTIFACT_ROOT: ${{ runner.temp }}/libfx-package-evidence
run: |
node sdk/tests/test-next-package.mjs /tmp/libfx-package.tgz --native-dir /tmp/libfx-native
node sdk/tests/test-next-package.mjs /tmp/libfx-package.tgz --native-dir /tmp/libfx-native --webpack
node sdk/tests/test-next-package.mjs /tmp/libfx-package.tgz --native-dir /tmp/libfx-native --next15
- name: Retain package qualification evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: libfx-next-package-evidence
path: |
${{ runner.temp }}/libfx-package-evidence/resilience.json
${{ runner.temp }}/libfx-package-evidence/libfx-next-*/*.log
${{ runner.temp }}/libfx-package-evidence/libfx-next-*/results.json
${{ runner.temp }}/libfx-package-evidence/libfx-trace-*/*.log
${{ runner.temp }}/libfx-package-evidence/libfx-trace-*/results.json
if-no-files-found: ignore
sdk-package-guards:
name: SDK package guards
needs: [sdk-wasm, sdk-napi]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.4.2"
- name: Download WASM surfaces
uses: actions/download-artifact@v4
with:
name: sdk-wasm
path: zig-out/bin
- name: Download native addons
uses: actions/download-artifact@v4
with:
pattern: sdk-napi-*
path: native-addons
merge-multiple: true
- name: Install the durable Worlds and the package test tools
run: |
npm ci --prefix sdk/durable
npm ci --prefix sdk/tests/tools
- name: Package libfx and its platform packages
run: |
node sdk/scripts/package-libfx.mjs sdk/dist native-addons/libfx.linux-x64.node native-addons/libfx.linux-arm64.node native-addons/libfx.darwin-x64.node native-addons/libfx.darwin-arm64.node
npm pack ./sdk/dist/libfx --ignore-scripts --json > /tmp/libfx-pack.json
mv "$(node -p 'require("/tmp/libfx-pack.json")[0].filename')" /tmp/libfx-package.tgz
mkdir -p /tmp/libfx-native
for package in sdk/dist/libfx-*/; do npm pack "./$package" --ignore-scripts --pack-destination /tmp/libfx-native; done
# With the platform package, Node.js loads no WebAssembly host code;
# with only the macOS package, libfx names the Linux one it needs.
- name: Check what Node.js loads from libfx
run: node sdk/tests/test-node-load-graph.mjs /tmp/libfx-package.tgz --native-dir /tmp/libfx-native
- name: Check browser bundles
run: node sdk/tests/test-browser-bundles.mjs /tmp/libfx-package.tgz
- name: Check package sizes
run: node sdk/tests/test-package-size.mjs /tmp/libfx-package.tgz --native-dir /tmp/libfx-native
# The subpaths other than libfx and libfx/node have always been ES
# modules only, which require() loads on the Node.js versions libfx
# supports.
- name: Lint the package and its types
run: |
sdk/tests/tools/node_modules/.bin/publint /tmp/libfx-package.tgz
sdk/tests/tools/node_modules/.bin/attw /tmp/libfx-package.tgz --profile node16 --ignore-rules cjs-resolves-to-esm
sdk-browser-wasm:
name: SDK (Browser + WASM)
needs: sdk-wasm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Setup Chrome
id: setup-chrome
uses: browser-actions/setup-chrome@v2
- name: Download WASM surfaces
uses: actions/download-artifact@v4
with:
name: sdk-wasm
path: zig-out/bin
- name: Test Browser + WASM
env:
CHROME_PATH: ${{ steps.setup-chrome.outputs.chrome-path }}
run: npm run --prefix sdk test:browser-wasm
# The MCP engine models and the driver that runs src/mcp/ along them. The
# host models and drivers run in the next job, in parallel, so neither job
# takes the whole 40 minutes alone. Their planted bugs stay local
# (tests/tla/mcp/check.sh): they measure the checks, not the code.
tla-mcp:
name: TLA+ MCP engine models and driver
needs: [build, ci-need]
runs-on: ubuntu-24.04
timeout-minutes: 40
env:
AI_GATEWAY_API_KEY: ""
VERCEL_OIDC_TOKEN: ""
steps:
- uses: actions/checkout@v4
- name: Download fx
uses: actions/download-artifact@v4
with:
name: fx-linux-x86_64
path: zig-out/bin
- name: Restore executable mode
run: chmod +x zig-out/bin/fx
# The MCP driver builds its labs against src/mcp/.
- name: Setup Zig
uses: ./.github/actions/setup-zig
with:
version: "0.17.1"
cache-key: ci-tla-mcp
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.14"
- name: Install tmux
run: |
command -v tmux >/dev/null 2>&1 || { sudo apt-get update && sudo apt-get install -y tmux; }
printf 'set-option -g history-limit 100000\n' > "$HOME/.tmux.conf"
tmux -V
- name: Model-check the MCP engine, and drive src/mcp/ along the models
if: needs.ci-need.outputs.mcp == 'true'
run: |
set -euo pipefail
jar="$RUNNER_TEMP/tla2tools.jar"
curl -fsSL -o "$jar" https://github.com/tlaplus/tlaplus/releases/download/v1.7.4/tla2tools.jar
echo "936a262061c914694dfd669a543be24573c45d5aa0ff20a8b96b23d01e050e88 $jar" | sha256sum -c -
export TLA2TOOLS_JAR="$jar"
python3 tests/tla/mcp/run.py check
bun tests/tla/drivers/mcp/driver.ts
# The MCP host models, which models.test.ts checks with TLC, and the drivers
# that run fx along them. It runs beside the engine job above. Planted bugs
# stay local (tests/tla/mcp_host/check.sh).
tla-mcp-host:
name: TLA+ MCP host models and drivers
needs: [build, ci-need]
runs-on: ubuntu-24.04
timeout-minutes: 40
env:
AI_GATEWAY_API_KEY: ""
VERCEL_OIDC_TOKEN: ""
steps:
- uses: actions/checkout@v4
- name: Download fx
uses: actions/download-artifact@v4
with:
name: fx-linux-x86_64
path: zig-out/bin
- name: Restore executable mode
run: chmod +x zig-out/bin/fx
# The same toolchain as the engine job.
- name: Setup Zig
uses: ./.github/actions/setup-zig
with:
version: "0.17.1"
cache-key: ci-tla-mcp-host
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.14"
- name: Install tmux
run: |
command -v tmux >/dev/null 2>&1 || { sudo apt-get update && sudo apt-get install -y tmux; }
printf 'set-option -g history-limit 100000\n' > "$HOME/.tmux.conf"
tmux -V
- name: Model-check the MCP host, and drive fx along the models
if: needs.ci-need.outputs.mcp == 'true'
run: |
set -euo pipefail
jar="$RUNNER_TEMP/tla2tools.jar"
curl -fsSL -o "$jar" https://github.com/tlaplus/tlaplus/releases/download/v1.7.4/tla2tools.jar
echo "936a262061c914694dfd669a543be24573c45d5aa0ff20a8b96b23d01e050e88 $jar" | sha256sum -c -
export TLA2TOOLS_JAR="$jar"
bun test ./tests/tla/drivers/mcp_host/
# The transcript window model and the window's core driven along it both
# ways. Its planted bugs and the run of a built fx along the model stay local
# (tests/tla/transcript_window/check.sh without --ci): the first measure the
# checks, not the code, and the second drives fx through tmux.
tla-transcript-window:
name: TLA+ transcript window model
needs: ci-need
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
AI_GATEWAY_API_KEY: ""
VERCEL_OIDC_TOKEN: ""
steps:
- uses: actions/checkout@v4
if: needs.ci-need.outputs.transcript_window == 'true'
# The core's tests and the drivers' harness build against
# src/ui/transcript/transcript_window.zig.
- name: Setup Zig
if: needs.ci-need.outputs.transcript_window == 'true'
uses: ./.github/actions/setup-zig
with:
version: "0.17.1"
cache-key: ci-tla-transcript-window
- name: Setup Bun
if: needs.ci-need.outputs.transcript_window == 'true'
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.14"
- name: Model-check the transcript window and drive its core along the model
if: needs.ci-need.outputs.transcript_window == 'true'
run: |
set -euo pipefail
jar="$RUNNER_TEMP/tla2tools.jar"
curl -fsSL -o "$jar" https://github.com/tlaplus/tlaplus/releases/download/v1.7.4/tla2tools.jar
echo "936a262061c914694dfd669a543be24573c45d5aa0ff20a8b96b23d01e050e88 $jar" | sha256sum -c -
TLA2TOOLS_JAR="$jar" tests/tla/transcript_window/check.sh --ci
# The subagent steering, stop-then-message, main-mail and wait-nudge models, the
# session-write and live sessions models, and the drivers that run a built fx
# along them. Only the design configs and the session witnesses run here; the
# planted bugs and fx's old defects stay local (both check.sh scripts with no
# arguments): they measure the checks, not the code.
tla-subagent:
name: TLA+ subagent and session-write models
needs: [build, ci-need]
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
AI_GATEWAY_API_KEY: ""
VERCEL_OIDC_TOKEN: ""
steps:
- uses: actions/checkout@v4
if: needs.ci-need.outputs.subagent == 'true'
- name: Download fx
if: needs.ci-need.outputs.subagent == 'true'
uses: actions/download-artifact@v4
with:
name: fx-linux-x86_64
path: zig-out/bin
- name: Restore executable mode
if: needs.ci-need.outputs.subagent == 'true'
run: chmod +x zig-out/bin/fx
- name: Setup Bun
if: needs.ci-need.outputs.subagent == 'true'
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.14"
- name: Model-check subagent messages, session writes, and live sessions, and drive fx along the models
if: needs.ci-need.outputs.subagent == 'true'
run: |
set -euo pipefail
jar="$RUNNER_TEMP/tla2tools.jar"
curl -fsSL -o "$jar" https://github.com/tlaplus/tlaplus/releases/download/v1.7.4/tla2tools.jar
echo "936a262061c914694dfd669a543be24573c45d5aa0ff20a8b96b23d01e050e88 $jar" | sha256sum -c -
export TLA2TOOLS_JAR="$jar"
tests/tla/subagent/check.sh steer-queue steer-queue-deep stop-message stop-message-deep main-mail main-mail-acp quiet-relay quiet-relay-deep wait-nudge
tests/tla/session/check.sh session-write session-write-witness-added-during-write session-write-witness-waits session-write-witness-relisted live-holds live-simulate live-witness-stale live-witness-idle-parent live-witness-open-fails-on-scan
bun tests/tla/drivers/subagent/driver.ts
bun test ./tests/tla/drivers/subagent/stop-message.test.ts
bun test ./tests/tla/drivers/subagent/main-mail.test.ts
bun test ./tests/tla/drivers/subagent/quiet-relay.test.ts
bun test ./tests/tla/drivers/session/write.test.ts
bun test ./tests/tla/drivers/session/live.test.ts
e2e_mode:
name: E2E (deterministic, shard ${{ matrix.shard.label }})
needs: build
runs-on: ubuntu-24.04
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
shard:
- index: 0
label: "1/4"
- index: 1
label: "2/4"
- index: 2
label: "3/4"
- index: 3
label: "4/4"
env:
AI_GATEWAY_API_KEY: ""
VERCEL_OIDC_TOKEN: ""
FX_REQUIRE_TMUX: "1"
SHARD_INDEX: ${{ matrix.shard.index }}
SHARD_COUNT: 4
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download fx
uses: actions/download-artifact@v4
with:
name: fx-linux-x86_64
path: zig-out/bin
- name: Restore executable mode
run: chmod +x zig-out/bin/fx
# Some E2E files build their own Zig fixtures.
- name: Setup Zig
id: zig
uses: ./.github/actions/setup-zig
with:
version: "0.17.1"
cache-key: ci-e2e-fixtures
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.14"
- name: Install E2E system dependencies
timeout-minutes: 17
run: |
missing=()
command -v tmux >/dev/null 2>&1 || missing+=(tmux)
command -v zsh >/dev/null 2>&1 || missing+=(zsh)
# cli.test.ts runs the fish completion script only where fish is installed.
command -v fish >/dev/null 2>&1 || missing+=(fish)
if [ "${#missing[@]}" -gt 0 ]; then
retry() {
local attempt
for attempt in 1 2; do
if "$@"; then
return 0
fi
if [ "$attempt" -lt 2 ]; then
printf 'Dependency install attempt %s failed; retrying in 5s\n' "$attempt" >&2
sleep 5
fi
done
return 1
}
# The Azure mirror can stall after APT has already fetched release
# metadata from the direct Ubuntu fallback. Prefer that fallback
# for the whole update when the runner's mirror list provides it.
if [ -f /etc/apt/apt-mirrors.txt ] &&
grep -Eq '^https?://(archive|ports)\.ubuntu\.com/' /etc/apt/apt-mirrors.txt
then
sudo sed -i '/:\/\/azure\..*ubuntu\.com\//d' /etc/apt/apt-mirrors.txt
fi
retry sudo timeout --kill-after=15s 4m apt-get \
-o Acquire::Retries=3 \
-o Acquire::http::Timeout=30 \
-o Acquire::https::Timeout=30 \
update
retry sudo timeout --kill-after=15s 3m apt-get \
-o Dpkg::Use-Pty=0 \
install -y "${missing[@]}"
fi
printf 'set-option -g history-limit 100000\n' > "$HOME/.tmux.conf"
tmux -V
zsh --version
fish --version
- name: Install E2E dependencies
run: bun install --frozen-lockfile
working-directory: tests/e2e
- name: Run deterministic E2E shard
working-directory: tests/e2e
run: |
selected=()
selection_file="$RUNNER_TEMP/fx-e2e-shard-${SHARD_INDEX}.txt"
bun ci-shards.ts \
--shard-count "$SHARD_COUNT" \
--shard-index "$SHARD_INDEX" > "$selection_file"
while IFS= read -r test_file; do
selected+=("$test_file")
done < "$selection_file"
test "${#selected[@]}" -gt 0
printf 'Running E2E shard %s/%s (%s files):\n' "$((SHARD_INDEX + 1))" "$SHARD_COUNT" "${#selected[@]}"
printf ' %s\n' "${selected[@]}"
./ci-run-files.sh "${selected[@]}"
- name: Save Zig cache
if: matrix.shard.index == 0
uses: ./.github/actions/save-zig-cache
with:
cache-key: ${{ steps.zig.outputs.cache-key }}
cache-hit: ${{ steps.zig.outputs.cache-hit }}
e2e_conformance:
name: E2E (MCP conformance)
needs: build
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
AI_GATEWAY_API_KEY: ""
VERCEL_OIDC_TOKEN: ""
FX_SOUND: "0"
steps:
- uses: actions/checkout@v4
- name: Download fx