docker: close five failure paths the review found
Notebook sync, in-place publish. entrypoint.sh runs sync_notebooks and then execs the container command, so the detached refresh child is still copying while JupyterLab serves the same tree. cp -a writes through the destination inode, so a reader can catch half-written JSON and a save made after the recorded-hash check is destroyed and then recorded as pristine. Publish through a same-dir dot-prefixed temp plus an atomic rename, and re-read the hash once the staging copy is complete (the earlier check sits before middle_unchanged, a python subprocess, so the window was most of the loop). A single-file bind mount cannot be renamed over, so that path falls back to the previous copy. Notebook sync, first boot. A pre-existing file whose bytes already match the baked template fell through to cp -a, which is --preserve=all: as root that stamps root:root, the baked mode and the build mtime onto a bind-mounted host file and locks its owner out of editing it. Record it as managed instead. The hash is identical, so the state file is byte-for-byte what the copy wrote. unsloth-studio-update. The post-update import check only warned, then the default restart replaced a process that was serving fine with one known not to import. supervisord retries startretries times, lands in FATAL and never leaves it on its own, so the container serves nothing until someone execs in. Keep the running service and exit non-zero with the remedy. unsloth-llama-update --check. resolve_latest swallows every failure into an empty string, which fell into the "up to date" branch and exited 0, so the command reported a state it could not observe. Report UNKNOWN and fail. unsloth-llama-update rollback. The in-place restore iterates the backup's entries, so a file the new release introduced survives it and the restored tree is mixed-version; ggml dlopens every libggml-*.so next to the binaries. Clear the install dir before restoring, gated on the drain having completed, because before that an entry there can still be the only copy of an old file. docker-publish ref freeze. git ls-remote exits 0 whether or not a ref matched, so a non-zero exit means the remote was never reached. That exit was lost twice over: first element of a pipeline, and a run step with no explicit shell runs under bash -e without pipefail. The step exited 0 and published ref=main, which the amd64, arm64 and Studio builds each resolve again, so one multi-arch tag could carry different revisions. Fail the prepare job instead, keeping the passthrough for the reachable-but-no-match case it was written for. Jupyter output select. lastPointerOutput was only replaced by another pointer-down, but J/K/arrow cell navigation fires none, so Ctrl/Cmd+A on a later cell selected the previously clicked output and suppressed notebook:select-all; after a re-run the node is detached and the chord did nothing at all. Revalidate the remembered output (still in the document, still in the active cell) before using it as the fallback. Tests: four static guards in test_docker_nb_sync_race.py, a new behavioural test_docker_update_helpers.py driving both helpers with stub pip, supervisorctl and mv, a new test_docker_publish_ref_freeze.py that executes each resolver step under bash -e with a failing ls-remote, and a source check in validate_studio_features.py. Each fails against the code before this change; the interrupted-drain case also fails against the unconditional form of the rollback fix.
This commit is contained in:
parent
a34b22390f
commit
837b09122e
9 changed files with 558 additions and 13 deletions
29
.github/workflows/docker-publish.yml
vendored
29
.github/workflows/docker-publish.yml
vendored
|
|
@ -105,7 +105,17 @@ jobs:
|
|||
if printf '%s' "$REF" | grep -Eq '^[0-9a-f]{40}$'; then
|
||||
SHA="$REF"
|
||||
else
|
||||
SHA="$(git ls-remote https://github.com/unslothai/unsloth "$REF" | awk 'NR==1{print $1}')"
|
||||
# ls-remote exits 0 whether or not a ref matched, so a non-zero exit
|
||||
# means we never reached the remote. The pipe into awk would hide it
|
||||
# (no pipefail under the default `bash -e` shell) and the fallback
|
||||
# below would then hand a MUTABLE name to the amd64, arm64 and Studio
|
||||
# builds, which each resolve it again -- the exact split this job
|
||||
# exists to prevent. Fail the run instead.
|
||||
if ! LS_OUT="$(git ls-remote https://github.com/unslothai/unsloth "$REF")"; then
|
||||
echo "::error::unslothai/unsloth unreachable; cannot freeze ref '${REF}' to a sha"
|
||||
exit 1
|
||||
fi
|
||||
SHA="$(printf '%s\n' "$LS_OUT" | awk 'NR==1{print $1}')"
|
||||
[ -n "$SHA" ] || SHA="$REF"
|
||||
fi
|
||||
echo "ref=${SHA}" >> "$GITHUB_OUTPUT"
|
||||
|
|
@ -129,7 +139,14 @@ jobs:
|
|||
if printf '%s' "$REF" | grep -Eq '^[0-9a-f]{40}$'; then
|
||||
SHA="$REF"
|
||||
else
|
||||
SHA="$(git ls-remote https://github.com/unslothai/unsloth-zoo "$REF" | awk 'NR==1{print $1}')"
|
||||
# Same rule as the unsloth ref above: a non-zero ls-remote is a
|
||||
# transport failure, not "no such ref", and forwarding the branch
|
||||
# name would let the three builds each pick a different commit.
|
||||
if ! LS_OUT="$(git ls-remote https://github.com/unslothai/unsloth-zoo "$REF")"; then
|
||||
echo "::error::unslothai/unsloth-zoo unreachable; cannot freeze ref '${REF}' to a sha"
|
||||
exit 1
|
||||
fi
|
||||
SHA="$(printf '%s\n' "$LS_OUT" | awk 'NR==1{print $1}')"
|
||||
[ -n "$SHA" ] || SHA="$REF"
|
||||
fi
|
||||
echo "ref=${SHA}" >> "$GITHUB_OUTPUT"
|
||||
|
|
@ -146,7 +163,13 @@ jobs:
|
|||
if printf '%s' "$REF" | grep -Eq '^[0-9a-f]{40}$'; then
|
||||
SHA="$REF"
|
||||
else
|
||||
SHA="$(git ls-remote https://github.com/unslothai/notebooks "$REF" | awk 'NR==1{print $1}')"
|
||||
# Same rule as the two refs above: only a reachable remote with no
|
||||
# matching ref may fall through to the literal "$REF".
|
||||
if ! LS_OUT="$(git ls-remote https://github.com/unslothai/notebooks "$REF")"; then
|
||||
echo "::error::unslothai/notebooks unreachable; cannot freeze ref '${REF}' to a sha"
|
||||
exit 1
|
||||
fi
|
||||
SHA="$(printf '%s\n' "$LS_OUT" | awk 'NR==1{print $1}')"
|
||||
[ -n "$SHA" ] || SHA="$REF"
|
||||
fi
|
||||
echo "commit=${SHA}" >> "$GITHUB_OUTPUT"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue