Skip to content

fix(images): resolve provenance-wrapped base manifests - #8257

Merged
apurvvkumaria merged 2 commits into
mainfrom
codex/fix-managed-base-provenance
Aug 4, 2026
Merged

fix(images): resolve provenance-wrapped base manifests#8257
apurvvkumaria merged 2 commits into
mainfrom
codex/fix-managed-base-provenance

Conversation

@apurvvkumaria

@apurvvkumaria apurvvkumaria commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Corrects base-image publication for provenance-bearing single-platform indexes. The workflow now validates runnable descriptors and provenance before it updates consumer tags.

Changes

  • Keep each provenance-bearing source index digest for multi-platform composition.
  • Resolve the runnable child manifest for platform validation and managed base-image contract export.
  • Compare the complete published descriptor set with both source indexes to reject stale workloads, missing provenance, and misbound attestations.
  • Stage the combined index under a run-scoped candidate tag. Publish consumer tags only from the validated immutable reference.
  • Add provenance-wrapper regression coverage and focused Vitest watch routing for the validator.

The shared validator is required by the OpenClaw, Hermes, and Deep Agents Code publishers. One implementation prevents the three publication paths from applying different provenance rules.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: This corrects an internal CI publication contract. CLI behavior, configuration, image references, and supported user workflows do not change.
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: Codex Desktop completed the nine-category security review. The review passed after consumer-tag promotion moved behind provenance validation.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: no-docs-needed
  • Evidence: No documentation paths changed. Existing managed base-image publication and changelog text remains accurate.
  • Agent: Codex Desktop

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit:
  • Station profile/scenario:
  • Result:
  • Supporting evidence:

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run validate:pr passed after refreshing origin/main when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: Five focused validator, base-contract, workflow, and watch-routing files passed 34/34 after rebase.
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result: Not applicable to this internal workflow correction. npm run checks:repository passed.
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Failure evidence: first affected base-image run and release-blocking base-image run.


Signed-off-by: Apurv Kumaria akumaria@nvidia.com

Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
@apurvvkumaria apurvvkumaria added area: security Security controls, permissions, secrets, or hardening bug-fix PR fixes a bug or regression v0.0.102 labels Aug 4, 2026
@apurvvkumaria apurvvkumaria self-assigned this Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a05a32d4-2739-4065-9c94-2310a5571d80

📥 Commits

Reviewing files that changed from the base of the PR and between 4100aed and f5e6b97.

📒 Files selected for processing (3)
  • test/dcode-base-image-workflow.test.ts
  • test/managed-image-publication-workflow.test.ts
  • test/validate-managed-base-index.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/dcode-base-image-workflow.test.ts

📝 Walkthrough

Walkthrough

The workflow stages multi-platform image candidates under run-specific tags, validates source provenance and managed indexes, exports verified platform digests, and promotes tags only when the published digest matches the validated candidate. Tests cover provenance failures, workflow ordering, and watch triggers.

Changes

Managed image publication

Layer / File(s) Summary
Source and managed-index provenance validation
scripts/checks/validate-managed-base-index.sh, test/validate-managed-base-index.test.ts
The validator resolves source indexes, checks workload and attestation descriptors, compares managed-index descriptors, emits platform digests, and tests stale or invalid provenance cases.
Candidate staging and digest-preserving promotion
.github/workflows/base-image.yaml
Hermes, Deep Agents Code, and OpenClaw stage and validate candidates before contract export, then promote tags and verify the published digest.
Publication-flow and watch-trigger coverage
test/dcode-base-image-workflow.test.ts, test/managed-image-publication-workflow.test.ts, test/helpers/vitest-watch-triggers.ts, test/vitest-watch-triggers.test.ts
Tests verify candidate arguments, validation ordering, metadata-based promotion, digest maps, and validator watch triggers.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant BaseImageWorkflow
  participant ContainerRegistry
  participant Validator
  participant ManagedImageContract
  BaseImageWorkflow->>ContainerRegistry: Create candidate manifest
  ContainerRegistry-->>BaseImageWorkflow: Return candidate digest
  BaseImageWorkflow->>Validator: Validate candidate and source indexes
  Validator-->>BaseImageWorkflow: Return verified platform digests
  BaseImageWorkflow->>ManagedImageContract: Export verified digests
  BaseImageWorkflow->>ContainerRegistry: Promote candidate to final tags
  ContainerRegistry-->>BaseImageWorkflow: Return published digest
  BaseImageWorkflow->>BaseImageWorkflow: Compare published and candidate digests
Loading

Possibly related PRs

Suggested labels: area: ci, area: packaging, platform: container

Suggested reviewers: jyaunches, cjagwani, cv

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: fixing base-image handling for provenance-wrapped manifests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-managed-base-provenance

Comment @coderabbitai help to get the list of available commands.

@github-code-quality

github-code-quality Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit f5e6b97 in the codex/fix-managed-ba... branch remains at 96%, unchanged from commit dd7db61 in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit f5e6b97 in the codex/fix-managed-ba... branch remains at 81%, unchanged from commit dd7db61 in the main branch.

Show a code coverage summary of the most impacted files.
File main dd7db61 codex/fix-managed-ba... f5e6b97 +/-
src/lib/credentials/store.ts 56% 55% -1%
src/lib/sandbox...rce-identity.ts 87% 87% 0%

Updated August 04, 2026 20:54 UTC

@senthilr-nv senthilr-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve reviewing PR #8257 at commit 4100aed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (5)
scripts/checks/validate-managed-base-index.sh (1)

134-137: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Derive the emitted platform map from platform_digests instead of repeating the architecture list.

The architecture inventory now appears three times in this file: line 30, line 110, and lines 135-136. A future third architecture requires three edits, and a missed edit is silent for the output map. Build the output from the associative array.

♻️ Proposed refactor
-jq -cn \
-  --arg amd64 "${platform_digests[amd64]}" \
-  --arg arm64 "${platform_digests[arm64]}" \
-  '{"linux/amd64": $amd64, "linux/arm64": $arm64}'
+platform_map='{}'
+for arch in "${!platform_digests[@]}"; do
+  platform_map="$(
+    jq -cn \
+      --argjson map "$platform_map" \
+      --arg platform "linux/$arch" \
+      --arg digest "${platform_digests[$arch]}" \
+      '$map + {($platform): $digest}'
+  )"
+done
+printf '%s\n' "$platform_map"

As per path instructions for scripts/checks/**: "Derive inventories and limits from a canonical source where possible; flag duplicated lists that can silently drift."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/checks/validate-managed-base-index.sh` around lines 134 - 137, Update
the JSON construction following the platform_digests population to derive the
emitted platform map directly from the associative array, rather than
hard-coding amd64 and arm64 in separate jq arguments. Preserve the existing
digest-to-platform mapping and ensure newly added platform entries are included
automatically.

Source: Path instructions

test/dcode-base-image-workflow.test.ts (1)

480-487: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

No workflow test covers the published-digest guard, which is the safety property this PR adds. Both suites assert that staging precedes validation and that validation precedes promotion, but neither asserts the comparison that rejects a published digest different from the validated candidate. Deleting that comparison from .github/workflows/base-image.yaml would keep both suites green.

  • test/dcode-base-image-workflow.test.ts#L480-L487: add expect(openClawManifestScript).toContain("published_digest=") and an assertion for the inequality guard, then repeat both inside the Hermes and Deep Agents Code loop at lines 606-630.
  • test/managed-image-publication-workflow.test.ts#L381-L386: add the same two assertions against manifestRun for every expected publisher.

As per path instructions for **/*.test.{ts,js,mts,mjs,cts,cjs}: "Flag copied production algorithms, broad mocks that bypass the behavior under test, and conditionals that make a test pass without exercising its claim."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/dcode-base-image-workflow.test.ts` around lines 480 - 487, The workflow
tests do not verify the published-digest mismatch guard. In
test/dcode-base-image-workflow.test.ts:480-487, add assertions that
openClawManifestScript contains published_digest= and the inequality comparison,
then add the same assertions inside the Hermes and Deep Agents Code loop at
lines 606-630. In test/managed-image-publication-workflow.test.ts:381-386, add
both assertions against manifestRun for every expected publisher.

Source: Path instructions

.github/workflows/base-image.yaml (2)

539-544: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

The staged candidate tag is never removed.

Line 539 creates a durable registry tag base-candidate-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}. Nothing deletes it after promotion. Every run and every retry adds one permanent tag per image, for three images. The GHCR package tag list grows without bound, and the candidate tags become an alternative pull surface that no consumer contract covers.

Add a cleanup step that deletes the candidate tag after the digest-preserving promotion check succeeds, and run it with if: always() so failed runs also clean up. The same gap exists in the Deep Agents Code and OpenClaw jobs; I will list all three sites in the consolidated comment.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/base-image.yaml around lines 539 - 544, The workflow must
delete the staged candidate tag after promotion verification, including when the
job fails. Add an `if: always()` cleanup step for the candidate created near
`candidate_tag`, and apply the same cleanup to the corresponding candidate-tag
flows in the Deep Agents Code and OpenClaw jobs, using the existing tag and
registry authentication context.

561-572: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

One staging, validation, and promotion sequence is copied into three publisher jobs. The three run bodies are identical except for the agent name in two error messages, so any change to the promotion contract needs three identical edits and three identical test-string updates.

  • .github/workflows/base-image.yaml#L561-L572: move the Hermes staging, validation, digest-extraction, and promotion sequence into a shared script such as scripts/publish-managed-base-index.sh, and call it with AGENT, IMAGE, and the tag list.
  • .github/workflows/base-image.yaml#L728-L739: call the same shared script from the Deep Agents Code job.
  • .github/workflows/base-image.yaml#L897-L908: call the same shared script from the OpenClaw job.

Do you want me to draft the shared script and the three call sites?

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/base-image.yaml around lines 561 - 572, Extract the
duplicated Hermes staging, validation, digest extraction, and promotion sequence
into a shared scripts/publish-managed-base-index.sh accepting AGENT, IMAGE, and
the tag list, then replace the inline logic at .github/workflows/base-image.yaml
lines 561-572, 728-739, and 897-908 with calls to that script; update each job’s
agent-specific error messages and test strings as needed.
test/validate-managed-base-index.test.ts (1)

120-198: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for the changed argument contract.

This PR changes the validator arguments to <index-reference> <linux-amd64-source-digest> <linux-arm64-source-digest> and adds the source-digest format check. No test exercises those branches. A caller that swaps or malforms an argument stays undetected by this suite. runValidator currently hardcodes the arguments, so the tests cannot reach the guards at lines 16-25 of scripts/checks/validate-managed-base-index.sh.

Let runValidator accept argument overrides, then assert the two rejection messages.

♻️ Proposed test additions
+  it("rejects a mutable managed base reference (`#7744`)", () => {
+    const mutable = runValidator({ reference: `${image}:latest` });
+
+    expect(mutable.status).not.toBe(0);
+    expect(mutable.stderr).toContain("managed base index reference must be immutable");
+  });
+
+  it("rejects a malformed platform source digest (`#7744`)", () => {
+    const malformed = runValidator({ amd64SourceDigestArgument: "sha256:not-a-digest" });
+
+    expect(malformed.status).not.toBe(0);
+    expect(malformed.stderr).toContain("managed base platform source digest is invalid");
+  });

As per path instructions for scripts/checks/**: "Require focused tests for both detection and false-positive behavior."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/validate-managed-base-index.test.ts` around lines 120 - 198, Extend the
runValidator test helper to accept index-reference and linux/amd64/linux/arm64
source-digest argument overrides instead of hardcoding them. Add focused tests
asserting malformed source-digest arguments trigger the validator’s
source-digest format rejection and swapped source-digest arguments trigger the
appropriate mismatch rejection, while preserving the existing valid invocation
coverage.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/base-image.yaml:
- Around line 539-544: The workflow must delete the staged candidate tag after
promotion verification, including when the job fails. Add an `if: always()`
cleanup step for the candidate created near `candidate_tag`, and apply the same
cleanup to the corresponding candidate-tag flows in the Deep Agents Code and
OpenClaw jobs, using the existing tag and registry authentication context.
- Around line 561-572: Extract the duplicated Hermes staging, validation, digest
extraction, and promotion sequence into a shared
scripts/publish-managed-base-index.sh accepting AGENT, IMAGE, and the tag list,
then replace the inline logic at .github/workflows/base-image.yaml lines
561-572, 728-739, and 897-908 with calls to that script; update each job’s
agent-specific error messages and test strings as needed.

In `@scripts/checks/validate-managed-base-index.sh`:
- Around line 134-137: Update the JSON construction following the
platform_digests population to derive the emitted platform map directly from the
associative array, rather than hard-coding amd64 and arm64 in separate jq
arguments. Preserve the existing digest-to-platform mapping and ensure newly
added platform entries are included automatically.

In `@test/dcode-base-image-workflow.test.ts`:
- Around line 480-487: The workflow tests do not verify the published-digest
mismatch guard. In test/dcode-base-image-workflow.test.ts:480-487, add
assertions that openClawManifestScript contains published_digest= and the
inequality comparison, then add the same assertions inside the Hermes and Deep
Agents Code loop at lines 606-630. In
test/managed-image-publication-workflow.test.ts:381-386, add both assertions
against manifestRun for every expected publisher.

In `@test/validate-managed-base-index.test.ts`:
- Around line 120-198: Extend the runValidator test helper to accept
index-reference and linux/amd64/linux/arm64 source-digest argument overrides
instead of hardcoding them. Add focused tests asserting malformed source-digest
arguments trigger the validator’s source-digest format rejection and swapped
source-digest arguments trigger the appropriate mismatch rejection, while
preserving the existing valid invocation coverage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 9a3f2714-9165-46b6-9e1d-7732a1af6986

📥 Commits

Reviewing files that changed from the base of the PR and between dd7db61 and 4100aed.

📒 Files selected for processing (7)
  • .github/workflows/base-image.yaml
  • scripts/checks/validate-managed-base-index.sh
  • test/dcode-base-image-workflow.test.ts
  • test/helpers/vitest-watch-triggers.ts
  • test/managed-image-publication-workflow.test.ts
  • test/validate-managed-base-index.test.ts
  • test/vitest-watch-triggers.test.ts

Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings reported

Advisor assessment: No blocking advisor findings reported
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions

Model lanes

  • GPT-5.6 Terra (primary): Completed · medium confidence · 0 blockers · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Failed after a partial review · low confidence · 0 blockers · 0 warnings · 0 suggestions

Second-opinion terminology and E2E selections are advisory. They do not change the primary assessment or E2E / PR Gate.

2 semantic terminology decisions

Terminology decisions are advisory. They affect the assessment only when a separate finding identifies concrete semantic impact.

  • justified — provenance-wrapped at test/validate-managed-base-index.test.ts:132: Keep the modifier. The test and validator contract establish its required contrast.
  • define — runnable descriptor at test/validate-managed-base-index.test.ts:132: Define this term at its first broader explanatory use as the Linux workload manifest, not the attestation descriptor.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: managed-image-multiarch-startup

1 optional E2E recommendation
  • managed-image-protected-runtime

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

@apurvvkumaria
apurvvkumaria enabled auto-merge (squash) August 4, 2026 20:41
@apurvvkumaria
apurvvkumaria disabled auto-merge August 4, 2026 20:53
@apurvvkumaria
apurvvkumaria merged commit 89c420c into main Aug 4, 2026
118 of 123 checks passed
@apurvvkumaria
apurvvkumaria deleted the codex/fix-managed-base-provenance branch August 4, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: security Security controls, permissions, secrets, or hardening bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants