Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Docker: peel annotated tags to their commit when freezing refs (#16206)
Nilaybd4826d09d4e
diff --git a/.github/workflows/docker-publish-rocm.yml b/.github/workflows/docker-publish-rocm.ymlindex d1eb7d5fe63..45435869660 100644--- a/.github/workflows/docker-publish-rocm.yml+++ b/.github/workflows/docker-publish-rocm.yml@@ -91,11 +91,12 @@ jobs:SHA="$REF"else# ls-remote exits 0 even with no match, so non-zero means the remote was unreachable.- if ! LS_OUT="$(git ls-remote https://github.com/unslothai/unsloth "$REF")"; then+ # Prefer the peeled ^{} line: an annotated tag's own sha is not a commit.+ if ! LS_OUT="$(git ls-remote https://github.com/unslothai/unsloth "$REF" "${REF}^{}")"; thenecho "::error::unslothai/unsloth unreachable; cannot freeze ref '${REF}' to a sha"exit 1fi- SHA="$(printf '%s\n' "$LS_OUT" | awk 'NR==1{print $1}')"+ SHA="$(printf '%s\n' "$LS_OUT" | awk 'NR==1{s=$1; r=$2} $2==r"^{}"{s=$1} END{print s}')"[ -n "$SHA" ] || SHA="$REF"fiecho "ref=${SHA}" >> "$GITHUB_OUTPUT"@@ -126,11 +127,11 @@ jobs:if printf '%s' "$REF" | grep -Eq '^[0-9a-f]{40}$'; thenSHA="$REF"else- if ! LS_OUT="$(git ls-remote https://github.com/unslothai/unsloth-zoo "$REF")"; then+ if ! LS_OUT="$(git ls-remote https://github.com/unslothai/unsloth-zoo "$REF" "${REF}^{}")"; thenecho "::error::unslothai/unsloth-zoo unreachable; cannot freeze ref '${REF}' to a sha"exit 1fi- SHA="$(printf '%s\n' "$LS_OUT" | awk 'NR==1{print $1}')"+ SHA="$(printf '%s\n' "$LS_OUT" | awk 'NR==1{s=$1; r=$2} $2==r"^{}"{s=$1} END{print s}')"[ -n "$SHA" ] || SHA="$REF"fiecho "ref=${SHA}" >> "$GITHUB_OUTPUT"@@ -146,11 +147,11 @@ jobs:if printf '%s' "$REF" | grep -Eq '^[0-9a-f]{40}$'; thenSHA="$REF"else- if ! LS_OUT="$(git ls-remote https://github.com/unslothai/notebooks "$REF")"; then+ if ! LS_OUT="$(git ls-remote https://github.com/unslothai/notebooks "$REF" "${REF}^{}")"; thenecho "::error::unslothai/notebooks unreachable; cannot freeze ref '${REF}' to a sha"exit 1fi- SHA="$(printf '%s\n' "$LS_OUT" | awk 'NR==1{print $1}')"+ SHA="$(printf '%s\n' "$LS_OUT" | awk 'NR==1{s=$1; r=$2} $2==r"^{}"{s=$1} END{print s}')"[ -n "$SHA" ] || SHA="$REF"fiecho "commit=${SHA}" >> "$GITHUB_OUTPUT"diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.ymlindex dac0352d961..7f1bf52e14f 100644--- a/.github/workflows/docker-publish.yml+++ b/.github/workflows/docker-publish.yml@@ -113,11 +113,12 @@ jobs:SHA="$REF"else# ls-remote exits 0 even with no match, so non-zero means the remote was unreachable.- if ! LS_OUT="$(git ls-remote https://github.com/unslothai/unsloth "$REF")"; then+ # Prefer the peeled ^{} line: an annotated tag's own sha is not a commit.+ if ! LS_OUT="$(git ls-remote https://github.com/unslothai/unsloth "$REF" "${REF}^{}")"; thenecho "::error::unslothai/unsloth unreachable; cannot freeze ref '${REF}' to a sha"exit 1fi- SHA="$(printf '%s\n' "$LS_OUT" | awk 'NR==1{print $1}')"+ SHA="$(printf '%s\n' "$LS_OUT" | awk 'NR==1{s=$1; r=$2} $2==r"^{}"{s=$1} END{print s}')"[ -n "$SHA" ] || SHA="$REF"fiecho "ref=${SHA}" >> "$GITHUB_OUTPUT"@@ -144,11 +145,11 @@ jobs:if printf '%s' "$REF" | grep -Eq '^[0-9a-f]{40}$'; thenSHA="$REF"else- if ! LS_OUT="$(git ls-remote https://github.com/unslothai/unsloth-zoo "$REF")"; then+ if ! LS_OUT="$(git ls-remote https://github.com/unslothai/unsloth-zoo "$REF" "${REF}^{}")"; thenecho "::error::unslothai/unsloth-zoo unreachable; cannot freeze ref '${REF}' to a sha"exit 1fi- SHA="$(printf '%s\n' "$LS_OUT" | awk 'NR==1{print $1}')"+ SHA="$(printf '%s\n' "$LS_OUT" | awk 'NR==1{s=$1; r=$2} $2==r"^{}"{s=$1} END{print s}')"[ -n "$SHA" ] || SHA="$REF"fiecho "ref=${SHA}" >> "$GITHUB_OUTPUT"@@ -164,11 +165,11 @@ jobs:if printf '%s' "$REF" | grep -Eq '^[0-9a-f]{40}$'; thenSHA="$REF"else- if ! LS_OUT="$(git ls-remote https://github.com/unslothai/notebooks "$REF")"; then+ if ! LS_OUT="$(git ls-remote https://github.com/unslothai/notebooks "$REF" "${REF}^{}")"; thenecho "::error::unslothai/notebooks unreachable; cannot freeze ref '${REF}' to a sha"exit 1fi- SHA="$(printf '%s\n' "$LS_OUT" | awk 'NR==1{print $1}')"+ SHA="$(printf '%s\n' "$LS_OUT" | awk 'NR==1{s=$1; r=$2} $2==r"^{}"{s=$1} END{print s}')"[ -n "$SHA" ] || SHA="$REF"fiecho "commit=${SHA}" >> "$GITHUB_OUTPUT"diff --git a/.github/workflows/kaggle-t4-notebook-ci.yml b/.github/workflows/kaggle-t4-notebook-ci.ymlindex f7fe8e5837c..7cb7f7ad653 100644--- a/.github/workflows/kaggle-t4-notebook-ci.yml+++ b/.github/workflows/kaggle-t4-notebook-ci.yml@@ -166,7 +166,7 @@ jobs:elseRESOLVED=''for attempt in 1 2 3; do- LS="$(git ls-remote https://github.com/unslothai/unsloth "$UNSLOTH_REF" || true)"+ LS="$(git ls-remote https://github.com/unslothai/unsloth "$UNSLOTH_REF" "${UNSLOTH_REF}^{}" || true)"PEELED="$(printf '%s\n' "$LS" | grep '\^{}$' | head -n1 | cut -f1)"if [ -n "$PEELED" ]; thenRESOLVED="$PEELED"diff --git a/.github/workflows/kaggle-t4-studio-gpu-ci.yml b/.github/workflows/kaggle-t4-studio-gpu-ci.ymlindex 081041395ab..e9e733609fe 100644--- a/.github/workflows/kaggle-t4-studio-gpu-ci.yml+++ b/.github/workflows/kaggle-t4-studio-gpu-ci.yml@@ -157,7 +157,7 @@ jobs:elseRESOLVED=''for attempt in 1 2 3; do- LS="$(git ls-remote https://github.com/unslothai/unsloth "$UNSLOTH_REF" || true)"+ LS="$(git ls-remote https://github.com/unslothai/unsloth "$UNSLOTH_REF" "${UNSLOTH_REF}^{}" || true)"PEELED="$(printf '%s\n' "$LS" | grep '\^{}$' | head -n1 | cut -f1)"if [ -n "$PEELED" ]; thenRESOLVED="$PEELED"diff --git a/docker/build.sh b/docker/build.shindex be0bdfdbdf1..a59f2d2bdde 100755--- a/docker/build.sh+++ b/docker/build.sh@@ -62,12 +62,13 @@ resolve_git_ref() {printf '%s' "$ref" | grep -Eq '^[0-9a-f]{40}$' && { printf '%s' "$ref"; return 0; }command -v git >/dev/null 2>&1 || { printf '%s' "$ref"; return 0; }# ls-remote fails only when the remote is unreachable; warn and pass the name through.- if ! ls_out="$(git ls-remote "$repo" "$ref" 2>/dev/null)"; then+ # Also ask for ${ref}^{}: an annotated tag's own sha is not a commit, so uv refuses it.+ if ! ls_out="$(git ls-remote "$repo" "$ref" "${ref}^{}" 2>/dev/null)"; thenecho "warning: ${repo} unreachable; passing mutable ref '${ref}' (docker may reuse a cached layer)" >&2printf '%s' "$ref"return 0fi- sha="$(printf '%s\n' "$ls_out" | awk 'NR==1{print $1}')"+ sha="$(printf '%s\n' "$ls_out" | awk 'NR==1{s=$1; r=$2} $2==r"^{}"{s=$1} END{print s}')"[ -n "$sha" ] || sha="$ref" # not a branch/tag: a short sha or already-gone refprintf '%s' "$sha"}diff --git a/studio/install_python_stack.py b/studio/install_python_stack.pyindex 99fe163e7f2..fd566ceb586 100644--- a/studio/install_python_stack.py+++ b/studio/install_python_stack.py@@ -11739,7 +11739,8 @@ def _git_remote_commit(env.setdefault("GIT_ASKPASS", "echo")try:probe = subprocess.run(- [exe, "ls-remote", "--", url, revision],+ # A pattern-filtered ls-remote omits the peeled line unless it is asked for.+ [exe, "ls-remote", "--", url, revision, f"{revision}^{{}}"],capture_output = True,text = True,encoding = "utf-8",@@ -11758,8 +11759,8 @@ def _git_remote_commit(if ref and _COMMIT_REVISION_RE.fullmatch(sha):rows[ref] = sha.lower()for ref in (- f"refs/tags/{revision}^{{}}",f"refs/heads/{revision}",+ f"refs/tags/{revision}^{{}}",f"refs/tags/{revision}",revision,):diff --git a/tests/kaggle/test_t4_smoke_harness.py b/tests/kaggle/test_t4_smoke_harness.pyindex 378a70acbda..9d4f9d6a5db 100644--- a/tests/kaggle/test_t4_smoke_harness.py+++ b/tests/kaggle/test_t4_smoke_harness.py@@ -2235,8 +2235,12 @@ def test_the_resolve_step_pins_every_shape_of_ref_it_can_be_given(tmp_path):work = tmp_path / f"case{abs(hash((unsloth_ref, ls_remote)))}"stub = work / "bin"stub.mkdir(parents = True)- # Stub `git` returns LS_OUT and `sleep` returns at once.- (stub / "git").write_text("#!/bin/sh\nprintf '%s' \"$LS_OUT\"\n")+ # Stub `git` returns LS_OUT, `^{}` rows only when asked for as real git does; `sleep` returns at once.+ (stub / "git").write_text(+ "#!/bin/sh\n"+ 'for a in "$@"; do case "$a" in *"^{}") printf "%s" "$LS_OUT"; exit 0 ;; esac; done\n'+ 'printf "%s" "$LS_OUT" | grep -v "\\^{}$" || true\n'+ )name, out = _shared_setup_2(stub, work)env = dict(os.environ,diff --git a/tests/python/test_docker_build_ref_resolution.py b/tests/python/test_docker_build_ref_resolution.pyindex 03fea492d7b..7292a1ec512 100644--- a/tests/python/test_docker_build_ref_resolution.py+++ b/tests/python/test_docker_build_ref_resolution.py@@ -123,6 +123,23 @@ def test_an_explicit_tag_is_frozen_too(tmp_path):assert _build_arg(argv, "UNSLOTH_ZOO_REF") == ZOO_SHA+def test_an_annotated_tag_is_frozen_to_its_commit(tmp_path):+ """The tag object's own sha is not a commit; uv refuses it ("does not match precise commit")."""+ tag_object = "d" * 40+ _proc, argv = _run(+ tmp_path,+ 'if [ "$1" = "ls-remote" ]; then\n'+ f' echo -e "{tag_object}\\trefs/tags/v1"\n'+ ' for a in "$@"; do [ "$a" = "v1^{}" ] && echo -e "'+ + UNSLOTH_SHA+ + '\\trefs/tags/v1^{}"; done\n'+ "fi\nexit 0\n",+ {"UNSLOTH_REF": "v1", "UNSLOTH_ZOO_REF": "v1"},+ )+ assert _build_arg(argv, "UNSLOTH_REF") == UNSLOTH_SHA+ assert _build_arg(argv, "UNSLOTH_ZOO_REF") == UNSLOTH_SHA++def test_a_sha_is_passed_through_without_a_lookup(tmp_path):sha = "c" * 40_proc, argv = _run(diff --git a/tests/python/test_docker_publish_ref_freeze.py b/tests/python/test_docker_publish_ref_freeze.pyindex 99271ec0902..18dad4ba0a8 100644--- a/tests/python/test_docker_publish_ref_freeze.py+++ b/tests/python/test_docker_publish_ref_freeze.py@@ -39,6 +39,7 @@ def _shared_setup_1(bin_dir, manifest_digest_step, tmp_path):REPO_ROOT = Path(__file__).resolve().parents[2]WORKFLOW = REPO_ROOT / ".github" / "workflows" / "docker-publish.yml"+ROCM_WORKFLOW = REPO_ROOT / ".github" / "workflows" / "docker-publish-rocm.yml"RESOLVER_STEPS = ("unsloth_ref", "zoo_ref", "notebooks")@@ -48,19 +49,28 @@ pytestmark = pytest.mark.skipif()[email protected](scope = "module")-def steps() -> dict:- assert WORKFLOW.is_file(), f"missing {WORKFLOW}"- doc = yaml.safe_load(WORKFLOW.read_text(encoding = "utf-8"))+def _resolver_steps(workflow: Path) -> dict:+ assert workflow.is_file(), f"missing {workflow}"+ doc = yaml.safe_load(workflow.read_text(encoding = "utf-8"))found = {}for step in doc["jobs"]["prepare"]["steps"]:if step.get("id") in RESOLVER_STEPS:found[step["id"]] = step["run"]missing = set(RESOLVER_STEPS) - set(found)- assert not missing, f"resolver steps missing from the prepare job: {missing}"+ assert not missing, f"resolver steps missing from {workflow.name}'s prepare job: {missing}"return found[email protected](scope = "module")+def steps() -> dict:+ return _resolver_steps(WORKFLOW)++[email protected](scope = "module", params = [WORKFLOW, ROCM_WORKFLOW], ids = ["cuda", "rocm"])+def any_steps(request) -> dict:+ return _resolver_steps(request.param)++def test_the_workflow_never_pins_a_shell_so_bash_e_has_no_pipefail(steps: dict):# Without `shell: bash` there is no pipefail; these guards are the only protection.doc = yaml.safe_load(WORKFLOW.read_text(encoding = "utf-8"))@@ -215,6 +225,7 @@ def _run_with_failing_ls_remote(script: str, tmp_path: Path):ZOO_TAG = "v2026.9.1"ZOO_MAIN_SHA = "1" * 40ZOO_TAG_SHA = "2" * 40+ZOO_TAG_OBJECT_SHA = "3" * 40def _expand_tag_trigger(run: str) -> str:@@ -224,48 +235,100 @@ def _expand_tag_trigger(run: str) -> str:return re.sub(r"\$\{\{[^}]*\}\}", "", run)-def _run_zoo_step(script: str, tmp_path: Path, *, probe_exit: int):- bin_dir = tmp_path / "bin"- bin_dir.mkdir(parents = True, exist_ok = True)+def _tag_refs(tag: str, commit: str, tag_object: str | None) -> dict:+ # An annotated tag advertises its own object plus a peeled `^{}` entry for the commit.+ if tag_object is None:+ return {f"refs/tags/{tag}": commit}+ return {f"refs/tags/{tag}": tag_object, f"refs/tags/{tag}^{{}}": commit}+++def _write_fake_git(bin_dir: Path, refs: dict, probe_exit: int) -> None:+ # Like real ls-remote, a pattern matches a ref equal to it or ending in "/<pattern>".+ table = bin_dir / "remote_refs.tsv"+ table.write_text("".join(f"{sha}\t{ref}\n" for ref, sha in refs.items()), encoding = "utf-8")stub = bin_dir / "git"stub.write_text("#!/usr/bin/env bash\n"+ '[ "$1" = "ls-remote" ] || exit 0\n'+ "shift\n"+ "pats=()\n"'for a in "$@"; do\n'- ' if [ "$a" = "--exit-code" ]; then\n'+ ' case "$a" in\n'+ " --exit-code)\n"+ (- ' echo "fatal: unable to access: Could not resolve host" >&2\n'+ ' echo "fatal: unable to access: Could not resolve host" >&2\n'if probe_exit not in (0, 2)else "")- + f" exit {probe_exit}\n"- " fi\n"+ + f" exit {probe_exit} ;;\n"+ " -*|*://*) ;;\n"+ ' *) pats+=("$a") ;;\n'+ " esac\n""done\n"- 'if [ "${!#}" = "main" ]; then\n'- f' printf "%s\\trefs/heads/main\\n" "{ZOO_MAIN_SHA}"\n'- "else\n"- f' printf "%s\\trefs/tags/{ZOO_TAG}\\n" "{ZOO_TAG_SHA}"\n'- "fi\n"+ "while IFS=$'\\t' read -r sha ref; do\n"+ ' for p in "${pats[@]}"; do\n'+ ' if [ "$ref" = "$p" ] || [[ "$ref" == */"$p" ]]; then\n'+ ' printf "%s\\t%s\\n" "$sha" "$ref"\n'+ " break\n"+ " fi\n"+ " done\n"+ f'done < "{table}"\n'"exit 0\n",encoding = "utf-8",)stub.chmod(0o755)+++def _run_resolver(+ script: str,+ tmp_path: Path,+ refs: dict,+ *,+ env = None,+ probe_exit: int = 2,+):+ bin_dir = tmp_path / "bin"+ bin_dir.mkdir(parents = True, exist_ok = True)+ _write_fake_git(bin_dir, refs, probe_exit)out = tmp_path / "github_output"out.write_text("", encoding = "utf-8")- env = dict(os.environ)- env["PATH"] = f"{bin_dir}{os.pathsep}" + env["PATH"]- env["GITHUB_OUTPUT"] = str(out)- path = tmp_path / "zoo_step.sh"- path.write_text(_expand_tag_trigger(script), encoding = "utf-8")+ full_env = dict(os.environ)+ full_env["PATH"] = f"{bin_dir}{os.pathsep}" + full_env["PATH"]+ full_env["GITHUB_OUTPUT"] = str(out)+ for name in ("INPUT_REF", "TAG_REF", "PUSH_SHA", "IS_TAG", "TAG_NAME"):+ full_env[name] = ""+ full_env.update(env or {})+ path = tmp_path / "resolver_step.sh"+ path.write_text(script, encoding = "utf-8")res = subprocess.run(["bash", "-e", str(path)],capture_output = True,text = True,- env = env,+ env = full_env,timeout = 60,)return res, out.read_text(encoding = "utf-8")+def _run_zoo_step(+ script: str,+ tmp_path: Path,+ *,+ probe_exit: int,+ annotated: bool = False,+):+ refs = {"refs/heads/main": ZOO_MAIN_SHA}+ refs.update(_tag_refs(ZOO_TAG, ZOO_TAG_SHA, ZOO_TAG_OBJECT_SHA if annotated else None))+ # docker-publish.yml inlines the expressions; docker-publish-rocm.yml reads them from env.+ return _run_resolver(+ _expand_tag_trigger(script),+ tmp_path,+ refs,+ env = {"IS_TAG": "true", "TAG_NAME": ZOO_TAG},+ probe_exit = probe_exit,+ )++def test_an_unreachable_zoo_probe_fails_instead_of_taking_main(steps: dict, tmp_path: Path):res, emitted = _run_zoo_step(steps["zoo_ref"], tmp_path, probe_exit = 128)assert res.returncode != 0, (@@ -288,6 +351,69 @@ def test_a_present_zoo_tag_is_mirrored(steps: dict, tmp_path: Path):assert emitted.strip() == f"ref={ZOO_TAG_SHA}", emitted+# v0.1.911-beta and v0.1.912-beta were annotated: the steps froze the tag object's+# sha, uv refused it ("does not match precise commit"), and neither image shipped.++RELEASE_TAG = "v0.1.911-beta"+RELEASE_COMMIT = "4" * 40+RELEASE_TAG_OBJECT = "5" * 40+OTHER_MAIN_SHA = "6" * 40++_TAG_OBJECT_MSG = (+ "froze the annotated tag's own object sha, which is not a commit: "+ "`uv pip install pkg @ git+...@<that sha>` fails and the release never publishes"+)+++def _release_refs(annotated: bool) -> dict:+ refs = {"refs/heads/main": OTHER_MAIN_SHA}+ refs.update(_tag_refs(RELEASE_TAG, RELEASE_COMMIT, RELEASE_TAG_OBJECT if annotated else None))+ return refs++[email protected]("annotated", [True, False], ids = ["annotated", "lightweight"])+def test_a_pushed_release_tag_freezes_unsloth_to_its_commit(+ any_steps: dict, annotated: bool, tmp_path: Path+):+ res, emitted = _run_resolver(+ _expand(any_steps["unsloth_ref"]),+ tmp_path,+ _release_refs(annotated),+ env = {"TAG_REF": RELEASE_TAG},+ )+ assert res.returncode == 0, f"stdout={res.stdout}\nstderr={res.stderr}"+ assert emitted.strip() == f"ref={RELEASE_COMMIT}", f"{emitted.strip()!r}: {_TAG_OBJECT_MSG}"+++def test_an_annotated_zoo_tag_is_frozen_to_its_commit(any_steps: dict, tmp_path: Path):+ res, emitted = _run_zoo_step(any_steps["zoo_ref"], tmp_path, probe_exit = 0, annotated = True)+ assert res.returncode == 0, f"stdout={res.stdout}\nstderr={res.stderr}"+ assert emitted.strip() == f"ref={ZOO_TAG_SHA}", f"{emitted.strip()!r}: {_TAG_OBJECT_MSG}"+++def test_an_annotated_notebooks_ref_is_frozen_to_its_commit(any_steps: dict, tmp_path: Path):+ res, emitted = _run_resolver(+ _expand(any_steps["notebooks"]),+ tmp_path,+ _release_refs(annotated = True),+ env = {"INPUT_REF": RELEASE_TAG},+ )+ assert res.returncode == 0, f"stdout={res.stdout}\nstderr={res.stderr}"+ assert emitted.strip() == f"commit={RELEASE_COMMIT}", f"{emitted.strip()!r}: {_TAG_OBJECT_MSG}"++[email protected]("step_id", ["unsloth_ref", "notebooks"])+def test_a_branch_still_freezes_to_its_head(any_steps: dict, step_id: str, tmp_path: Path):+ res, emitted = _run_resolver(+ _expand(any_steps[step_id]),+ tmp_path,+ _release_refs(annotated = True),+ env = {"INPUT_REF": "main"},+ )+ assert res.returncode == 0, f"stdout={res.stdout}\nstderr={res.stderr}"+ assert emitted.strip().endswith(f"={OTHER_MAIN_SHA}"), emitted++# `.tags[0]` on main is the mutable `:core`, which another run can retag.OTHER_RUN_DIGEST = "sha256:" + "a" * 64diff --git a/tests/studio/install/test_dependency_pass_skips.py b/tests/studio/install/test_dependency_pass_skips.pyindex b617661d00f..64d50611ae7 100644--- a/tests/studio/install/test_dependency_pass_skips.py+++ b/tests/studio/install/test_dependency_pass_skips.py@@ -12,6 +12,7 @@ import osimport pathlibimport platformimport re+import shutilimport sysimport tempfileimport types@@ -594,7 +595,7 @@ def test_the_remote_commit_probe_reads_ls_remote_and_fails_closed(monkeypatch) -)argv, kwargs = calls[-1]assert argv[:3] == ["/usr/bin/git", "ls-remote", "--"]- assert argv[3:] == ["https://example.invalid/t.git", "release/3.6.x"]+ assert argv[3:] == ["https://example.invalid/t.git", "release/3.6.x", "release/3.6.x^{}"]assert kwargs["env"]["GIT_TERMINAL_PROMPT"] == "0"_fake_run.answer = _Done(@@ -620,6 +621,32 @@ def test_the_remote_commit_probe_reads_ls_remote_and_fails_closed(monkeypatch) -assert stack._git_remote_commit("https://example.invalid/t.git", "release/3.6.x") is None[email protected](shutil.which("git") is None, reason = "needs git")+def test_the_remote_commit_probe_peels_a_real_annotated_tag(tmp_path) -> None:+ """Real git omits the `^{}` row unless asked, so the tag object (not a commit) leaked through."""+ import subprocess as _sp++ env = dict(os.environ, GIT_AUTHOR_NAME = "t", GIT_AUTHOR_EMAIL = "t@t")+ env.update(GIT_COMMITTER_NAME = "t", GIT_COMMITTER_EMAIL = "t@t")++ def git(*args):+ argv = ["git", "-C", str(tmp_path), *args]+ return _sp.run(argv, check = True, capture_output = True, text = True, env = env).stdout.strip()++ git("init", "-q")+ git("commit", "-q", "--allow-empty", "-m", "c")+ git("tag", "-a", "v1", "-m", "annotated")+ commit = git("rev-parse", "HEAD")+ assert git("rev-parse", "v1") != commit+ assert stack._git_remote_commit(tmp_path.as_uri(), "v1") == commit+ branch = git("symbolic-ref", "--short", "HEAD")+ assert stack._git_remote_commit(tmp_path.as_uri(), branch) == commit+ # A same-named branch still wins over the tag, as pip and uv resolve it.+ git("commit", "-q", "--allow-empty", "-m", "d")+ git("branch", "v1")+ assert stack._git_remote_commit(tmp_path.as_uri(), "v1") == git("rev-parse", "HEAD")++@pytest.mark.parametrize("name", ["UV_CONSTRAINT", "PIP_CONSTRAINT", "PIP_NO_DEPS", "UV_NO_DEPS"])def test_a_caller_supplied_resolver_input_forces_a_full_pass(monkeypatch, manifest, name) -> None:"""Additive constraints change which versions a step installs, and PIP_NO_DEPS makes