Skip to content

fix(sandbox): don't misreport attestation images as missing in local preflight - #580

Open
yzxcj797 wants to merge 1 commit into
yc-software:mainfrom
yzxcj797:fix/local-sandbox-attestation-inspect-577
Open

fix(sandbox): don't misreport attestation images as missing in local preflight#580
yzxcj797 wants to merge 1 commit into
yc-software:mainfrom
yzxcj797:fix/local-sandbox-attestation-inspect-577

Conversation

@yzxcj797

@yzxcj797 yzxcj797 commented Aug 18, 2026

Copy link
Copy Markdown

Summary

Fixes the preflight bug reported in part 2 of #577 (scoped to that; part 1 is a published-artifacts question for maintainers).

The bug

The local-sandbox preflight ran one probe:

docker image inspect -f '{{.Id}} {{if .Config.Labels}}{{index .Config.Labels "qm.sandbox-fingerprint"}}{{end}}' <image>

Images built by buildx with attestations — the Docker 29 default, and exactly what qm sandbox publish emits — inspect as an OCI index whose Config has no Labels key. The Go template then fails:

template parsing error: template: :1:20: executing "" at <.Config.Labels>:
map has no entry for key "Labels"

That exits non-zero, so preflight rejected a present, usable image as local sandbox image <image> not found — run npm run sandbox:local:build — a wrong error that points at rebuilding (the reporter rebuilt twice before checking the exit path itself).

Fix

Split the probe in two:

  1. docker image inspect -f '{{.Id}}' <image> decides existence — valid for index and manifest images alike.
  2. The fingerprint template becomes a second, tolerated probe: a non-zero exit means "no fingerprint", which skips the stale-image comparison instead of failing the run.

Fingerprint-labeled images behave exactly as before, including the stale warning.

Tests

  • test/support/fake-docker.ts gains the exact attestation behavior: {{.Id}} inspects fine, the labels template fails with the real map has no entry for key "Labels" error.
  • New regression test in test/local-sandbox.test.ts asserts provision no longer rejects with the not-found signature. Verified locally: fails on main with precisely that misreport ("image was misreported as missing"), passes with the fix.

Note: 12 pre-existing tests in this file already fail on Windows checkouts (they exercise the real agent.mjs daemon's /exec, which needs a POSIX shell) — same count before and after this change; CI on Linux runs them green.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…preflight

The local-sandbox preflight ran docker image inspect with a combined
{{.Id}} {{if .Config.Labels}}...{{end}} template. Images built by buildx
with attestations -- the Docker 29 default, and what qm sandbox publish
emits -- inspect as an OCI index whose Config has no Labels key, so the
template errors and exits non-zero, and preflight rejected present,
usable images as 'not found -- run npm run sandbox:local:build' (yc-software#577).

Split the probe: {{.Id}} decides existence (valid for index and manifest
images alike), and the fingerprint template becomes a second, tolerated
probe -- its failure means no fingerprint, which skips the stale-image
comparison instead of failing the run.

The fake docker gains the exact attestation behavior, and the regression
test asserts provision no longer rejects with the not-found signature
(fails on main with precisely that misreport).
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