Files
LocalAI/.github/workflows/gallery-denormalize.yaml
Ettore Di Giacinto 98a0e3d7fa fix(ci): keep the gallery denormalize diff reviewable and self-healing
The nightly denormalization job edits YAML nodes instead of round-tripping
structs so its PR stays small enough for a human to review, but the write
path undid that: yaml.Marshal re-encoded the node tree at yaml.v3's default
4-space indent and dropped the leading document marker, reflowing roughly
6000 lines around the handful of real changes. Encode through
yaml.NewEncoder at the index's authored 2-space indent and restore the
header. A write that changes three fields now changes three lines.

Stale inferred_min_vram values were also never cleared. Both skip paths
(an authored min_vram is present, or the candidate is the last resort)
returned before touching the field, so a candidate that gained a floor or
became the last resort after a reorder kept an inferred value that
EffectiveMinVRAM reported as a real constraint, failing the meta lint with
no way for the job to self-heal. Clear the field before both skips.

The workflow discarded a whole night's work on any single failure: the
program exits 1 when a candidate cannot be estimated, which aborted the job
before the PR step, so one unreachable candidate blocked every other
refresh indefinitely. Capture the status, open the PR with what was
computed, mark the PR body as partial, and fail the run afterwards so the
problem still surfaces.

Also preserve the index's existing file mode instead of forcing 0644, and
drop the redundant //go:build ignore tag, since Go already skips dot
directories and the sibling modelslist.go carries no tag.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-07-18 11:31:18 +00:00

57 lines
2.4 KiB
YAML

name: Denormalize gallery meta entries
on:
schedule:
- cron: 0 22 * * *
workflow_dispatch:
jobs:
denormalize:
if: github.repository == 'mudler/LocalAI'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
# The program exits 1 when any candidate could not be estimated, but it
# still writes everything it did compute. Aborting here would let one
# unreachable candidate block the refresh of every other one, night after
# night, so record the status and let the PR open with the partial result.
- name: Denormalize meta candidates
id: denormalize
run: |
set +e
go run ./.github/ci/gallery_denormalize.go gallery/index.yaml
status=$?
set -e
echo "status=$status" >> "$GITHUB_OUTPUT"
if [ "$status" -ne 0 ]; then
echo "partial=yes" >> "$GITHUB_OUTPUT"
echo "note=**This run was partial.** At least one candidate could not be estimated, so some fields may be missing or stale. See the workflow log." >> "$GITHUB_OUTPUT"
else
echo "partial=no" >> "$GITHUB_OUTPUT"
echo "note=All candidates were processed successfully." >> "$GITHUB_OUTPUT"
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.UPDATE_BOT_TOKEN }}
push-to-fork: ci-forks/LocalAI
commit-message: ':arrow_up: Denormalize meta model candidates'
title: 'chore(model-gallery): :arrow_up: refresh meta candidate metadata'
branch: "update/gallery-denormalize"
body: |
Refreshes the denormalized `backend`, `quantization` and
`inferred_min_vram` fields on meta model entries.
Authored `min_vram` values are never modified.
${{ steps.denormalize.outputs.note }}
signoff: true
# Surface the failure only after the PR exists, so the problem stays
# visible without discarding the work that did succeed.
- name: Report estimation failures
if: steps.denormalize.outputs.partial == 'yes'
run: |
echo "gallery_denormalize exited ${{ steps.denormalize.outputs.status }}: one or more candidates need a hand-authored min_vram."
exit 1