Avoid batch S3 deletes in builder
All checks were successful
build / build (push) Successful in 2s

This commit is contained in:
robert
2026-05-19 13:33:07 -03:00
parent f5bda1ab24
commit 27b0cabc55
2 changed files with 10 additions and 9 deletions

View File

@@ -764,16 +764,15 @@ def _safe_supporting_skill_path(path: str) -> str:
def _delete_workspace_objects(s3: Any, bucket: str, prefix: str) -> None:
# MinIO rejects boto3's batch DeleteObjects request in this environment
# when Content-MD5 is not present. Per-object deletes avoid that fragile
# API path and are fine for agent source workspaces.
paginator = s3.get_paginator("list_objects_v2")
batch: list[dict[str, str]] = []
for page in paginator.paginate(Bucket=bucket, Prefix=prefix):
for obj in page.get("Contents") or ():
batch.append({"Key": obj["Key"]})
if len(batch) >= 1000:
s3.delete_objects(Bucket=bucket, Delete={"Objects": batch})
batch = []
if batch:
s3.delete_objects(Bucket=bucket, Delete={"Objects": batch})
key = obj.get("Key")
if key:
s3.delete_object(Bucket=bucket, Key=key)
def _files_from_tarball(bundle: bytes) -> dict[str, bytes]: