-
Notifications
You must be signed in to change notification settings - Fork 3k
2413 lines (2314 loc) · 107 KB
/
Copy pathmanaged-images.yaml
File metadata and controls
2413 lines (2314 loc) · 107 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
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# Publish complete managed images from exact base-image contracts. Every
# agent/platform lane pushes and validates only an immutable digest. The
# aggregate publisher then proves that all three agents have both supported
# Linux architectures before it stages any cohort alias. Only after all staged
# aliases resolve to the exact validated manifests does the single OpenClaw
# cohort pointer move. Consumers use that pointer to discover the matching
# Hermes and Deep Agents Code cohort aliases, so a failed run cannot expose a
# mixed-agent or mixed-architecture cohort.
name: Images / Managed Images
on:
workflow_call:
pull_request:
paths:
- ".github/workflows/managed-images.yaml"
- ".dockerignore"
- "Dockerfile"
- "agents/**"
- "ci/npm-audit-exceptions.json"
- "nemoclaw/**"
- "nemoclaw-blueprint/**"
- "scripts/**"
- "src/lib/actions/sandbox/openshell-child-visible-credentials.v*.json"
- "src/lib/core/json-types.ts"
- "src/lib/core/ports.ts"
- "src/lib/messaging/**"
- "src/lib/onboard/**"
- "src/lib/security/credential-hash.ts"
- "src/lib/state/paths.ts"
- "src/lib/state/state-root.ts"
- "test/e2e/live/managed-image-activation-e2e*.ts"
- "src/lib/tool-disclosure.ts"
- "tools/mcp-tool-discovery-runtime/**"
- "tsconfig.runtime-preloads.json"
permissions:
contents: read
packages: write
concurrency:
group: managed-images-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
REGISTRY: ghcr.io
jobs:
pr-staging-qa-deep-code:
name: Staging QA base permission regression (Deep Agents Code)
if: github.event_name == 'pull_request'
runs-on: ubuntu-22.04
timeout-minutes: 90
permissions:
contents: read
env:
CANDIDATE_SHA: ${{ github.event.pull_request.head.sha }}
# Retains the reviewed discovery-permission repair and the current
# managed-image security inventory. The original staging source pinned
# Expat 2.8.2, which cannot satisfy the candidate's 2.8.3 contract.
STAGING_QA_SOURCE_SHA: 250d4abd2d602f864659c06d170699347b5d38bc
STAGING_QA_BASE_IMAGE: nemoclaw-deepagents-code-base:staging-31396519688
STAGING_QA_FINAL_IMAGE: nemoclaw-managed-pr/langchain-deepagents-code-staging-qa
steps:
- name: Checkout latest PR commit
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
path: candidate
persist-credentials: false
# Rebuild a security-compatible base from the exact source that retains
# the reviewed discovery-permission repair.
- name: Checkout exact staging QA base source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ env.STAGING_QA_SOURCE_SHA }}
path: staging-qa-base-source
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22.19.0
- name: Validate staging QA source
shell: bash
run: |
set -euo pipefail
source_root="$GITHUB_WORKSPACE/staging-qa-base-source"
actual_source_sha="$(git -C "$source_root" rev-parse HEAD)"
if [ "$actual_source_sha" != "$STAGING_QA_SOURCE_SHA" ]; then
echo "ERROR: staging QA base source does not match the recorded NemoClaw commit." >&2
exit 1
fi
printf '### Staging QA Deep Agents Code base\n\n'
printf 'NemoClaw source commit: %s\n' "$STAGING_QA_SOURCE_SHA"
{
printf '### Staging QA Deep Agents Code base\n\n'
printf 'NemoClaw source commit: %s\n' "$STAGING_QA_SOURCE_SHA"
} >> "$GITHUB_STEP_SUMMARY"
# NemoPatch exact Deep Agents candidate-base boundary.
# Preserve the recorded staging tree and replace only the dependency inputs
# that the candidate base image owns.
- name: Overlay exact PR dependency inputs on staging QA base
shell: bash
run: |
set -euo pipefail
candidate_root="$GITHUB_WORKSPACE/candidate"
staging_root="$GITHUB_WORKSPACE/staging-qa-base-source"
for relative in \
agents/langchain-deepagents-code/Dockerfile.base \
agents/langchain-deepagents-code/requirements.lock
do
source_file="$candidate_root/$relative"
destination_file="$staging_root/$relative"
if [ ! -f "$source_file" ] || [ -L "$source_file" ] || [ ! -f "$destination_file" ] || [ -L "$destination_file" ]; then
echo "ERROR: staging QA dependency input is missing, unsafe, or changed shape: $relative" >&2
exit 1
fi
install -m 0644 "$source_file" "$destination_file"
done
printf '\nCandidate dependency inputs: %s\n' "$CANDIDATE_SHA" >> "$GITHUB_STEP_SUMMARY"
- name: Reproduce staging discovery permission drift
shell: bash
working-directory: candidate
run: |
set -euo pipefail
reviewed_root="tools/mcp-tool-discovery-runtime/reviewed-runtime-bundle/mcp-tool-discovery"
for artifact in \
BUNDLED_PACKAGES.json \
THIRD_PARTY_LICENSES.txt \
mcp-tool-discovery.bundle
do
artifact_path="${reviewed_root}/${artifact}"
if [ ! -f "$artifact_path" ] || [ -L "$artifact_path" ]; then
echo "ERROR: reviewed discovery permission fixture must be a regular non-symlink: ${artifact_path}" >&2
exit 1
fi
chmod 0664 "$artifact_path"
done
- name: Rebuild staging QA Deep Agents Code base from exact source
id: staging-base
shell: bash
env:
DOCKER_BUILDKIT: "1"
run: |
set -euo pipefail
source_root="$GITHUB_WORKSPACE/staging-qa-base-source"
docker build --progress=plain \
-f "$source_root/agents/langchain-deepagents-code/Dockerfile.base" \
-t "$STAGING_QA_BASE_IMAGE" \
"$source_root"
base_id="$(docker image inspect --format "{{.Id}}" "$STAGING_QA_BASE_IMAGE")"
if [[ ! "$base_id" =~ ^sha256:[0-9a-f]{64}$ ]]; then
echo "ERROR: rebuilt staging QA base did not resolve to an immutable local image ID." >&2
exit 1
fi
printf 'id=%s\n' "$base_id" >> "$GITHUB_OUTPUT"
printf '\nRebuilt local image: %s\n' "$base_id" >> "$GITHUB_STEP_SUMMARY"
- name: Build latest PR commit against reproduced staging QA base
id: staging-final
shell: bash
working-directory: candidate
env:
DOCKER_BUILDKIT: "1"
run: |
set -euo pipefail
final_reference="${STAGING_QA_FINAL_IMAGE}:${CANDIDATE_SHA}"
docker build --progress=plain \
-f agents/langchain-deepagents-code/Dockerfile \
--build-arg BASE_IMAGE="$STAGING_QA_BASE_IMAGE" \
--build-arg NEMOCLAW_MODEL=nvidia/nemotron-3-ultra-550b-a55b \
--build-arg NEMOCLAW_INFERENCE_PROVIDER_ID=inference \
--build-arg NEMOCLAW_UPSTREAM_PROVIDER=nvidia-nim \
--build-arg NEMOCLAW_INFERENCE_BASE_URL=https://inference.local/v1 \
--build-arg NEMOCLAW_INFERENCE_API=openai-completions \
--build-arg NEMOCLAW_DCODE_AUTO_APPROVAL=thread-opt-in \
--build-arg NEMOCLAW_BUILD_ID="$STAGING_QA_SOURCE_SHA" \
--build-arg NEMOCLAW_DARWIN_VM_COMPAT=0 \
-t "$final_reference" \
.
final_id="$(docker image inspect --format "{{.Id}}" "$final_reference")"
if [[ ! "$final_id" =~ ^sha256:[0-9a-f]{64}$ ]]; then
echo "ERROR: staging QA final image did not resolve to an immutable local image ID." >&2
exit 1
fi
printf 'id=%s\n' "$final_id" >> "$GITHUB_OUTPUT"
- name: Validate staging QA final image contract
shell: bash
env:
BASE_ID: ${{ steps.staging-base.outputs.id }}
FINAL_ID: ${{ steps.staging-final.outputs.id }}
run: |
set -euo pipefail
base_layers="$(docker image inspect --format "{{json .RootFS.Layers}}" "$BASE_ID")"
final_layers="$(docker image inspect --format "{{json .RootFS.Layers}}" "$FINAL_ID")"
if ! jq -n -e \
--argjson base "$base_layers" \
--argjson final "$final_layers" '
($base | length) > 0 and
($final | length) >= ($base | length) and
all(range(0; $base | length); $final[.] == $base[.])
' >/dev/null; then
echo "ERROR: staging QA final image does not extend the rebuilt QA base." >&2
exit 1
fi
if ! actual_discovery_contract="$(
docker run --rm --platform linux/amd64 --entrypoint /bin/sh "$FINAL_ID" -c '
set -eu
discovery_runtime=/usr/local/lib/nemoclaw/mcp-tool-discovery-runtime
if ! entry_owner_unsafe="$(find -P "$discovery_runtime" ! -user root -print -quit)"; then
echo "ERROR: staging QA discovery entry ownership inspection failed." >&2
exit 1
fi
if [ -n "$entry_owner_unsafe" ]; then
echo "ERROR: staging QA discovery entry is not root-owned: $entry_owner_unsafe" >&2
exit 1
fi
if ! owner_or_write_unsafe="$(
find -L "$discovery_runtime" \
\( ! -user root -o -perm /022 \) -print -quit
)"; then
echo "ERROR: staging QA discovery tree inspection failed." >&2
exit 1
fi
if [ -n "$owner_or_write_unsafe" ]; then
echo "ERROR: staging QA discovery tree is not root-owned and read-only: $owner_or_write_unsafe" >&2
exit 1
fi
if ! mode_unsafe="$(
find -P "$discovery_runtime" \
\( \( -type d ! -perm 0555 \) -o \( -type f ! -perm 0444 \) \) \
-print -quit
)"; then
echo "ERROR: staging QA discovery mode inspection failed." >&2
exit 1
fi
if [ -n "$mode_unsafe" ]; then
echo "ERROR: staging QA discovery path has an unexpected mode: $mode_unsafe" >&2
exit 1
fi
if ! actual_discovery_contract="$(node "$discovery_runtime/mcp-tool-discovery.mjs")"; then
echo "ERROR: staging QA discovery bundle execution failed." >&2
exit 1
fi
printf "%s" "$actual_discovery_contract"
'
)"; then
echo "ERROR: staging QA final image discovery contract probe failed." >&2
exit 1
fi
if ! node -e '
const expected = {
protocol: 1,
ok: false,
detail: "tool discovery received invalid runtime arguments",
};
let result;
try {
result = JSON.parse(require("node:fs").readFileSync(0, "utf8"));
} catch {
process.exit(1);
}
const record =
result !== null && typeof result === "object" && !Array.isArray(result)
? result
: undefined;
if (
!record ||
record.protocol !== expected.protocol ||
record.ok !== expected.ok ||
record.detail !== expected.detail
) {
process.exit(1);
}
' <<< "$actual_discovery_contract" >/dev/null; then
echo "ERROR: staging QA discovery bundle contract mismatch." >&2
exit 1
fi
pr-build-and-entrypoint:
name: PR build and direct managed startup (${{ matrix.display_name }})
# External contributor PRs retain the local build/direct-startup lane after
# GitHub's maintainer workflow approval. Exact digest publication is limited
# to branches in NVIDIA/NemoClaw; fork jobs never log in or push.
if: github.event_name == 'pull_request'
runs-on: ubuntu-24.04
timeout-minutes: 90
permissions:
contents: read
packages: write
env:
CANDIDATE_SHA: ${{ github.event.pull_request.head.sha }}
strategy:
fail-fast: false
matrix:
include:
- agent: openclaw
display_name: OpenClaw
dockerfile: Dockerfile
base_alias: ghcr.io/nvidia/nemoclaw/sandbox-base:latest
base_repository: ghcr.io/nvidia/nemoclaw/sandbox-base
image: nemoclaw-managed-pr/openclaw
repository: ghcr.io/nvidia/nemoclaw/openclaw-sandbox
- agent: hermes
display_name: Hermes
dockerfile: agents/hermes/Dockerfile
base_alias: ghcr.io/nvidia/nemoclaw/hermes-sandbox-base:latest
base_repository: ghcr.io/nvidia/nemoclaw/hermes-sandbox-base
image: nemoclaw-managed-pr/hermes
repository: ghcr.io/nvidia/nemoclaw/hermes-sandbox
- agent: langchain-deepagents-code
display_name: Deep Agents Code
dockerfile: agents/langchain-deepagents-code/Dockerfile
base_alias: ghcr.io/nvidia/nemoclaw/langchain-deepagents-code-sandbox-base:latest
base_repository: ghcr.io/nvidia/nemoclaw/langchain-deepagents-code-sandbox-base
image: nemoclaw-managed-pr/langchain-deepagents-code
repository: ghcr.io/nvidia/nemoclaw/langchain-deepagents-code-sandbox
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- name: Reproduce reviewed discovery permission drift
shell: bash
run: |
set -euo pipefail
reviewed_root="tools/mcp-tool-discovery-runtime/reviewed-runtime-bundle/mcp-tool-discovery"
for artifact in \
BUNDLED_PACKAGES.json \
THIRD_PARTY_LICENSES.txt \
mcp-tool-discovery.bundle
do
artifact_path="${reviewed_root}/${artifact}"
if [ ! -f "$artifact_path" ] || [ -L "$artifact_path" ]; then
echo "ERROR: reviewed discovery permission fixture must be a regular non-symlink: ${artifact_path}" >&2
exit 1
fi
chmod 0664 "$artifact_path"
done
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22.19.0
- name: Validate exact Deep Agents PR base build args
if: matrix.agent == 'langchain-deepagents-code'
shell: bash
run: scripts/check-production-build-args.sh -f agents/langchain-deepagents-code/Dockerfile.base
- name: Log in to GHCR for exact same-repository PR digest
if: github.event.pull_request.head.repo.full_name == github.repository
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish exact Deep Agents PR base by digest
id: candidate-base-build
if: matrix.agent == 'langchain-deepagents-code' && github.event.pull_request.head.repo.full_name == github.repository
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: agents/langchain-deepagents-code/Dockerfile.base
platforms: linux/amd64
outputs: type=image,name=${{ matrix.base_repository }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=registry,ref=${{ matrix.base_repository }}:buildcache-linux-amd64
provenance: false
sbom: false
- name: Bind exact Deep Agents PR base
id: candidate-base
if: matrix.agent == 'langchain-deepagents-code' && github.event.pull_request.head.repo.full_name == github.repository
shell: bash
env:
BASE_REPOSITORY: ${{ matrix.base_repository }}
DIGEST: ${{ steps.candidate-base-build.outputs.digest }}
run: |
set -euo pipefail
if [[ ! "$DIGEST" =~ ^sha256:[0-9a-f]{64}$ ]]; then
echo "ERROR: exact Deep Agents PR base build returned an invalid digest." >&2
exit 1
fi
reference="${BASE_REPOSITORY}@${DIGEST}"
raw="$RUNNER_TEMP/deep-agents-pr-base.raw"
docker buildx imagetools inspect "$reference" --raw > "$raw"
actual="sha256:$(sha256sum "$raw" | awk '{print $1}')"
if [ "$actual" != "$DIGEST" ]; then
echo "ERROR: exact Deep Agents PR base bytes do not match the build digest." >&2
exit 1
fi
printf 'ref=%s\n' "$reference" >> "$GITHUB_OUTPUT"
printf '### Deep Agents exact PR base\n\n`%s`\n' "$reference" >> "$GITHUB_STEP_SUMMARY"
- name: Build exact Deep Agents fork PR base locally
id: candidate-base-local-build
if: matrix.agent == 'langchain-deepagents-code' && github.event.pull_request.head.repo.full_name != github.repository
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: agents/langchain-deepagents-code/Dockerfile.base
platforms: linux/amd64
load: true
push: false
tags: nemoclaw-pr-base/${{ matrix.agent }}:${{ github.event.pull_request.head.sha }}
cache-from: type=registry,ref=${{ matrix.base_repository }}:buildcache-linux-amd64
provenance: false
sbom: false
- name: Bind exact Deep Agents fork PR base
id: candidate-base-local
if: matrix.agent == 'langchain-deepagents-code' && github.event.pull_request.head.repo.full_name != github.repository
shell: bash
env:
REFERENCE: nemoclaw-pr-base/${{ matrix.agent }}:${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
image_id="$(docker image inspect --format '{{.Id}}' "$REFERENCE")"
if [[ ! "$image_id" =~ ^sha256:[0-9a-f]{64}$ ]]; then
echo "ERROR: exact Deep Agents fork PR base did not resolve to an immutable local image ID." >&2
exit 1
fi
printf 'ref=%s\n' "$REFERENCE" >> "$GITHUB_OUTPUT"
printf '### Deep Agents exact fork PR base\n\n`%s` (`%s`)\n' "$REFERENCE" "$image_id" >> "$GITHUB_STEP_SUMMARY"
- name: Resolve exact linux/amd64 PR base
if: matrix.agent != 'langchain-deepagents-code'
id: base
shell: bash
env:
BASE_ALIAS: ${{ matrix.base_alias }}
BASE_REPOSITORY: ${{ matrix.base_repository }}
DISPLAY_NAME: ${{ matrix.display_name }}
run: |
set -euo pipefail
alias_raw="$RUNNER_TEMP/pr-base-alias.raw"
exact_raw="$RUNNER_TEMP/pr-base-exact.raw"
docker buildx imagetools inspect "$BASE_ALIAS" --raw > "$alias_raw"
if ! digest="$(
jq -er '
if (
.mediaType == "application/vnd.oci.image.index.v1+json" or
.mediaType == "application/vnd.docker.distribution.manifest.list.v2+json"
) then
[
.manifests[]
| select(
.platform.os == "linux" and
.platform.architecture == "amd64"
)
]
| if length == 1 then .[0].digest else error("not one linux/amd64 image") end
else
error("base alias is not a platform index")
end
' "$alias_raw"
)"; then
echo "ERROR: PR base alias does not contain exactly one linux/amd64 image." >&2
exit 1
fi
if [[ ! "$digest" =~ ^sha256:[0-9a-f]{64}$ ]]; then
echo "ERROR: PR base alias returned an invalid linux/amd64 digest." >&2
exit 1
fi
reference="${BASE_REPOSITORY}@${digest}"
docker buildx imagetools inspect "$reference" --raw > "$exact_raw"
actual="sha256:$(sha256sum "$exact_raw" | awk '{print $1}')"
if [ "$actual" != "$digest" ]; then
echo "ERROR: exact PR base bytes do not match the selected descriptor digest." >&2
exit 1
fi
printf 'ref=%s\n' "$reference" >> "$GITHUB_OUTPUT"
printf '### %s PR base\n\n`%s`\n' "$DISPLAY_NAME" "$reference" \
>> "$GITHUB_STEP_SUMMARY"
- name: Validate PR managed-image build args
shell: bash
env:
BASE_REFERENCE: ${{ steps.candidate-base.outputs.ref || steps.candidate-base-local.outputs.ref || steps.base.outputs.ref }}
DOCKERFILE: ${{ matrix.dockerfile }}
run: |
set -euo pipefail
scripts/check-production-build-args.sh \
-f "$DOCKERFILE" \
--build-arg "BASE_IMAGE=${BASE_REFERENCE}" \
--build-arg "NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION=1" \
--build-arg "NEMOCLAW_MANAGED_IMAGE_RUNTIME_USER=root"
- name: Build PR managed image locally
if: matrix.agent != 'langchain-deepagents-code' || github.event.pull_request.head.repo.full_name == github.repository
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/amd64
load: true
push: false
tags: ${{ matrix.image }}:${{ github.event.pull_request.head.sha }}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ github.event.pull_request.head.sha }}
io.nvidia.nemoclaw.agent=${{ matrix.agent }}
io.nvidia.nemoclaw.managed-image.contract=1
io.nvidia.nemoclaw.managed-image.platform=linux/amd64
io.nvidia.nemoclaw.managed-image.startup-profile=1
io.nvidia.nemoclaw.managed-image.capabilities=1
io.nvidia.nemoclaw.managed-image.cohort=ghrun-${{ github.run_id }}-${{ github.run_attempt }}
build-args: |
BASE_IMAGE=${{ steps.candidate-base.outputs.ref || steps.candidate-base-local.outputs.ref || steps.base.outputs.ref }}
NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION=1
NEMOCLAW_MANAGED_IMAGE_RUNTIME_USER=root
cache-from: type=registry,ref=ghcr.io/nvidia/nemoclaw/${{ matrix.agent }}-sandbox:buildcache-linux-amd64
provenance: false
sbom: false
- name: Build fork PR managed image locally from exact Deep Agents base
if: matrix.agent == 'langchain-deepagents-code' && github.event.pull_request.head.repo.full_name != github.repository
shell: bash
env:
AGENT: ${{ matrix.agent }}
BASE_REFERENCE: ${{ steps.candidate-base-local.outputs.ref }}
COHORT: ghrun-${{ github.run_id }}-${{ github.run_attempt }}
DOCKERFILE: ${{ matrix.dockerfile }}
IMAGE_REFERENCE: ${{ matrix.image }}:${{ github.event.pull_request.head.sha }}
REVISION: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
docker buildx build --builder default --load \
--platform linux/amd64 \
--file "$DOCKERFILE" \
--tag "$IMAGE_REFERENCE" \
--label "org.opencontainers.image.source=https://github.com/${{ github.repository }}" \
--label "org.opencontainers.image.revision=$REVISION" \
--label "io.nvidia.nemoclaw.agent=$AGENT" \
--label "io.nvidia.nemoclaw.managed-image.contract=1" \
--label "io.nvidia.nemoclaw.managed-image.platform=linux/amd64" \
--label "io.nvidia.nemoclaw.managed-image.startup-profile=1" \
--label "io.nvidia.nemoclaw.managed-image.capabilities=1" \
--label "io.nvidia.nemoclaw.managed-image.cohort=$COHORT" \
--build-arg "BASE_IMAGE=$BASE_REFERENCE" \
--build-arg "NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION=1" \
--build-arg "NEMOCLAW_MANAGED_IMAGE_RUNTIME_USER=root" \
.
- name: Validate exact PR managed image contract
id: contract
shell: bash
env:
AGENT: ${{ matrix.agent }}
IMAGE_REFERENCE: ${{ matrix.image }}:${{ github.event.pull_request.head.sha }}
PLATFORM: linux/amd64
PUBLICATION_COHORT: ghrun-${{ github.run_id }}-${{ github.run_attempt }}
run: |
set -euo pipefail
image_json="$(docker image inspect "$IMAGE_REFERENCE")"
image_id="$(
jq -er '
if length == 1 and (.[0].Id | type) == "string"
then .[0].Id
else error("expected one local image identity")
end
' <<< "$image_json"
)"
if [[ ! "$image_id" =~ ^sha256:[0-9a-f]{64}$ ]]; then
echo "ERROR: PR managed image did not resolve to an immutable local image ID: $image_id" >&2
exit 1
fi
if [ "$(docker image inspect --format '{{.Id}}' "$image_id")" != "$image_id" ]; then
echo "ERROR: PR managed image ID did not resolve to itself." >&2
exit 1
fi
if [[ ! "$PUBLICATION_COHORT" =~ ^ghrun-[1-9][0-9]{0,19}-[1-9][0-9]{0,9}$ ]] ||
! jq -e \
--arg agent "$AGENT" \
--arg cohort "$PUBLICATION_COHORT" \
--arg image_id "$image_id" \
--arg platform "$PLATFORM" \
--arg revision "$CANDIDATE_SHA" '
length == 1 and
.[0].Id == $image_id and
((.[0].Config.User // "") as $user |
$user == "" or $user == "root" or $user == "0") and
.[0].Config.Labels["io.nvidia.nemoclaw.agent"] == $agent and
.[0].Config.Labels["io.nvidia.nemoclaw.managed-image.contract"] == "1" and
.[0].Config.Labels["io.nvidia.nemoclaw.managed-image.platform"] == $platform and
.[0].Config.Labels["io.nvidia.nemoclaw.managed-image.startup-profile"] == "1" and
.[0].Config.Labels["io.nvidia.nemoclaw.managed-image.capabilities"] == "1" and
.[0].Config.Labels["io.nvidia.nemoclaw.managed-image.cohort"] == $cohort and
.[0].Config.Labels["org.opencontainers.image.revision"] == $revision
' <<< "$image_json" >/dev/null; then
echo "ERROR: PR managed image contract does not match the exact build identity." >&2
exit 1
fi
discovery_runtime="/usr/local/lib/nemoclaw/mcp-tool-discovery-runtime"
if ! actual_discovery_contract="$(
docker run --rm --platform "$PLATFORM" --entrypoint /bin/sh "$image_id" -c '
set -eu
discovery_runtime="$1"
if ! entry_owner_unsafe="$(
find -P "$discovery_runtime" ! -user root -print -quit
)"; then
echo "ERROR: final PR managed image discovery entry ownership inspection failed." >&2
exit 1
fi
if [ -n "$entry_owner_unsafe" ]; then
echo "ERROR: final PR managed image discovery entry is not root-owned: $entry_owner_unsafe" >&2
exit 1
fi
if ! owner_or_write_unsafe="$(
find -L "$discovery_runtime" \
\( ! -user root -o -perm /022 \) -print -quit
)"; then
echo "ERROR: final PR managed image discovery tree inspection failed." >&2
exit 1
fi
if [ -n "$owner_or_write_unsafe" ]; then
echo "ERROR: final PR managed image discovery tree is not root-owned and read-only: $owner_or_write_unsafe" >&2
exit 1
fi
if ! mode_unsafe="$(
find -P "$discovery_runtime" \
\( \( -type d ! -perm 0555 \) -o \( -type f ! -perm 0444 \) \) \
-print -quit
)"; then
echo "ERROR: final PR managed image discovery mode inspection failed." >&2
exit 1
fi
if [ -n "$mode_unsafe" ]; then
echo "ERROR: final PR managed image discovery path has an unexpected mode: $mode_unsafe" >&2
exit 1
fi
node "$discovery_runtime/mcp-tool-discovery.mjs"
' -- "$discovery_runtime"
)"; then
echo "ERROR: final PR managed image discovery contract probe failed." >&2
exit 1
fi
if ! node -e '
const expected = {
protocol: 1,
ok: false,
detail: "tool discovery received invalid runtime arguments",
};
let result;
try {
result = JSON.parse(require("node:fs").readFileSync(0, "utf8"));
} catch {
process.exit(1);
}
const record =
result !== null && typeof result === "object" && !Array.isArray(result)
? result
: undefined;
if (
!record ||
record.protocol !== expected.protocol ||
record.ok !== expected.ok ||
record.detail !== expected.detail
) {
process.exit(1);
}
' <<< "$actual_discovery_contract" >/dev/null; then
echo "ERROR: final PR managed image discovery bundle contract mismatch." >&2
exit 1
fi
printf 'reference=%s\n' "$image_id" >> "$GITHUB_OUTPUT"
printf '### %s exact PR managed image\n\n`%s`\n' "$AGENT" "$image_id" \
>> "$GITHUB_STEP_SUMMARY"
- name: Install managed-image direct harness dependencies
run: |
npm ci --ignore-scripts
npm run build:policy-boundary
- name: Exercise managed startup root stdin and hold
shell: bash
env:
AGENT: ${{ matrix.agent }}
IMAGE_REFERENCE: ${{ steps.contract.outputs.reference }}
run: |
set -euo pipefail
npx --no-install tsx \
scripts/checks/run-managed-image-direct-e2e.ts \
--agent "$AGENT" \
--image "$IMAGE_REFERENCE" \
--platform linux/amd64
# Publish by digest only. No candidate tag, cohort tag, or release alias is
# created, so this proof cannot expose an incomplete all-agent cohort.
- name: Publish exact same-repository PR managed image by digest
id: publish
if: github.event.pull_request.head.repo.full_name == github.repository
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/amd64
outputs: type=image,name=${{ matrix.repository }},push-by-digest=true,name-canonical=true,push=true
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ github.event.pull_request.head.sha }}
io.nvidia.nemoclaw.agent=${{ matrix.agent }}
io.nvidia.nemoclaw.managed-image.contract=1
io.nvidia.nemoclaw.managed-image.platform=linux/amd64
io.nvidia.nemoclaw.managed-image.startup-profile=1
io.nvidia.nemoclaw.managed-image.capabilities=1
io.nvidia.nemoclaw.managed-image.cohort=ghrun-${{ github.run_id }}-${{ github.run_attempt }}
build-args: |
BASE_IMAGE=${{ steps.candidate-base.outputs.ref || steps.candidate-base-local.outputs.ref || steps.base.outputs.ref }}
NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION=1
NEMOCLAW_MANAGED_IMAGE_RUNTIME_USER=root
cache-from: type=registry,ref=ghcr.io/nvidia/nemoclaw/${{ matrix.agent }}-sandbox:buildcache-linux-amd64
provenance: false
sbom: false
- name: Remove PR publication credentials
if: always() && github.event.pull_request.head.repo.full_name == github.repository
shell: bash
run: docker logout ghcr.io
- name: Export exact published PR managed-image contract
if: github.event.pull_request.head.repo.full_name == github.repository
shell: bash
env:
AGENT: ${{ matrix.agent }}
COHORT: ghrun-${{ github.run_id }}-${{ github.run_attempt }}
DIGEST: ${{ steps.publish.outputs.digest }}
IMAGE: ${{ matrix.repository }}
run: |
set -euo pipefail
[[ "$CANDIDATE_SHA" =~ ^[a-f0-9]{40}$ ]] || {
echo "ERROR: exact PR head SHA is invalid" >&2
exit 1
}
[[ "$DIGEST" =~ ^sha256:[a-f0-9]{64}$ ]] || {
echo "ERROR: PR publication did not return an immutable digest" >&2
exit 1
}
reference="${IMAGE}@${DIGEST}"
raw="$RUNNER_TEMP/${AGENT}-published-manifest.raw"
docker buildx imagetools inspect "$reference" --raw > "$raw"
[[ "sha256:$(sha256sum "$raw" | awk '{print $1}')" == "$DIGEST" ]] || {
echo "ERROR: published PR manifest bytes do not match the build digest" >&2
exit 1
}
anonymous_config="$(mktemp -d "$RUNNER_TEMP/managed-pr-anonymous.XXXXXX")"
trap 'rm -rf -- "$anonymous_config"' EXIT
DOCKER_CONFIG="$anonymous_config" docker pull --platform linux/amd64 "$reference"
release="v$(node -p 'require("./package.json").version')"
contract_dir="$RUNNER_TEMP/managed-pr-contract"
mkdir -p "$contract_dir"
jq -n \
--arg agent "$AGENT" \
--arg cohort "$COHORT" \
--arg digest "$DIGEST" \
--arg image "$IMAGE" \
--arg reference "$reference" \
--arg release "$release" \
--arg revision "$CANDIDATE_SHA" \
'{
contractVersion: 1,
agent: $agent,
platform: "linux/amd64",
image: $image,
digest: $digest,
reference: $reference,
source: {
repository: "NVIDIA/NemoClaw",
revision: $revision,
release: $release,
cohort: $cohort
},
startupProfileContractVersion: 1,
capabilityContractVersion: 1
}' > "$contract_dir/contract.json"
- name: Upload exact published PR managed-image contract
if: github.event.pull_request.head.repo.full_name == github.repository
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: managed-pr-contract-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.agent }}
path: ${{ runner.temp }}/managed-pr-contract/contract.json
if-no-files-found: error
retention-days: 1
pr-managed-activation:
name: PR exact all-agent managed runtime activation
needs: pr-build-and-entrypoint
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-24.04
timeout-minutes: 90
permissions:
contents: read
env:
CANDIDATE_SHA: ${{ github.event.pull_request.head.sha }}
E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-artifacts/live/managed-image-activation
E2E_JOB: "1"
E2E_TARGET_ID: managed-image-activation
NEMOCLAW_CLI_BIN: ${{ github.workspace }}/bin/nemoclaw.js
NEMOCLAW_MANAGED_ACTIVATION_CATALOG: ${{ github.workspace }}/managed-pr-catalog.json
NEMOCLAW_NON_INTERACTIVE: "1"
NEMOCLAW_RUN_LIVE_E2E: "1"
OPENSHELL_GATEWAY: nemoclaw
steps:
- name: Checkout exact PR head
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22.19.0
- name: Download exact published all-agent contracts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: managed-pr-contract-${{ github.run_id }}-${{ github.run_attempt }}-*
path: ${{ runner.temp }}/managed-pr-contracts
merge-multiple: false
- name: Assemble exact all-agent activation catalog
shell: bash
run: |
set -euo pipefail
mapfile -d '' contracts < <(
find "$RUNNER_TEMP/managed-pr-contracts" -type f -name contract.json -print0
)
[[ "${#contracts[@]}" -eq 3 ]] || {
echo "ERROR: exact all-agent activation requires three contracts" >&2
exit 1
}
jq -se \
--arg revision "$CANDIDATE_SHA" '
if (
length == 3 and
([.[].agent] | sort) == ["hermes", "langchain-deepagents-code", "openclaw"] and
([.[].source.revision] | unique) == [$revision] and
([.[].source.cohort] | unique | length) == 1 and
([.[].platform] | unique) == ["linux/amd64"]
)
then map({key: .agent, value: .}) | from_entries
else error("published PR contracts do not form one exact all-agent cohort")
end
' "${contracts[@]}" > "$NEMOCLAW_MANAGED_ACTIVATION_CATALOG"
- name: Build exact candidate CLI
run: |
npm ci --ignore-scripts
npm run build:cli
- name: Install OpenShell CLI
shell: bash
run: env -u GITHUB_TOKEN bash scripts/install-openshell.sh
- name: Run real all-agent managed runtime activation
shell: bash
run: |
set -euo pipefail
[[ "$(git rev-parse --verify HEAD)" == "$CANDIDATE_SHA" ]] || {
echo "ERROR: managed activation checkout does not match the exact PR head" >&2
exit 1
}
export PATH="$HOME/.local/bin:$HOME/.npm-global/bin:$PATH"
export OPENSHELL_BIN="$(command -v openshell)"
"$OPENSHELL_BIN" --version
npx tsx tools/e2e/live-vitest-invocation.mts run \
--test-path test/e2e/live/managed-image-activation-e2e.test.ts
- name: Upload managed runtime activation evidence
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: managed-image-activation-${{ github.run_id }}-${{ github.run_attempt }}
path: e2e-artifacts/live/managed-image-activation/
if-no-files-found: error
retention-days: 1
build-and-validate:
name: Build and validate ${{ matrix.display_name }} managed image (${{ matrix.arch }})
if: github.event_name != 'pull_request'
runs-on: ${{ matrix.runner }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
include:
- agent: openclaw
arch: amd64
display_name: OpenClaw
dockerfile: Dockerfile
base_image: nvidia/nemoclaw/sandbox-base
image: nvidia/nemoclaw/openclaw-sandbox
platform: linux/amd64
artifact_platform: linux-amd64
required_binary: /usr/local/bin/openclaw
runner: ubuntu-24.04
- agent: openclaw
arch: arm64
display_name: OpenClaw
dockerfile: Dockerfile
base_image: nvidia/nemoclaw/sandbox-base
image: nvidia/nemoclaw/openclaw-sandbox
platform: linux/arm64
artifact_platform: linux-arm64
required_binary: /usr/local/bin/openclaw
runner: ubuntu-24.04-arm
- agent: hermes
arch: amd64
display_name: Hermes
dockerfile: agents/hermes/Dockerfile
base_image: nvidia/nemoclaw/hermes-sandbox-base
image: nvidia/nemoclaw/hermes-sandbox
platform: linux/amd64
artifact_platform: linux-amd64
required_binary: /usr/local/bin/hermes
runner: ubuntu-24.04
- agent: hermes
arch: arm64
display_name: Hermes
dockerfile: agents/hermes/Dockerfile
base_image: nvidia/nemoclaw/hermes-sandbox-base
image: nvidia/nemoclaw/hermes-sandbox
platform: linux/arm64
artifact_platform: linux-arm64
required_binary: /usr/local/bin/hermes
runner: ubuntu-24.04-arm
- agent: langchain-deepagents-code
arch: amd64
display_name: Deep Agents Code
dockerfile: agents/langchain-deepagents-code/Dockerfile
base_image: nvidia/nemoclaw/langchain-deepagents-code-sandbox-base
image: nvidia/nemoclaw/langchain-deepagents-code-sandbox
platform: linux/amd64
artifact_platform: linux-amd64
required_binary: /usr/local/bin/dcode
runner: ubuntu-24.04
- agent: langchain-deepagents-code
arch: arm64
display_name: Deep Agents Code
dockerfile: agents/langchain-deepagents-code/Dockerfile
base_image: nvidia/nemoclaw/langchain-deepagents-code-sandbox-base
image: nvidia/nemoclaw/langchain-deepagents-code-sandbox
platform: linux/arm64
artifact_platform: linux-arm64
required_binary: /usr/local/bin/dcode
runner: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- name: Download exact base image contract
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: managed-base-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.agent }}
path: ${{ runner.temp }}/managed-base-contract
- name: Validate exact base image contract
id: base
shell: bash
env:
AGENT: ${{ matrix.agent }}
BASE_IMAGE: ${{ env.REGISTRY }}/${{ matrix.base_image }}
CONTRACT: ${{ runner.temp }}/managed-base-contract/contract.json
PLATFORM: ${{ matrix.platform }}
run: |
set -euo pipefail
if [ ! -f "$CONTRACT" ] || [ -L "$CONTRACT" ]; then
echo "ERROR: exact base image contract is missing or is a symlink." >&2
exit 1
fi
if ! jq -e \
--arg agent "$AGENT" \
--arg image "$BASE_IMAGE" \
--arg platform "$PLATFORM" \