Skip to content

fix(hf): verify empty-metadata kernels from exact Git - #355

Merged
Lutar, Stephen P. (stephenlutar2-hash) merged 1 commit into
mainfrom
agent/hf-finalizer-selfcheck-git-fallback-20260728
Jul 28, 2026
Merged

fix(hf): verify empty-metadata kernels from exact Git#355
Lutar, Stephen P. (stephenlutar2-hash) merged 1 commit into
mainfrom
agent/hf-finalizer-selfcheck-git-fallback-20260728

Conversation

@stephenlutar2-hash

Copy link
Copy Markdown
Member

Outcome

Repairs the still-failing real controller path after #354. Post-merge run 30379450034 disproved the first hypothesis: Kernel metadata revision resolution succeeded, but kernels.get_kernel(...) raised ValueError: min() iterable argument is empty during exact-revision selfcheck.

Root cause

The exception occurs after [validated] kernel-card-publish and before kernel-verify. The pinned kernels==0.16.0 package asks the Kernel metadata API to enumerate build variants even when the already verified Git repository contains a valid build/torch-cpu tree. The #354 fallback surrounded the earlier metadata-revision call, not this loader call.

Change

  • catch only the exact observed empty-build ValueError around kernels.get_kernel;
  • materialize only build/** from authenticated Kernel Hub Git;
  • require the fetched main revision to equal the already bound immutable 40-character revision;
  • pass the repository root to pinned kernels.get_local_kernel, whose local resolver checks repo/build;
  • run the same callable/selfcheck result validation and record the selected selfcheck transport;
  • preserve every unrelated metadata, load, dependency, revision-drift, and selfcheck error as fail-closed.

Validation

  • 11 finalizer tests passed locally, including the real finalize_kernel call path;
  • 2 focused Git transport tests passed locally;
  • Python compilation passed;
  • exact-revision binding, moved-main rejection, read-only materialization, repository-root loading, no metadata-API call in the fallback, and unrelated-error rejection are covered;
  • live public Kernel Git trees were observed at governed-inference-meter@dd133d351d5d77ff666ce16d452edfdfdc3f1a61 and szl-governed-norm@52ebdccd8d181e2b367387353ad87484e2d9d8b3, both with build/torch-cpu/** variants;
  • commit 2670c692009764b74b7522383f921069b3e9cc1e has a verified SSH signature and DCO trailer.

Boundaries

This does not mutate model, dataset receipt, Kernel build, visibility, hardware, secrets, rulesets, or workflow policy. It does not convert a failed selfcheck into success; it gives the exact existing build a second supported local loading path and still requires its actual selfcheck() to pass.

Reopens/follows #301.

Signed-off-by: Lutar, Stephen P. stephenlutar2@gmail.com

Catch the observed empty-build error at the selfcheck loader boundary. Materialize the exact revision read-only through authenticated Git and preserve fail-closed behavior for every other error.

Signed-off-by: Lutar, Stephen P. <stephenlutar2@gmail.com>
@stephenlutar2-hash
Lutar, Stephen P. (stephenlutar2-hash) marked this pull request as ready for review July 28, 2026 16:56
Merged via the queue into main with commit 03d619a Jul 28, 2026
24 of 25 checks passed
@stephenlutar2-hash
Lutar, Stephen P. (stephenlutar2-hash) deleted the agent/hf-finalizer-selfcheck-git-fallback-20260728 branch July 28, 2026 16:57

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2670c69200

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment on lines +246 to +249
self._git(
["checkout", "-q", "--detach", "FETCH_HEAD"],
cwd=repo,
env=env,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Materialize Git LFS build objects before loading

When a Kernel variant contains LFS-tracked artifacts such as a compiled .so, this checkout runs with _auth_environment(), which sets GIT_LFS_SKIP_SMUDGE=1, and the sparse tree also omits .gitattributes; consequently build/** contains LFS pointer text rather than the binary that get_local_kernel() must import, so the new fallback still fails for compiled builds. This is reproducible with a local LFS-backed Kernel repository, and git lfs smudge --help confirms that GIT_LFS_SKIP_SMUDGE disables smudging. Enable LFS materialization for this read-only checkout (including the relevant attributes or an explicit authenticated LFS fetch/checkout) before invoking the loader.

Useful? React with 👍 / 👎.

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.

1 participant