Skip to content

feat(pack): add base digest pinning for adapters (best-effort)#1126

Open
rishi-jat wants to merge 4 commits intokitops-ml:mainfrom
rishi-jat:feat/base-digest-pinning
Open

feat(pack): add base digest pinning for adapters (best-effort)#1126
rishi-jat wants to merge 4 commits intokitops-ml:mainfrom
rishi-jat:feat/base-digest-pinning

Conversation

@rishi-jat
Copy link
Copy Markdown
Contributor

Description

Adds base digest pinning for adapters during kit pack.

Resolves the base model reference to its OCI manifest digest and stores it in Model.BaseDigest.
Uses local-first resolution with remote fallback.

This is best-effort only — pack never fails if resolution is not possible.

Partially addresses #899

Signed-off-by: Rishi Jat <rishijat098@gmail.com>
@rishi-jat
Copy link
Copy Markdown
Contributor Author

/cc @gorkem
/cc @amisevsk

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds best-effort base digest pinning when packing adapter-style kits so the resulting Kitfile can record the immutable OCI manifest digest of the referenced base model.

Changes:

  • Persist a new model.baseDigest field on artifact.Model (Kitfile schema) to store the resolved base manifest digest.
  • During kit pack, attempt to resolve the base model reference to a manifest digest (local-first, remote fallback) and write it into Kitfile.Model.BaseDigest when available.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/cmd/pack/pack.go Adds base digest resolution during pack and a helper to resolve local-first with remote fallback.
pkg/artifact/kitfile.go Extends Kitfile Model schema with a baseDigest field.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@amisevsk amisevsk left a comment

Choose a reason for hiding this comment

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

See comments from copilot

Signed-off-by: Rishi Jat <rishijat098@gmail.com>
@rishi-jat rishi-jat requested a review from amisevsk March 20, 2026 15:20
@rishi-jat
Copy link
Copy Markdown
Contributor Author

See comments from copilot

Done, have a look.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds best-effort base manifest digest pinning when packing adapters, so the adapter Kitfile can record an immutable base identifier for later linkage/reproducibility.

Changes:

  • Add Model.BaseDigest to the Kitfile schema (baseDigest in YAML/JSON).
  • During kit pack, attempt to resolve model.path (base model ref) to an OCI manifest digest using local-first resolution with remote fallback.
  • Persist the resolved digest into kitfile.Model.BaseDigest when available.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
pkg/cmd/pack/pack.go Adds base digest resolution logic during packing and stores it into the Kitfile model metadata.
pkg/artifact/kitfile.go Extends Kitfile model schema with baseDigest field.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@gorkem gorkem left a comment

Choose a reason for hiding this comment

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

I think we should think a bit more about the logic that would not mislead the user silently

@rishi-jat
Copy link
Copy Markdown
Contributor Author

@gorkem Addressed all comments.

@rishi-jat rishi-jat requested a review from gorkem March 22, 2026 23:44
Copy link
Copy Markdown
Contributor

@amisevsk amisevsk left a comment

Choose a reason for hiding this comment

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

Not sure I see the benefit of this change. All it effectively does is add a warning log during pack time.

output.Logf(output.LogLevelWarn, "overriding user-specified baseDigest %s with resolved %s",
kitfile.Model.BaseDigest, baseDigest)
}
kitfile.Model.BaseDigest = baseDigest
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.

What's the point of being able to specify a base digest if it just gets overridden, pushing the digest mismatch into a single warning log line at build time.

Imagine running this build in a CI -- will you notice that the digest has changed? If not, what was the point in including it?

Comment on lines +150 to +159
// Expected cases: no base digest resolved locally (skip pinning, no remote fallback)
if errors.Is(err, util.ErrNoKitfile) || errors.Is(err, util.ErrNotAModelKit) {
return "", nil
}
if errors.Is(err, errdef.ErrNotFound) || errors.Is(err, errdef.ErrMissingReference) {
// Reference not found locally, try remote
} else {
// Unexpected local error (IO issues, corruption, etc.)
return "", fmt.Errorf("failed to resolve base digest locally: %w", err)
}
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.

The comment here contradicts the code that follows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants