Support immutable local SWE image IDs

This commit is contained in:
pj committed 2026-09-15 23:24:09 +05:30
1 parent 69c5793562
commit 1428c2b08e
9 files changed
+129 -43

No files matched your search

+7 -2
View File
@@ -90,7 +90,8 @@ def environment_validation_matches_plan(
if (
set(row) != {
"instance_id", "manifest_path", "manifest_sha256",
"validated_image", "validated_image_id", "validated_repo_digest"
"validated_image", "validated_image_id", "validated_image_ref",
"validated_repo_digest",
}
or not Path(row["manifest_path"]).as_posix().endswith(
"/" + Path(entry["path"]).as_posix()
@@ -98,7 +99,11 @@ def environment_validation_matches_plan(
or row["manifest_sha256"] != entry["sha256"]
or row["validated_image"] != validated["image"]
or row["validated_image_id"] != remote_image["id"]
or row["validated_repo_digest"] != remote_image["repo_digests"][0]
or row["validated_image_ref"] != remote_image["immutable_ref"]
or row["validated_repo_digest"] != (
remote_image["repo_digests"][0]
if remote_image["repo_digests"] else None
)
):
return False
except (KeyError, OSError, ValueError, json.JSONDecodeError):
+6 -5
View File
@@ -105,7 +105,6 @@ def recover_terminal_rows(out: Path) -> list[dict]:
def cleanup_matched_images(
out: Path, team: int, cohort: int, instance_ids: list[str], records: dict,
validated_images: dict[str, str] | None = None,
) -> None:
"""Remove only explicit, re-pullable tags after both matched arms terminate."""
path = out / "image-lifecycle.json"
@@ -117,7 +116,9 @@ def cleanup_matched_images(
record = {"team": team, "cohort": cohort, "images": []}
failed = False
for instance_id in instance_ids:
image = (validated_images or {}).get(instance_id) or swebench_spec(records[instance_id])[0]
# Remove the mutable local tag, not an immutable ID/digest that may still
# have another tag reference. Identity was already frozen before execution.
image = swebench_spec(records[instance_id])[0]
inspected = subprocess.run(
["docker", "image", "inspect", image, "--format", "{{json .}}"],
capture_output=True, text=True, env=os.environ,
@@ -247,7 +248,7 @@ def main(argv: list[str] | None = None) -> int:
team_plans = plan["team_plans"]
configs = out / "compose"
validated_images = {
row["instance_id"]: row["validated_repo_digest"]
row["instance_id"]: row["validated_image_ref"]
for row in (environment_validation or {}).get("validated_instances", [])
}
compose_by_assignment = {
@@ -366,7 +367,7 @@ def main(argv: list[str] | None = None) -> int:
if all((team, arm, instance_id) in terminal
for arm in CONDITIONS for instance_id in selected):
cleanup_matched_images(
out, team, cohort, selected, records, validated_images
out, team, cohort, selected, records
)
continue
tasks = []
@@ -460,7 +461,7 @@ def main(argv: list[str] | None = None) -> int:
)
if matched_complete:
cleanup_matched_images(
out, team, cohort, selected, records, validated_images
out, team, cohort, selected, records
)
status["status"] = "completed"
except BaseException as exc: