AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
ci(platform): publish single-container images (#13994)
Nicholas Tindle5c980c2f743a
diff --git a/.github/scripts/detect_overlaps.py b/.github/scripts/detect_overlaps.pyindex 1f9f4be7cf..20b7bbc514 100644--- a/.github/scripts/detect_overlaps.py+++ b/.github/scripts/detect_overlaps.py@@ -20,55 +20,72 @@ from typing import Optional# MAIN ENTRY POINT# =============================================================================+def main():"""Main entry point for PR overlap detection."""import argparse-- parser = argparse.ArgumentParser(description="Detect PR overlaps and potential merge conflicts")++ parser = argparse.ArgumentParser(+ description="Detect PR overlaps and potential merge conflicts"+ )parser.add_argument("pr_number", type=int, help="PR number to check")- parser.add_argument("--base", default=None, help="Base branch (default: auto-detect from PR)")- parser.add_argument("--skip-merge-test", action="store_true", help="Skip actual merge conflict testing")- parser.add_argument("--discord-webhook", default=os.environ.get("DISCORD_WEBHOOK_URL"), help="Discord webhook URL for notifications")- parser.add_argument("--dry-run", action="store_true", help="Don't post comments, just print")-+ parser.add_argument(+ "--base", default=None, help="Base branch (default: auto-detect from PR)"+ )+ parser.add_argument(+ "--skip-merge-test",+ action="store_true",+ help="Skip actual merge conflict testing",+ )+ parser.add_argument(+ "--discord-webhook",+ default=os.environ.get("DISCORD_WEBHOOK_URL"),+ help="Discord webhook URL for notifications",+ )+ parser.add_argument(+ "--dry-run", action="store_true", help="Don't post comments, just print"+ )+args = parser.parse_args()-+owner, repo = get_repo_info()print(f"Checking PR #{args.pr_number} in {owner}/{repo}")-+# Get current PR infocurrent_pr = fetch_pr_details(args.pr_number)base_branch = args.base or current_pr.base_ref-+print(f"PR #{current_pr.number}: {current_pr.title}")print(f"Base branch: {base_branch}")print(f"Files changed: {len(current_pr.files)}")-+# Find overlapping PRsoverlaps, all_changes = find_overlapping_prs(owner, repo, base_branch, current_pr, args.pr_number, args.skip_merge_test)-+if not overlaps:print("No overlaps detected!")return-+# Generate and post report- comment = format_comment(overlaps, args.pr_number, current_pr.changed_ranges, all_changes)-+ comment = format_comment(+ overlaps, args.pr_number, current_pr.changed_ranges, all_changes+ )+if args.dry_run:- print("\n" + "="*60)+ print("\n" + "=" * 60)print("COMMENT PREVIEW:")- print("="*60)+ print("=" * 60)print(comment)else:if comment:post_or_update_comment(args.pr_number, comment)print("Posted comment to PR")-+if args.discord_webhook:send_discord_notification(args.discord_webhook, current_pr, overlaps)-+# Report results and exitreport_results(overlaps)@@ -77,11 +94,20 @@ def main():# HIGH-LEVEL WORKFLOW FUNCTIONS# =============================================================================+def fetch_pr_details(pr_number: int) -> "PullRequest":"""Fetch details for a specific PR including its diff."""- result = run_gh(["pr", "view", str(pr_number), "--json", "number,title,url,author,headRefName,baseRefName,files"])+ result = run_gh(+ [+ "pr",+ "view",+ str(pr_number),+ "--json",+ "number,title,url,author,headRefName,baseRefName,files",+ ]+ )data = json.loads(result.stdout)-+pr = PullRequest(number=data["number"],title=data["title"],@@ -90,13 +116,13 @@ def fetch_pr_details(pr_number: int) -> "PullRequest":head_ref=data["headRefName"],base_ref=data["baseRefName"],files=[f["path"] for f in data["files"]],- changed_ranges={}+ changed_ranges={},)-+# Get detailed diffdiff = get_pr_diff(pr_number)pr.changed_ranges = parse_diff_ranges(diff)-+return pr@@ -106,32 +132,37 @@ def find_overlapping_prs(base_branch: str,current_pr: "PullRequest",current_pr_number: int,- skip_merge_test: bool+ skip_merge_test: bool,) -> tuple[list["Overlap"], dict[int, dict[str, "ChangedFile"]]]:"""Find all PRs that overlap with the current PR."""# Query other open PRsall_prs = query_open_prs(owner, repo, base_branch)other_prs = [p for p in all_prs if p["number"] != current_pr_number]-+print(f"Found {len(other_prs)} other open PRs targeting {base_branch}")-+# Find file overlaps (excluding ignored files, filtering by age)candidates = find_file_overlap_candidates(current_pr.files, other_prs)-+print(f"Found {len(candidates)} PRs with file overlap (excluding ignored files)")-+if not candidates:return [], {}-+# First pass: analyze line overlaps (no merge testing yet)overlaps = []all_changes = {}prs_needing_merge_test = []-+for pr_data, shared_files in candidates:overlap, pr_changes = analyze_pr_overlap(- owner, repo, base_branch, current_pr, pr_data, shared_files,- skip_merge_test=True # Always skip in first pass+ owner,+ repo,+ base_branch,+ current_pr,+ pr_data,+ shared_files,+ skip_merge_test=True, # Always skip in first pass)if overlap:overlaps.append(overlap)@@ -139,11 +170,13 @@ def find_overlapping_prs(# Track PRs that need merge testingif overlap.line_overlaps and not skip_merge_test:prs_needing_merge_test.append(overlap)-+# Second pass: batch merge testing with shared cloneif prs_needing_merge_test:- run_batch_merge_tests(owner, repo, base_branch, current_pr, prs_needing_merge_test)-+ run_batch_merge_tests(+ owner, repo, base_branch, current_pr, prs_needing_merge_test+ )+return overlaps, all_changes@@ -152,63 +185,107 @@ def run_batch_merge_tests(repo: str,base_branch: str,current_pr: "PullRequest",- overlaps: list["Overlap"]+ overlaps: list["Overlap"],):"""Run merge tests for multiple PRs using a shared clone."""with tempfile.TemporaryDirectory() as tmpdir:# Clone onceif not clone_repo(owner, repo, base_branch, tmpdir):return-+configure_git(tmpdir)-+# Fetch current PR branch once- result = run_git(["fetch", "origin", f"pull/{current_pr.number}/head:pr-{current_pr.number}"], cwd=tmpdir, check=False)+ result = run_git(+ [+ "fetch",+ "origin",+ f"pull/{current_pr.number}/head:pr-{current_pr.number}",+ ],+ cwd=tmpdir,+ check=False,+ )if result.returncode != 0:- print(f"Warning: Could not fetch current PR #{current_pr.number}", file=sys.stderr)+ print(+ f"Warning: Could not fetch current PR #{current_pr.number}",+ file=sys.stderr,+ )return-+for overlap in overlaps:- other_pr = overlap.pr_b if overlap.pr_a.number == current_pr.number else overlap.pr_a+ other_pr = (+ overlap.pr_b+ if overlap.pr_a.number == current_pr.number+ else overlap.pr_a+ )print(f"Testing merge conflict with PR #{other_pr.number}...", flush=True)-+# Clean up any in-progress merge from previous iterationrun_git(["merge", "--abort"], cwd=tmpdir, check=False)-+# Reset to base branchrun_git(["checkout", base_branch], cwd=tmpdir, check=False)- run_git(["reset", "--hard", f"origin/{base_branch}"], cwd=tmpdir, check=False)+ run_git(+ ["reset", "--hard", f"origin/{base_branch}"], cwd=tmpdir, check=False+ )run_git(["clean", "-fdx"], cwd=tmpdir, check=False)-+# Fetch the other PR branch- result = run_git(["fetch", "origin", f"pull/{other_pr.number}/head:pr-{other_pr.number}"], cwd=tmpdir, check=False)+ result = run_git(+ [+ "fetch",+ "origin",+ f"pull/{other_pr.number}/head:pr-{other_pr.number}",+ ],+ cwd=tmpdir,+ check=False,+ )if result.returncode != 0:- print(f"Warning: Could not fetch PR #{other_pr.number}: {result.stderr.strip()}", file=sys.stderr)+ print(+ f"Warning: Could not fetch PR #{other_pr.number}: {result.stderr.strip()}",+ file=sys.stderr,+ )continue-+# Try merging current PR first- result = run_git(["merge", "--no-commit", "--no-ff", f"pr-{current_pr.number}"], cwd=tmpdir, check=False)+ result = run_git(+ ["merge", "--no-commit", "--no-ff", f"pr-{current_pr.number}"],+ cwd=tmpdir,+ check=False,+ )if result.returncode != 0:# Current PR conflicts with base- conflict_files, conflict_details = extract_conflict_info(tmpdir, result.stderr)+ conflict_files, conflict_details = extract_conflict_info(+ tmpdir, result.stderr+ )overlap.has_merge_conflict = Trueoverlap.conflict_files = conflict_filesoverlap.conflict_details = conflict_details- overlap.conflict_type = 'pr_a_conflicts_base'+ overlap.conflict_type = "pr_a_conflicts_base"run_git(["merge", "--abort"], cwd=tmpdir, check=False)continue-+# Commit and try merging other PR- run_git(["commit", "-m", f"Merge PR #{current_pr.number}"], cwd=tmpdir, check=False)-- result = run_git(["merge", "--no-commit", "--no-ff", f"pr-{other_pr.number}"], cwd=tmpdir, check=False)+ run_git(+ ["commit", "-m", f"Merge PR #{current_pr.number}"],+ cwd=tmpdir,+ check=False,+ )++ result = run_git(+ ["merge", "--no-commit", "--no-ff", f"pr-{other_pr.number}"],+ cwd=tmpdir,+ check=False,+ )if result.returncode != 0:# Conflict between PRs- conflict_files, conflict_details = extract_conflict_info(tmpdir, result.stderr)+ conflict_files, conflict_details = extract_conflict_info(+ tmpdir, result.stderr+ )overlap.has_merge_conflict = Trueoverlap.conflict_files = conflict_filesoverlap.conflict_details = conflict_details- overlap.conflict_type = 'conflict'+ overlap.conflict_type = "conflict"run_git(["merge", "--abort"], cwd=tmpdir, check=False)@@ -219,14 +296,14 @@ def analyze_pr_overlap(current_pr: "PullRequest",other_pr_data: dict,shared_files: list[str],- skip_merge_test: bool+ skip_merge_test: bool,) -> tuple[Optional["Overlap"], dict[str, "ChangedFile"]]:"""Analyze overlap between current PR and another PR."""# Filter out ignored filesnon_ignored_shared = [f for f in shared_files if not should_ignore_file(f)]if not non_ignored_shared:return None, {}-+other_pr = PullRequest(number=other_pr_data["number"],title=other_pr_data["title"],@@ -236,71 +313,67 @@ def analyze_pr_overlap(base_ref=other_pr_data["base_ref"],files=other_pr_data["files"],changed_ranges={},- updated_at=other_pr_data.get("updated_at")+ updated_at=other_pr_data.get("updated_at"),)-+# Get diff for other PRother_diff = get_pr_diff(other_pr.number)other_pr.changed_ranges = parse_diff_ranges(other_diff)-+# Check line overlapsline_overlaps = find_line_overlaps(- current_pr.changed_ranges,- other_pr.changed_ranges,- shared_files+ current_pr.changed_ranges, other_pr.changed_ranges, shared_files)-+overlap = Overlap(pr_a=current_pr,pr_b=other_pr,overlapping_files=non_ignored_shared,- line_overlaps=line_overlaps+ line_overlaps=line_overlaps,)-+# Test for actual merge conflicts if we have line overlapsif line_overlaps and not skip_merge_test:print(f"Testing merge conflict with PR #{other_pr.number}...", flush=True)- has_conflict, conflict_files, conflict_details, error_type = test_merge_conflict(- owner, repo, base_branch, current_pr, other_pr+ has_conflict, conflict_files, conflict_details, error_type = (+ test_merge_conflict(owner, repo, base_branch, current_pr, other_pr))overlap.has_merge_conflict = has_conflictoverlap.conflict_files = conflict_filesoverlap.conflict_details = conflict_detailsoverlap.conflict_type = error_type-+return overlap, other_pr.changed_rangesdef find_file_overlap_candidates(- current_files: list[str],- other_prs: list[dict],- max_age_days: int = 14+ current_files: list[str], other_prs: list[dict], max_age_days: int = 14) -> list[tuple[dict, list[str]]]:"""Find PRs that share files with the current PR."""from datetime import datetime, timezone, timedelta-+current_files_set = set(f for f in current_files if not should_ignore_file(f))candidates = []cutoff_date = datetime.now(timezone.utc) - timedelta(days=max_age_days)-+for pr_data in other_prs:# Filter out PRs older than max_age_daysupdated_at = pr_data.get("updated_at")if updated_at:try:- pr_date = datetime.fromisoformat(updated_at.replace('Z', '+00:00'))+ pr_date = datetime.fromisoformat(updated_at.replace("Z", "+00:00"))if pr_date < cutoff_date:continue # Skip old PRsexcept Exception as e:# If we can't parse date, include the PR (safe fallback)print(f"Warning: Could not parse date for PR: {e}", file=sys.stderr)-+other_files = set(f for f in pr_data["files"] if not should_ignore_file(f))shared = current_files_set & other_files-+if shared:candidates.append((pr_data, list(shared)))-+return candidates@@ -309,11 +382,11 @@ def report_results(overlaps: list["Overlap"]):conflicts = [o for o in overlaps if o.has_merge_conflict]if conflicts:print(f"\n⚠️ Found {len(conflicts)} merge conflict(s)")-+line_overlap_count = len([o for o in overlaps if o.line_overlaps])if line_overlap_count:print(f"\n⚠️ Found {line_overlap_count} PR(s) with line overlap")-+print("\n✅ Done")# Always exit 0 - this check is informational, not a merge blocker@@ -322,48 +395,59 @@ def report_results(overlaps: list["Overlap"]):# COMMENT FORMATTING# =============================================================================+def format_comment(overlaps: list["Overlap"],current_pr: int,changes_current: dict[str, "ChangedFile"],- all_changes: dict[int, dict[str, "ChangedFile"]]+ all_changes: dict[int, dict[str, "ChangedFile"]],) -> str:"""Format the overlap report as a PR comment."""if not overlaps:return ""-+lines = ["## 🔍 PR Overlap Detection"]lines.append("")- lines.append("This check compares your PR against all other open PRs targeting the same branch to detect potential merge conflicts early.")+ lines.append(+ "This check compares your PR against all other open PRs targeting the same branch to detect potential merge conflicts early."+ )lines.append("")-+# Check if current PR conflicts with base branchformat_base_conflicts(overlaps, lines)-+# Classify and sort overlaps- classified = classify_all_overlaps(overlaps, current_pr, changes_current, all_changes)-+ classified = classify_all_overlaps(+ overlaps, current_pr, changes_current, all_changes+ )+# Group by risk- conflicts = [(o, r) for o, r in classified if r == 'conflict']- medium_risk = [(o, r) for o, r in classified if r == 'medium']- low_risk = [(o, r) for o, r in classified if r == 'low']-+ conflicts = [(o, r) for o, r in classified if r == "conflict"]+ medium_risk = [(o, r) for o, r in classified if r == "medium"]+ low_risk = [(o, r) for o, r in classified if r == "low"]+# Format each sectionformat_conflicts_section(conflicts, current_pr, lines)- format_medium_risk_section(medium_risk, current_pr, changes_current, all_changes, lines)+ format_medium_risk_section(+ medium_risk, current_pr, changes_current, all_changes, lines+ )format_low_risk_section(low_risk, current_pr, lines)-+# Summarytotal = len(overlaps)- lines.append(f"\n**Summary:** {len(conflicts)} conflict(s), {len(medium_risk)} medium risk, {len(low_risk)} low risk (out of {total} PRs with file overlap)")- lines.append("\n---\n*Auto-generated on push. Ignores: `openapi.json`, lock files.*")-+ lines.append(+ f"\n**Summary:** {len(conflicts)} conflict(s), {len(medium_risk)} medium risk, {len(low_risk)} low risk (out of {total} PRs with file overlap)"+ )+ lines.append(+ "\n---\n*Auto-generated on push. Ignores: `openapi.json`, lock files.*"+ )+return "\n".join(lines)def format_base_conflicts(overlaps: list["Overlap"], lines: list[str]):"""Format base branch conflicts section."""- base_conflicts = [o for o in overlaps if o.conflict_type == 'pr_a_conflicts_base']+ base_conflicts = [o for o in overlaps if o.conflict_type == "pr_a_conflicts_base"]if base_conflicts:lines.append("### ⚠️ This PR has conflicts with the base branch\n")lines.append("Conflicts will need to be resolved before merging:\n")@@ -377,16 +461,20 @@ def format_base_conflicts(overlaps: list["Overlap"], lines: list[str]):def format_conflicts_section(conflicts: list[tuple], current_pr: int, lines: list[str]):"""Format the merge conflicts section."""- pr_conflicts = [(o, r) for o, r in conflicts if o.conflict_type != 'pr_a_conflicts_base']-+ pr_conflicts = [+ (o, r) for o, r in conflicts if o.conflict_type != "pr_a_conflicts_base"+ ]+if not pr_conflicts:return-+lines.append("### 🔴 Merge Conflicts Detected")lines.append("")- lines.append("The following PRs have been tested and **will have merge conflicts** if merged after this PR. Consider coordinating with the authors.")+ lines.append(+ "The following PRs have been tested and **will have merge conflicts** if merged after this PR. Consider coordinating with the authors."+ )lines.append("")-+for o, _ in pr_conflicts:other = o.pr_b if o.pr_a.number == current_pr else o.pr_aformat_pr_entry(other, lines)@@ -399,20 +487,20 @@ def format_medium_risk_section(current_pr: int,changes_current: dict,all_changes: dict,- lines: list[str]+ lines: list[str],):"""Format the medium risk section."""if not medium_risk:return-+lines.append("### 🟡 Medium Risk — Some Line Overlap\n")lines.append("These PRs have some overlapping changes:\n")-+for o, _ in medium_risk:other = o.pr_b if o.pr_a.number == current_pr else o.pr_aother_changes = all_changes.get(other.number, {})format_pr_entry(other, lines)-+# Note if rename is involvedfor file_path in o.overlapping_files:file_a = changes_current.get(file_path)@@ -420,10 +508,12 @@ def format_medium_risk_section(if (file_a and file_a.is_rename) or (file_b and file_b.is_rename):lines.append(f" - ⚠️ `{file_path}` is being renamed/moved")break-+if o.line_overlaps:for file_path, ranges in o.line_overlaps.items():- range_strs = [f"L{r[0]}-{r[1]}" if r[0] != r[1] else f"L{r[0]}" for r in ranges]+ range_strs = [+ f"L{r[0]}-{r[1]}" if r[0] != r[1] else f"L{r[0]}" for r in ranges+ ]lines.append(f" - `{file_path}`: {', '.join(range_strs)}")else:non_ignored = [f for f in o.overlapping_files if not should_ignore_file(f)]@@ -436,10 +526,12 @@ def format_low_risk_section(low_risk: list[tuple], current_pr: int, lines: list["""Format the low risk section."""if not low_risk:return-+lines.append("### 🟢 Low Risk — File Overlap Only\n")- lines.append("<details><summary>These PRs touch the same files but different sections (click to expand)</summary>\n")-+ lines.append(+ "<details><summary>These PRs touch the same files but different sections (click to expand)</summary>\n"+ )+for o, _ in low_risk:other = o.pr_b if o.pr_a.number == current_pr else o.pr_anon_ignored = [f for f in o.overlapping_files if not should_ignore_file(f)]@@ -447,12 +539,15 @@ def format_low_risk_section(low_risk: list[tuple], current_pr: int, lines: list[format_pr_entry(other, lines)if o.line_overlaps:for file_path, ranges in o.line_overlaps.items():- range_strs = [f"L{r[0]}-{r[1]}" if r[0] != r[1] else f"L{r[0]}" for r in ranges]+ range_strs = [+ f"L{r[0]}-{r[1]}" if r[0] != r[1] else f"L{r[0]}"+ for r in ranges+ ]lines.append(f" - `{file_path}`: {', '.join(range_strs)}")else:lines.append(f" - Shared files: `{'`, `'.join(non_ignored[:5])}`")lines.append("") # Add blank line between entries-+lines.append("</details>\n")@@ -472,7 +567,9 @@ def format_conflict_details(overlap: "Overlap", lines: list[str]):if common_prefix:lines.append(f" - 📁 `{common_prefix}`")for detail in overlap.conflict_details:- display_path = detail.path[len(common_prefix):] if common_prefix else detail.path+ display_path = (+ detail.path[len(common_prefix) :] if common_prefix else detail.path+ )size_str = format_conflict_size(detail)lines.append(f" - `{display_path}`{size_str}")elif overlap.conflict_files:@@ -480,7 +577,7 @@ def format_conflict_details(overlap: "Overlap", lines: list[str]):if common_prefix:lines.append(f" - 📁 `{common_prefix}`")for f in overlap.conflict_files:- display_path = f[len(common_prefix):] if common_prefix else f+ display_path = f[len(common_prefix) :] if common_prefix else flines.append(f" - `{display_path}`")@@ -488,14 +585,14 @@ def format_conflict_size(detail: "ConflictInfo") -> str:"""Format conflict size string for a file."""if detail.conflict_count > 0:return f" ({detail.conflict_count} conflict{'s' if detail.conflict_count > 1 else ''}, ~{detail.conflict_lines} lines)"- elif detail.conflict_type != 'content':+ elif detail.conflict_type != "content":type_labels = {- 'both_added': 'added in both',- 'both_deleted': 'deleted in both',- 'deleted_by_us': 'deleted here, modified there',- 'deleted_by_them': 'modified here, deleted there',- 'added_by_us': 'added here',- 'added_by_them': 'added there',+ "both_added": "added in both",+ "both_deleted": "deleted in both",+ "deleted_by_us": "deleted here, modified there",+ "deleted_by_them": "modified here, deleted there",+ "added_by_us": "added here",+ "added_by_them": "added there",}label = type_labels.get(detail.conflict_type, detail.conflict_type)return f" ({label})"@@ -509,7 +606,7 @@ def format_line_overlaps(line_overlaps: dict[str, list[tuple]], lines: list[str]if common_prefix:lines.append(f" - 📁 `{common_prefix}`")for file_path, ranges in line_overlaps.items():- display_path = file_path[len(common_prefix):] if common_prefix else file_path+ display_path = file_path[len(common_prefix) :] if common_prefix else file_pathrange_strs = [f"L{r[0]}-{r[1]}" if r[0] != r[1] else f"L{r[0]}" for r in ranges]indent = " " if common_prefix else " "lines.append(f"{indent}- `{display_path}`: {', '.join(range_strs)}")@@ -519,11 +616,9 @@ def format_line_overlaps(line_overlaps: dict[str, list[tuple]], lines: list[str]# OVERLAP ANALYSIS# =============================================================================+def classify_all_overlaps(- overlaps: list["Overlap"],- current_pr: int,- changes_current: dict,- all_changes: dict+ overlaps: list["Overlap"], current_pr: int, changes_current: dict, all_changes: dict) -> list[tuple["Overlap", str]]:"""Classify all overlaps by risk level and sort them."""classified = []@@ -532,94 +627,96 @@ def classify_all_overlaps(other_changes = all_changes.get(other_pr.number, {})risk = classify_overlap_risk(o, changes_current, other_changes)classified.append((o, risk))-+def sort_key(item):o, risk = item- risk_order = {'conflict': 0, 'medium': 1, 'low': 2}+ risk_order = {"conflict": 0, "medium": 1, "low": 2}# For conflicts, also sort by total conflict lines (descending)- conflict_lines = sum(d.conflict_lines for d in o.conflict_details) if o.conflict_details else 0+ conflict_lines = (+ sum(d.conflict_lines for d in o.conflict_details)+ if o.conflict_details+ else 0+ )return (risk_order.get(risk, 99), -conflict_lines)-+classified.sort(key=sort_key)-+return classifieddef classify_overlap_risk(overlap: "Overlap",changes_a: dict[str, "ChangedFile"],- changes_b: dict[str, "ChangedFile"]+ changes_b: dict[str, "ChangedFile"],) -> str:"""Classify the risk level of an overlap."""if overlap.has_merge_conflict:- return 'conflict'-+ return "conflict"+has_rename = any(- (changes_a.get(f) and changes_a[f].is_rename) or- (changes_b.get(f) and changes_b[f].is_rename)+ (changes_a.get(f) and changes_a[f].is_rename)+ or (changes_b.get(f) and changes_b[f].is_rename)for f in overlap.overlapping_files)-+if overlap.line_overlaps:total_overlap_lines = sum(end - start + 1for ranges in overlap.line_overlaps.values()for start, end in ranges)-+# Medium risk: >20 lines overlap or file renameif total_overlap_lines > 20 or has_rename:- return 'medium'+ return "medium"else:- return 'low'-+ return "low"+if has_rename:- return 'medium'-- return 'low'+ return "medium"++ return "low"def find_line_overlaps(changes_a: dict[str, "ChangedFile"],changes_b: dict[str, "ChangedFile"],- shared_files: list[str]+ shared_files: list[str],) -> dict[str, list[tuple[int, int]]]:"""Find overlapping line ranges in shared files."""overlaps = {}-+for file_path in shared_files:if should_ignore_file(file_path):continue-+file_a = changes_a.get(file_path)file_b = changes_b.get(file_path)-+if not file_a or not file_b:continue-+# Skip pure renamesif file_a.is_rename and not file_a.additions and not file_a.deletions:continueif file_b.is_rename and not file_b.additions and not file_b.deletions:continue-+# Note: This mixes old-file (deletions) and new-file (additions) line numbers,# which can cause false positives when PRs insert/remove many lines.# Acceptable for v1 since the real merge test is the authoritative check.file_overlaps = find_range_overlaps(- file_a.additions + file_a.deletions,- file_b.additions + file_b.deletions+ file_a.additions + file_a.deletions, file_b.additions + file_b.deletions)-+if file_overlaps:overlaps[file_path] = merge_ranges(file_overlaps)-+return overlapsdef find_range_overlaps(- ranges_a: list[tuple[int, int]],- ranges_b: list[tuple[int, int]]+ ranges_a: list[tuple[int, int]], ranges_b: list[tuple[int, int]]) -> list[tuple[int, int]]:"""Find overlapping regions between two sets of ranges."""overlaps = []@@ -641,17 +738,17 @@ def merge_ranges(ranges: list[tuple[int, int]]) -> list[tuple[int, int]]:"""Merge overlapping line ranges."""if not ranges:return []-+sorted_ranges = sorted(ranges, key=lambda x: x[0])merged = [sorted_ranges[0]]-+for current in sorted_ranges[1:]:last = merged[-1]if current[0] <= last[1] + 1:merged[-1] = (last[0], max(last[1], current[1]))else:merged.append(current)-+return merged@@ -659,36 +756,33 @@ def merge_ranges(ranges: list[tuple[int, int]]) -> list[tuple[int, int]]:# MERGE CONFLICT TESTING# =============================================================================+def test_merge_conflict(- owner: str,- repo: str,- base_branch: str,- pr_a: "PullRequest",- pr_b: "PullRequest"+ owner: str, repo: str, base_branch: str, pr_a: "PullRequest", pr_b: "PullRequest") -> tuple[bool, list[str], list["ConflictInfo"], str]:"""Test if merging both PRs would cause a conflict."""with tempfile.TemporaryDirectory() as tmpdir:# Clone repoif not clone_repo(owner, repo, base_branch, tmpdir):return False, [], [], None-+configure_git(tmpdir)if not fetch_pr_branches(tmpdir, pr_a.number, pr_b.number):# Fetch failed for one or both PRs - can't test mergereturn False, [], [], None-+# Try merging PR A firstconflict_result = try_merge_pr(tmpdir, pr_a.number)if conflict_result:- return True, conflict_result[0], conflict_result[1], 'pr_a_conflicts_base'-+ return True, conflict_result[0], conflict_result[1], "pr_a_conflicts_base"+# Commit and try merging PR Brun_git(["commit", "-m", f"Merge PR #{pr_a.number}"], cwd=tmpdir, check=False)-+conflict_result = try_merge_pr(tmpdir, pr_b.number)if conflict_result:- return True, conflict_result[0], conflict_result[1], 'conflict'-+ return True, conflict_result[0], conflict_result[1], "conflict"+return False, [], [], None@@ -696,8 +790,7 @@ def clone_repo(owner: str, repo: str, branch: str, tmpdir: str) -> bool:"""Clone the repository."""clone_url = f"https://github.com/{owner}/{repo}.git"result = run_git(- ["clone", "--depth=50", "--branch", branch, clone_url, tmpdir],- check=False+ ["clone", "--depth=50", "--branch", branch, clone_url, tmpdir], check=False)if result.returncode != 0:print(f"Failed to clone: {result.stderr}", file=sys.stderr)@@ -707,7 +800,11 @@ def clone_repo(owner: str, repo: str, branch: str, tmpdir: str) -> bool:def configure_git(tmpdir: str):"""Configure git for commits."""- run_git(["config", "user.email", "github-actions[bot]@users.noreply.github.com"], cwd=tmpdir, check=False)+ run_git(+ ["config", "user.email", "github-actions[bot]@users.noreply.github.com"],+ cwd=tmpdir,+ check=False,+ )run_git(["config", "user.name", "github-actions[bot]"], cwd=tmpdir, check=False)@@ -715,54 +812,67 @@ def fetch_pr_branches(tmpdir: str, pr_a: int, pr_b: int) -> bool:"""Fetch both PR branches. Returns False if any fetch fails."""success = Truefor pr_num in (pr_a, pr_b):- result = run_git(["fetch", "origin", f"pull/{pr_num}/head:pr-{pr_num}"], cwd=tmpdir, check=False)+ result = run_git(+ ["fetch", "origin", f"pull/{pr_num}/head:pr-{pr_num}"],+ cwd=tmpdir,+ check=False,+ )if result.returncode != 0:- print(f"Warning: Could not fetch PR #{pr_num}: {result.stderr.strip()}", file=sys.stderr)+ print(+ f"Warning: Could not fetch PR #{pr_num}: {result.stderr.strip()}",+ file=sys.stderr,+ )success = Falsereturn success-def try_merge_pr(tmpdir: str, pr_number: int) -> Optional[tuple[list[str], list["ConflictInfo"]]]:+def try_merge_pr(+ tmpdir: str, pr_number: int+) -> Optional[tuple[list[str], list["ConflictInfo"]]]:"""Try to merge a PR. Returns conflict info if conflicts, None if success."""- result = run_git(["merge", "--no-commit", "--no-ff", f"pr-{pr_number}"], cwd=tmpdir, check=False)-+ result = run_git(+ ["merge", "--no-commit", "--no-ff", f"pr-{pr_number}"], cwd=tmpdir, check=False+ )+if result.returncode == 0:return None-+# Conflict detectedconflict_files, conflict_details = extract_conflict_info(tmpdir, result.stderr)run_git(["merge", "--abort"], cwd=tmpdir, check=False)-+return conflict_files, conflict_details-def extract_conflict_info(tmpdir: str, stderr: str) -> tuple[list[str], list["ConflictInfo"]]:+def extract_conflict_info(+ tmpdir: str, stderr: str+) -> tuple[list[str], list["ConflictInfo"]]:"""Extract conflict information from git status."""status_result = run_git(["status", "--porcelain"], cwd=tmpdir, check=False)-+status_types = {- 'UU': 'content',- 'AA': 'both_added',- 'DD': 'both_deleted',- 'DU': 'deleted_by_us',- 'UD': 'deleted_by_them',- 'AU': 'added_by_us',- 'UA': 'added_by_them',+ "UU": "content",+ "AA": "both_added",+ "DD": "both_deleted",+ "DU": "deleted_by_us",+ "UD": "deleted_by_them",+ "AU": "added_by_us",+ "UA": "added_by_them",}-+conflict_files = []conflict_details = []-+for line in status_result.stdout.split("\n"):if len(line) >= 3 and line[0:2] in status_types:status_code = line[0:2]file_path = line[3:].strip()conflict_files.append(file_path)-+info = analyze_conflict_markers(file_path, tmpdir)- info.conflict_type = status_types.get(status_code, 'unknown')+ info.conflict_type = status_types.get(status_code, "unknown")conflict_details.append(info)-+# Fallback to stderr parsingif not conflict_files and stderr:for line in stderr.split("\n"):@@ -773,36 +883,39 @@ def extract_conflict_info(tmpdir: str, stderr: str) -> tuple[list[str], list["Coif file_part and not file_part.startswith("Merge"):conflict_files.append(file_part)conflict_details.append(ConflictInfo(path=file_part))-+return conflict_files, conflict_detailsdef analyze_conflict_markers(file_path: str, cwd: str) -> "ConflictInfo":"""Analyze a conflicted file to count conflict regions and lines."""info = ConflictInfo(path=file_path)-+try:full_path = os.path.join(cwd, file_path)- with open(full_path, 'r', errors='ignore') as f:+ with open(full_path, "r", errors="ignore") as f:content = f.read()-+in_conflict = Falsecurrent_conflict_lines = 0-- for line in content.split('\n'):- if line.startswith('<<<<<<<'):++ for line in content.split("\n"):+ if line.startswith("<<<<<<<"):in_conflict = Trueinfo.conflict_count += 1current_conflict_lines = 1- elif line.startswith('>>>>>>>'):+ elif line.startswith(">>>>>>>"):in_conflict = Falsecurrent_conflict_lines += 1info.conflict_lines += current_conflict_lineselif in_conflict:current_conflict_lines += 1except Exception as e:- print(f"Warning: Could not analyze conflict markers in {file_path}: {e}", file=sys.stderr)-+ print(+ f"Warning: Could not analyze conflict markers in {file_path}: {e}",+ file=sys.stderr,+ )+return info@@ -810,13 +923,14 @@ def analyze_conflict_markers(file_path: str, cwd: str) -> "ConflictInfo":# DIFF PARSING# =============================================================================+def parse_diff_ranges(diff: str) -> dict[str, "ChangedFile"]:"""Parse a unified diff and extract changed line ranges per file."""files = {}current_file = Nonepending_rename_from = Noneis_rename = False-+for line in diff.split("\n"):# Reset rename state on new file diff headerif line.startswith("diff --git "):@@ -836,7 +950,7 @@ def parse_diff_ranges(diff: str) -> dict[str, "ChangedFile"]:additions=[],deletions=[],is_rename=is_rename,- old_path=pending_rename_from+ old_path=pending_rename_from,)files[path] = current_filepending_rename_from = None@@ -846,7 +960,7 @@ def parse_diff_ranges(diff: str) -> dict[str, "ChangedFile"]:pending_rename_from = Noneelif line.startswith("@@") and current_file:parse_hunk_header(line, current_file)-+return files@@ -858,7 +972,7 @@ def parse_hunk_header(line: str, current_file: "ChangedFile"):old_count = int(match.group(2) or 1)new_start = int(match.group(3))new_count = int(match.group(4) or 1)-+if old_count > 0:current_file.deletions.append((old_start, old_start + old_count - 1))if new_count > 0:@@ -869,12 +983,13 @@ def parse_hunk_header(line: str, current_file: "ChangedFile"):# GITHUB API# =============================================================================+def get_repo_info() -> tuple[str, str]:"""Get owner and repo name from environment or git."""if os.environ.get("GITHUB_REPOSITORY"):owner, repo = os.environ["GITHUB_REPOSITORY"].split("/")return owner, repo-+result = run_gh(["repo", "view", "--json", "owner,name"])data = json.loads(result.stdout)return data["owner"]["login"], data["name"]@@ -884,10 +999,10 @@ def query_open_prs(owner: str, repo: str, base_branch: str) -> list[dict]:"""Query all open PRs targeting the specified base branch."""prs = []cursor = None-+while True:after_clause = f', after: "{cursor}"' if cursor else ""- query = f'''+ query = f"""query {{repository(owner: "{owner}", name: "{repo}") {{pullRequests(@@ -919,37 +1034,42 @@ def query_open_prs(owner: str, repo: str, base_branch: str) -> list[dict]:}}}}}}- '''-+ """+result = run_gh(["api", "graphql", "-f", f"query={query}"])data = json.loads(result.stdout)-+if "errors" in data:print(f"GraphQL errors: {data['errors']}", file=sys.stderr)sys.exit(1)-+pr_data = data["data"]["repository"]["pullRequests"]for edge in pr_data["edges"]:node = edge["node"]files_data = node["files"]# Warn if PR has more than 100 files (API limit, we only fetch first 100)if files_data.get("pageInfo", {}).get("hasNextPage"):- print(f"Warning: PR #{node['number']} has >100 files, overlap detection may be incomplete", file=sys.stderr)- prs.append({- "number": node["number"],- "title": node["title"],- "url": node["url"],- "updated_at": node.get("updatedAt"),- "author": node["author"]["login"] if node["author"] else "unknown",- "head_ref": node["headRefName"],- "base_ref": node["baseRefName"],- "files": [f["path"] for f in files_data["nodes"]]- })-+ print(+ f"Warning: PR #{node['number']} has >100 files, overlap detection may be incomplete",+ file=sys.stderr,+ )+ prs.append(+ {+ "number": node["number"],+ "title": node["title"],+ "url": node["url"],+ "updated_at": node.get("updatedAt"),+ "author": node["author"]["login"] if node["author"] else "unknown",+ "head_ref": node["headRefName"],+ "base_ref": node["baseRefName"],+ "files": [f["path"] for f in files_data["nodes"]],+ }+ )+if not pr_data["pageInfo"]["hasNextPage"]:breakcursor = pr_data["pageInfo"]["endCursor"]-+return prs@@ -963,12 +1083,12 @@ def post_or_update_comment(pr_number: int, body: str):"""Post a new comment or update existing overlap detection comment."""if not body:return-+marker = "## 🔍 PR Overlap Detection"-+# Find existing comment using GraphQLowner, repo = get_repo_info()- query = f'''+ query = f"""query {{repository(owner: "{owner}", name: "{repo}") {{pullRequest(number: {pr_number}) {{@@ -982,51 +1102,64 @@ def post_or_update_comment(pr_number: int, body: str):}}}}}}- '''-+ """+result = run_gh(["api", "graphql", "-f", f"query={query}"], check=False)-+existing_comment_id = Noneif result.returncode == 0:try:data = json.loads(result.stdout)- comments = data.get("data", {}).get("repository", {}).get("pullRequest", {}).get("comments", {}).get("nodes", [])+ comments = (+ data.get("data", {})+ .get("repository", {})+ .get("pullRequest", {})+ .get("comments", {})+ .get("nodes", [])+ )for comment in comments:if marker in comment.get("body", ""):existing_comment_id = comment["id"]breakexcept Exception as e:- print(f"Warning: Could not search for existing comment: {e}", file=sys.stderr)-+ print(+ f"Warning: Could not search for existing comment: {e}", file=sys.stderr+ )+if existing_comment_id:# Update existing comment using GraphQL mutation# Use json.dumps for proper escaping of all special charactersescaped_body = json.dumps(body)[1:-1] # Strip outer quotes added by json.dumps- mutation = f'''+ mutation = f"""mutation {{updateIssueComment(input: {{id: "{existing_comment_id}", body: "{escaped_body}"}}) {{issueComment {{ id }}}}}}- '''+ """result = run_gh(["api", "graphql", "-f", f"query={mutation}"], check=False)if result.returncode == 0:print(f"Updated existing overlap comment")else:# Fallback to posting new comment- print(f"Failed to update comment, posting new one: {result.stderr}", file=sys.stderr)+ print(+ f"Failed to update comment, posting new one: {result.stderr}",+ file=sys.stderr,+ )run_gh(["pr", "comment", str(pr_number), "--body", body])else:# Post new commentrun_gh(["pr", "comment", str(pr_number), "--body", body])-def send_discord_notification(webhook_url: str, pr: "PullRequest", overlaps: list["Overlap"]):+def send_discord_notification(+ webhook_url: str, pr: "PullRequest", overlaps: list["Overlap"]+):"""Send a Discord notification about significant overlaps."""conflicts = [o for o in overlaps if o.has_merge_conflict]if not conflicts:return-+# Discord limits: max 25 fields, max 1024 chars per field valuefields = []for o in conflicts[:25]:@@ -1040,29 +1173,36 @@ def send_discord_notification(webhook_url: str, pr: "PullRequest", overlaps: lis# Truncate if still too longif len(value) > 1024:value = value[:1020] + "..."- fields.append({- "name": f"Conflicts with #{other.number}",- "value": value,- "inline": False- })-+ fields.append(+ {"name": f"Conflicts with #{other.number}", "value": value, "inline": False}+ )+embed = {"title": f"⚠️ PR #{pr.number} has merge conflicts","description": f"[{pr.title}]({pr.url})","color": 0xFF0000,- "fields": fields+ "fields": fields,}-+if len(conflicts) > 25:embed["footer"] = {"text": f"... and {len(conflicts) - 25} more conflicts"}-+try:subprocess.run(- ["curl", "-X", "POST", "-H", "Content-Type: application/json",- "--max-time", "10",- "-d", json.dumps({"embeds": [embed]}), webhook_url],+ [+ "curl",+ "-X",+ "POST",+ "-H",+ "Content-Type: application/json",+ "--max-time",+ "10",+ "-d",+ json.dumps({"embeds": [embed]}),+ webhook_url,+ ],capture_output=True,- timeout=15+ timeout=15,)except subprocess.TimeoutExpired:print("Warning: Discord webhook timed out", file=sys.stderr)@@ -1072,28 +1212,22 @@ def send_discord_notification(webhook_url: str, pr: "PullRequest", overlaps: lis# UTILITIES# =============================================================================+def run_gh(args: list[str], check: bool = True) -> subprocess.CompletedProcess:"""Run a gh CLI command."""- result = subprocess.run(- ["gh"] + args,- capture_output=True,- text=True,- check=False- )+ result = subprocess.run(["gh"] + args, capture_output=True, text=True, check=False)if check and result.returncode != 0:print(f"Error running gh {' '.join(args)}: {result.stderr}", file=sys.stderr)sys.exit(1)return result-def run_git(args: list[str], cwd: str = None, check: bool = True) -> subprocess.CompletedProcess:+def run_git(+ args: list[str], cwd: str = None, check: bool = True+) -> subprocess.CompletedProcess:"""Run a git command."""result = subprocess.run(- ["git"] + args,- capture_output=True,- text=True,- cwd=cwd,- check=False+ ["git"] + args, capture_output=True, text=True, cwd=cwd, check=False)if check and result.returncode != 0:print(f"Error running git {' '.join(args)}: {result.stderr}", file=sys.stderr)@@ -1113,31 +1247,32 @@ def find_common_prefix(paths: list[str]) -> str:if not paths:return ""if len(paths) == 1:- parts = paths[0].rsplit('/', 1)- return parts[0] + '/' if len(parts) > 1 else ""-- split_paths = [p.split('/') for p in paths]+ parts = paths[0].rsplit("/", 1)+ return parts[0] + "/" if len(parts) > 1 else ""++ split_paths = [p.split("/") for p in paths]common = []for parts in zip(*split_paths):if len(set(parts)) == 1:common.append(parts[0])else:break-- return '/'.join(common) + '/' if common else ""++ return "/".join(common) + "/" if common else ""def format_relative_time(iso_timestamp: str) -> str:"""Format an ISO timestamp as relative time."""if not iso_timestamp:return ""-+from datetime import datetime, timezone+try:- dt = datetime.fromisoformat(iso_timestamp.replace('Z', '+00:00'))+ dt = datetime.fromisoformat(iso_timestamp.replace("Z", "+00:00"))now = datetime.now(timezone.utc)diff = now - dt-+seconds = diff.total_seconds()if seconds < 60:return "just now"@@ -1156,9 +1291,11 @@ def format_relative_time(iso_timestamp: str) -> str:# DATA CLASSES# =============================================================================+@dataclassclass ChangedFile:"""Represents a file changed in a PR."""+path: stradditions: list[tuple[int, int]]deletions: list[tuple[int, int]]@@ -1169,6 +1306,7 @@ class ChangedFile:@dataclassclass PullRequest:"""Represents a pull request."""+number: inttitle: strauthor: str@@ -1183,6 +1321,7 @@ class PullRequest:@dataclassclass ConflictInfo:"""Info about a single conflicting file."""+path: strconflict_count: int = 0conflict_lines: int = 0@@ -1192,6 +1331,7 @@ class ConflictInfo:@dataclassclass Overlap:"""Represents an overlap between two PRs."""+pr_a: PullRequestpr_b: PullRequestoverlapping_files: list[str]diff --git a/.github/scripts/platform-single-container-publish.sh b/.github/scripts/platform-single-container-publish.shnew file mode 100755index 0000000000..2440dddc97--- /dev/null+++ b/.github/scripts/platform-single-container-publish.sh@@ -0,0 +1,921 @@+#!/usr/bin/env bash++set -euo pipefail++platform_from_image_json() {+ local expected_arch="$1"+ jq -er --arg expected "linux/${expected_arch}" '+ if has("os") and has("architecture") then+ "\(.os)/\(.architecture)"+ else+ to_entries+ | map(select(.value.os? != null and .value.architecture? != null))+ | map("\(.value.os)/\(.value.architecture)")+ | if index($expected) != null then+ $expected+ elif length == 1 then+ .[0]+ else+ error("expected one matching runnable platform")+ end+ end+ '+}++repository_is_public() {+ jq -e '+ .namespace == "significantgravitas"+ and .name == "autogpt"+ and .is_private == false+ ' >/dev/null+}++manifest_is_absent() {+ local inspect_status="$1"+ local inspect_output="$2"+ ((inspect_status != 0)) && grep -Eqi '(manifest unknown|not found)' <<<"$inspect_output"+}++expected_source_revision() {+ printf '%s\n' "$GITHUB_SHA"+}++runnable_manifest_rows() {+ jq -er '+ def valid_digest:+ type == "string" and test("^sha256:[0-9a-f]{64}$");+ def image_manifest:+ .mediaType == "application/vnd.oci.image.manifest.v1+json"+ or .mediaType == "application/vnd.docker.distribution.manifest.v2+json";+ def image_index:+ .mediaType == "application/vnd.oci.image.index.v1+json"+ or .mediaType == "application/vnd.docker.distribution.manifest.list.v2+json";++ if image_index and (.manifests | type) == "array" then+ .manifests as $manifests+ | [+ $manifests[]+ | select(+ ((.annotations // {})["vnd.docker.reference.type"] // "")+ != "attestation-manifest"+ )+ ] as $runnable+ | [+ $manifests[]+ | select(+ ((.annotations // {})["vnd.docker.reference.type"] // "")+ == "attestation-manifest"+ )+ ] as $attestations+ | [+ $runnable[]+ | { platform: "\(.platform.os)/\(.platform.architecture)", digest }+ ] as $rows+ | if (+ ($rows | map(.platform) | sort) == ["linux/amd64", "linux/arm64"]+ and all($runnable[]; image_manifest and (.digest | valid_digest))+ and (($runnable | length) + ($attestations | length) == ($manifests | length))+ and all(+ $attestations[];+ (image_manifest)+ and (.digest | valid_digest)+ and .platform.os == "unknown"+ and .platform.architecture == "unknown"+ and (+ .annotations["vnd.docker.reference.digest"] as $subject+ | any($runnable[]; .digest == $subject)+ )+ )+ ) then+ $rows[] | "\(.platform) \(.digest)"+ else+ error("invalid runnable or attestation manifest set")+ end+ else+ error("expected a supported image index")+ end+ '+}++single_runnable_manifest_row() {+ local expected_arch="$1"+ local source_digest="$2"+ jq -er --arg expected_arch "$expected_arch" --arg source_digest "$source_digest" '+ def valid_digest:+ type == "string" and test("^sha256:[0-9a-f]{64}$");+ def image_manifest:+ .mediaType == "application/vnd.oci.image.manifest.v1+json"+ or .mediaType == "application/vnd.docker.distribution.manifest.v2+json";+ def image_index:+ .mediaType == "application/vnd.oci.image.index.v1+json"+ or .mediaType == "application/vnd.docker.distribution.manifest.list.v2+json";++ if image_manifest then+ if ($source_digest | valid_digest) then+ "linux/\($expected_arch) \($source_digest)"+ else+ error("invalid source manifest digest")+ end+ elif image_index then+ .manifests as $manifests+ | if ($manifests | type) != "array" then+ error("index is missing manifest descriptors")+ else+ [+ $manifests[]+ | select(+ ((.annotations // {})["vnd.docker.reference.type"] // "")+ != "attestation-manifest"+ )+ ] as $runnable+ | if ($runnable | length) != 1 then+ error("expected exactly one runnable descriptor")+ else+ $runnable[0] as $image+ | [+ $manifests[]+ | select(+ ((.annotations // {})["vnd.docker.reference.type"] // "")+ == "attestation-manifest"+ )+ ] as $attestations+ | if (+ ($image | image_manifest)+ and ($image.digest | valid_digest)+ and $image.platform.os == "linux"+ and $image.platform.architecture == $expected_arch+ and (($runnable | length) + ($attestations | length) == ($manifests | length))+ and all(+ $attestations[];+ (image_manifest)+ and (.digest | valid_digest)+ and .platform.os == "unknown"+ and .platform.architecture == "unknown"+ and .annotations["vnd.docker.reference.digest"] == $image.digest+ )+ ) then+ "linux/\($expected_arch) \($image.digest)"+ else+ error("invalid runnable or attestation descriptor")+ end+ end+ end+ else+ error("unsupported manifest media type")+ end+ '+}++resolve_publication() {+ immutable_ref="${DEPLOY_IMAGE}:sha-${GITHUB_SHA}"+ release_ref=""+ release_version=""+ publish_latest=false+ publication_name="Single-container SHA image published"++ if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" && "$GITHUB_REF" == "refs/heads/dev" ]]; then+ return+ fi++ if [[ "$GITHUB_EVENT_NAME" == "release" && "$GITHUB_REF" == "refs/tags/${RELEASE_TAG}" ]]; then+ if [[ ! "$RELEASE_TAG" =~ ^autogpt-platform-beta-v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then+ echo "refusing unsupported release tag: $RELEASE_TAG" >&2+ return 1+ fi+ release_version="v${BASH_REMATCH[1]}"+ release_ref="${DEPLOY_IMAGE}:${release_version}"+ publish_latest=true+ publication_name="Single-container release published"+ return+ fi++ echo "refusing to publish from $GITHUB_EVENT_NAME / $GITHUB_REF" >&2+ return 1+}++publication_allowed() {+ if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then+ if [[ "$PUBLISH_REQUESTED" != "true" ]]; then+ printf 'false\n'+ return+ fi+ if ! resolve_publication; then+ return 1+ fi+ printf 'true\n'+ return+ fi++ if [[ "$GITHUB_EVENT_NAME" == "release" ]]; then+ if [[ "$RELEASE_PRERELEASE" != "false" ]]; then+ printf 'false\n'+ return+ fi+ if [[ "$RELEASE_TAG" != autogpt-platform-beta-v* ]]; then+ printf 'false\n'+ return+ fi+ if ! resolve_publication; then+ return 1+ fi+ printf 'true\n'+ return+ fi++ printf 'false\n'+}++authorize() {+ local allowed+ allowed="$(publication_allowed)"+ if [[ "$allowed" != "true" && "$allowed" != "false" ]]; then+ echo "publication authorization returned an invalid result" >&2+ return 1+ fi+ echo "allowed=$allowed" >>"$GITHUB_OUTPUT"+}++inspect_manifest_once() {+ local image_ref="$1"+ docker buildx imagetools inspect "$image_ref" --format '{{json .Manifest.Digest}}' | jq -er .+}++inspect_manifest() {+ local image_ref="$1"+ local attempt inspect_output="" inspect_status=0++ for ((attempt = 1; attempt <= 6; attempt++)); do+ if inspect_output="$(inspect_manifest_once "$image_ref" 2>&1)"; then+ inspect_status=0+ if [[ "$inspect_output" =~ ^sha256:[0-9a-f]{64}$ ]]; then+ printf '%s\n' "$inspect_output"+ return 0+ fi+ else+ inspect_status=$?+ fi+ if ((attempt < 6)); then+ sleep 2+ fi+ done++ echo "could not resolve a valid manifest digest for $image_ref after 6 attempts (last status $inspect_status)" >&2+ [[ -z "$inspect_output" ]] || printf '%s\n' "$inspect_output" >&2+ return 1+}++inspect_tag_once() {+ local image_ref="$1"+ docker buildx imagetools inspect "$image_ref"+}++tag_state() {+ local image_ref="$1"+ local attempt inspect_output inspect_status++ for ((attempt = 1; attempt <= 3; attempt++)); do+ if inspect_output="$(inspect_tag_once "$image_ref" 2>&1)"; then+ printf 'present\n'+ return 0+ else+ inspect_status=$?+ fi+ if ! manifest_is_absent "$inspect_status" "$inspect_output"; then+ echo "could not determine whether $image_ref exists" >&2+ printf '%s\n' "$inspect_output" >&2+ return 1+ fi+ if ((attempt < 3)); then+ sleep 2+ fi+ done+ printf 'absent\n'+}++verify_manifest() {+ local image_ref="$1"+ shift+ local raw_manifest rows_output actual_rows expected_rows row platform digest image_json source_revision+ local -a rows=()++ if (($# != 2)); then+ echo "expected two smoke-tested platform descriptors" >&2+ return 1+ fi+ raw_manifest="$(docker buildx imagetools inspect --raw "$image_ref")"+ rows_output="$(runnable_manifest_rows <<<"$raw_manifest")"+ mapfile -t rows <<<"$rows_output"+ actual_rows="$(printf '%s\n' "${rows[@]}" | sort)"+ expected_rows="$(printf '%s\n' "$@" | sort)"+ if [[ "$actual_rows" != "$expected_rows" ]]; then+ echo "$image_ref does not match this run's smoke-tested platform digests" >&2+ return 1+ fi+ source_revision="$(expected_source_revision)"+ for row in "${rows[@]}"; do+ read -r platform digest <<<"$row"+ [[ "$digest" =~ ^sha256:[0-9a-f]{64}$ ]]+ image_json="$(+ docker buildx imagetools inspect "${DEPLOY_IMAGE}@${digest}" --format '{{json .Image}}'+ )"+ if ! jq -e --arg revision "$source_revision" '+ .config.Labels["org.opencontainers.image.revision"] == $revision+ ' <<<"$image_json" >/dev/null; then+ echo "$image_ref has an unexpected source revision for $platform" >&2+ return 1+ fi+ done+}++ensure_immutable_manifest() {+ local state resolved_digest++ state="$(tag_state "$immutable_ref")"+ if [[ "$state" == "absent" ]]; then+ docker buildx imagetools create \+ --metadata-file "$MANIFEST_METADATA" \+ --tag "$immutable_ref" \+ "${image_refs[@]}"+ manifest_digest="$(jq -er '."containerimage.descriptor".digest' "$MANIFEST_METADATA")"+ else+ manifest_digest="$(inspect_manifest "$immutable_ref")"+ echo "Reusing verified immutable tag $immutable_ref" >&2+ fi++ if [[ ! "$manifest_digest" =~ ^sha256:[0-9a-f]{64}$ ]]; then+ echo "manifest publication did not return a valid sha256 digest" >&2+ return 1+ fi+ resolved_digest="$(inspect_manifest "$immutable_ref")"+ if [[ "$resolved_digest" != "$manifest_digest" ]]; then+ echo "immutable tag resolved to an unexpected digest" >&2+ return 1+ fi+ verify_manifest "$immutable_ref" "${expected_rows[@]}"+}++ensure_release_tag() {+ local manifest_digest="$1"+ local state raw_manifest++ release_manifest_digest="$manifest_digest"+ [[ -n "$release_ref" ]] || return 0+ state="$(tag_state "$release_ref")"+ if [[ "$state" == "absent" ]]; then+ docker buildx imagetools create \+ --annotation "index:org.opencontainers.image.version=${release_version}" \+ --tag "$release_ref" \+ "${DEPLOY_IMAGE}@${manifest_digest}"+ fi+ release_manifest_digest="$(inspect_manifest "$release_ref")"+ verify_manifest "$release_ref" "${expected_rows[@]}"+ raw_manifest="$(docker buildx imagetools inspect --raw "$release_ref")"+ if [[ "$(release_version_from_manifest <<<"$raw_manifest")" != "$release_version" ]]; then+ echo "$release_ref is missing its immutable release-version annotation" >&2+ return 1+ fi+}++release_version_from_manifest() {+ jq -er '.annotations["org.opencontainers.image.version"] | select(test("^v[0-9]+\\.[0-9]+\\.[0-9]+$"))'+}++semver_is_newer() {+ local left="${1#v}"+ local right="${2#v}"+ local left_part right_part index+ local -a left_parts right_parts++ IFS=. read -r -a left_parts <<<"$left"+ IFS=. read -r -a right_parts <<<"$right"+ ((${#left_parts[@]} == 3 && ${#right_parts[@]} == 3)) || return 2+ for index in 0 1 2; do+ left_part="${left_parts[$index]}"+ right_part="${right_parts[$index]}"+ [[ "$left_part" =~ ^[0-9]+$ && "$right_part" =~ ^[0-9]+$ ]] || return 2+ if ((10#$left_part > 10#$right_part)); then+ return 0+ fi+ if ((10#$left_part < 10#$right_part)); then+ return 1+ fi+ done+ return 1+}++latest_update_allowed() {+ local current_version="$1"+ local current_digest="$2"+ local target_version="$3"+ local target_digest="$4"+ local compare_status++ if [[ "$current_version" == "$target_version" ]]; then+ if [[ "$current_digest" != "$target_digest" ]]; then+ echo "latest already contains a different ${target_version} artifact" >&2+ return 1+ fi+ return+ fi++ set +e+ semver_is_newer "$current_version" "$target_version"+ compare_status=$?+ set -e+ if ((compare_status == 0)); then+ echo "refusing to move latest backward from $current_version to $target_version" >&2+ return 1+ fi+ if ((compare_status == 2)); then+ echo "could not compare latest release versions" >&2+ return 1+ fi+}++assert_latest_can_move() {+ local target_digest="$1"+ local state current_version current_digest raw_manifest++ state="$(tag_state "${DEPLOY_IMAGE}:latest")"+ [[ "$state" == "present" ]] || return 0+ raw_manifest="$(docker buildx imagetools inspect --raw "${DEPLOY_IMAGE}:latest")"+ current_version="$(release_version_from_manifest <<<"$raw_manifest")"+ current_digest="$(inspect_manifest "${DEPLOY_IMAGE}:latest")"+ latest_update_allowed "$current_version" "$current_digest" "$release_version" "$target_digest"+}++publish_latest_tag() {+ local manifest_digest="$1"+ local resolved_digest++ latest_ref="${DEPLOY_IMAGE}:latest"+ assert_latest_can_move "$manifest_digest"+ docker buildx imagetools create --tag "$latest_ref" "${DEPLOY_IMAGE}@${manifest_digest}"+ resolved_digest="$(inspect_manifest "$latest_ref")"+ if [[ "$resolved_digest" != "$manifest_digest" ]]; then+ echo "latest did not resolve to the verified manifest digest" >&2+ return 1+ fi+}++load_verified_digests() {+ local digest_file descriptor expected_arch digest_hex image_ref actual_platform raw_manifest expected_row+ local runnable_digest image_json source_revision+ local -a digest_files=()+ declare -A seen_platforms=()++ mapfile -t digest_files < <(find "$DIGEST_DIR" -maxdepth 1 -type f -print | sort)+ if ((${#digest_files[@]} != 2)); then+ echo "expected exactly two verified platform digests" >&2+ return 1+ fi++ image_refs=()+ expected_rows=()+ source_revision="$(expected_source_revision)"+ for digest_file in "${digest_files[@]}"; do+ descriptor="$(basename "$digest_file")"+ if [[ ! "$descriptor" =~ ^(amd64|arm64)-([0-9a-f]{64})$ ]]; then+ echo "invalid digest artifact name: $descriptor" >&2+ return 1+ fi+ expected_arch="${BASH_REMATCH[1]}"+ digest_hex="${BASH_REMATCH[2]}"+ if [[ -n "${seen_platforms[$expected_arch]:-}" ]]; then+ echo "duplicate digest for linux/${expected_arch}" >&2+ return 1+ fi+ seen_platforms[$expected_arch]=1+ image_ref="${DEPLOY_IMAGE}@sha256:${digest_hex}"+ actual_platform="$(+ docker buildx imagetools inspect "$image_ref" --format '{{json .Image}}' |+ platform_from_image_json "$expected_arch"+ )"+ if [[ "$actual_platform" != "linux/${expected_arch}" ]]; then+ echo "$image_ref is $actual_platform, expected linux/${expected_arch}" >&2+ return 1+ fi+ raw_manifest="$(docker buildx imagetools inspect --raw "$image_ref")"+ expected_row="$(+ single_runnable_manifest_row "$expected_arch" "sha256:${digest_hex}" <<<"$raw_manifest"+ )"+ read -r _ runnable_digest <<<"$expected_row"+ image_json="$(+ docker buildx imagetools inspect "${DEPLOY_IMAGE}@${runnable_digest}" \+ --format '{{json .Image}}'+ )"+ if ! jq -e --arg revision "$source_revision" '+ .config.Labels["org.opencontainers.image.revision"] == $revision+ ' <<<"$image_json" >/dev/null; then+ echo "$image_ref has an unexpected source revision for linux/${expected_arch}" >&2+ return 1+ fi+ image_refs+=("$image_ref")+ expected_rows+=("$expected_row")+ done+}++verify_public_repository() {+ local repository_metadata+ repository_metadata="$(+ curl --fail --silent --show-error --retry 5 --retry-all-errors \+ --connect-timeout 10 --max-time 60 \+ https://hub.docker.com/v2/repositories/significantgravitas/autogpt/+ )"+ if ! repository_is_public <<<"$repository_metadata"; then+ echo "Docker Hub repository significantgravitas/autogpt must be public" >&2+ return 1+ fi+}++write_summary() {+ local published_manifest_digest="$1"+ local sha_manifest_digest="$2"+ {+ echo "## $publication_name"+ echo+ echo "\`${immutable_ref}\`"+ echo "SHA digest: \`${sha_manifest_digest}\`"+ if [[ -n "$release_ref" ]]; then+ echo+ echo "\`${release_ref}\`"+ echo "\`${latest_ref}\`"+ echo "Release digest: \`${published_manifest_digest}\`"+ fi+ echo+ echo "Platforms: \`linux/amd64\`, \`linux/arm64\`"+ } >>"$GITHUB_STEP_SUMMARY"+}++publish() {+ local manifest_digest=""+ local release_manifest_digest=""+ local sha_manifest_digest=""+ local -a image_refs=()+ local -a expected_rows=()++ resolve_publication+ verify_public_repository+ load_verified_digests+ ensure_immutable_manifest+ sha_manifest_digest="$manifest_digest"+ ensure_release_tag "$manifest_digest"+ if [[ "$publish_latest" == true ]]; then+ publish_latest_tag "$release_manifest_digest"+ manifest_digest="$release_manifest_digest"+ fi+ write_summary "$manifest_digest" "$sha_manifest_digest"+}++assert_equal() {+ local expected="$1"+ local actual="$2"+ local message="$3"+ if [[ "$actual" != "$expected" ]]; then+ echo "$message: expected '$expected', got '$actual'" >&2+ return 1+ fi+}++self_test() {+ local actual authorization_output manifest_retry_state tag_retry_state++ actual="$(platform_from_image_json amd64 <<<'{"os":"linux","architecture":"amd64"}')"+ assert_equal linux/amd64 "$actual" "flat image platform"+ actual="$(platform_from_image_json arm64 <<<'{"linux/arm64":{"os":"linux","architecture":"arm64"},"unknown/unknown":{}}')"+ assert_equal linux/arm64 "$actual" "platform-map image"++ repository_is_public <<<'{"namespace":"significantgravitas","name":"autogpt","is_private":false}'+ if repository_is_public <<<'{"namespace":"significantgravitas","name":"autogpt","is_private":true}'; then+ echo "private repository fixture was accepted" >&2+ return 1+ fi+ if repository_is_public <<<'{"namespace":"other","name":"autogpt","is_private":false}'; then+ echo "wrong repository fixture was accepted" >&2+ return 1+ fi++ manifest_is_absent 1 'manifest unknown'+ manifest_is_absent 1 'not found'+ if manifest_is_absent 1 'unauthorized'; then+ echo "authorization failure was treated as an absent manifest" >&2+ return 1+ fi+ if manifest_is_absent 0 ''; then+ echo "existing manifest was treated as absent" >&2+ return 1+ fi++ manifest_retry_state="$(mktemp)"+ printf '0\n' >"$manifest_retry_state"+ actual="$(+ (+ inspect_manifest_once() {+ local attempt+ attempt="$(<"$manifest_retry_state")"+ attempt=$((attempt + 1))+ printf '%s\n' "$attempt" >"$manifest_retry_state"+ if ((attempt < 3)); then+ return 1+ fi+ printf 'sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n'+ }+ sleep() {+ :+ }+ inspect_manifest docker.io/significantgravitas/autogpt:test+ )+ )"+ assert_equal \+ sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \+ "$actual" "manifest digest retry"+ actual="$(<"$manifest_retry_state")"+ assert_equal 3 "$actual" "manifest digest retry count"+ printf '0\n' >"$manifest_retry_state"+ if (+ inspect_manifest_once() {+ local attempt+ attempt="$(<"$manifest_retry_state")"+ printf '%s\n' "$((attempt + 1))" >"$manifest_retry_state"+ printf 'null\n'+ }+ sleep() {+ :+ }+ inspect_manifest docker.io/significantgravitas/autogpt:test 2>/dev/null+ ); then+ echo "invalid manifest digest survived bounded retries" >&2+ return 1+ fi+ actual="$(<"$manifest_retry_state")"+ assert_equal 6 "$actual" "invalid manifest retry count"+ rm -f "$manifest_retry_state"++ tag_retry_state="$(mktemp)"+ printf '0\n' >"$tag_retry_state"+ actual="$(+ (+ inspect_tag_once() {+ local attempt+ attempt="$(<"$tag_retry_state")"+ attempt=$((attempt + 1))+ printf '%s\n' "$attempt" >"$tag_retry_state"+ if ((attempt == 1)); then+ printf 'manifest unknown\n' >&2+ return 1+ fi+ }+ sleep() {+ :+ }+ tag_state docker.io/significantgravitas/autogpt:test+ )+ )"+ assert_equal present "$actual" "transient absent manifest state"+ actual="$(<"$tag_retry_state")"+ assert_equal 2 "$actual" "transient absent retry count"+ printf '0\n' >"$tag_retry_state"+ actual="$(+ (+ inspect_tag_once() {+ local attempt+ attempt="$(<"$tag_retry_state")"+ printf '%s\n' "$((attempt + 1))" >"$tag_retry_state"+ printf 'not found\n' >&2+ return 1+ }+ sleep() {+ :+ }+ tag_state docker.io/significantgravitas/autogpt:test+ )+ )"+ assert_equal absent "$actual" "confirmed absent manifest state"+ actual="$(<"$tag_retry_state")"+ assert_equal 3 "$actual" "confirmed absent retry count"+ rm -f "$tag_retry_state"++ DEPLOY_IMAGE=docker.io/significantgravitas/autogpt \+ GITHUB_EVENT_NAME=workflow_dispatch GITHUB_REF=refs/heads/dev GITHUB_SHA=abc123 \+ RELEASE_TAG='' resolve_publication+ assert_equal docker.io/significantgravitas/autogpt:sha-abc123 "$immutable_ref" "dev immutable tag"+ assert_equal '' "$release_ref" "dev release tag"+ assert_equal false "$publish_latest" "dev latest policy"++ release_manifest_digest=""+ ensure_release_tag sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa+ assert_equal \+ sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \+ "$release_manifest_digest" "no-release manifest path"++ (+ tag_state() {+ printf 'absent\n'+ }+ DEPLOY_IMAGE=docker.io/significantgravitas/autogpt \+ assert_latest_can_move \+ sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa+ )++ DEPLOY_IMAGE=docker.io/significantgravitas/autogpt \+ GITHUB_EVENT_NAME=release GITHUB_REF=refs/tags/autogpt-platform-beta-v0.7.1 \+ GITHUB_SHA=abc123 RELEASE_TAG=autogpt-platform-beta-v0.7.1 resolve_publication+ assert_equal docker.io/significantgravitas/autogpt:v0.7.1 "$release_ref" "release version tag"+ assert_equal true "$publish_latest" "release latest policy"++ actual="$(+ DEPLOY_IMAGE=docker.io/significantgravitas/autogpt \+ GITHUB_EVENT_NAME=workflow_dispatch GITHUB_REF=refs/heads/dev GITHUB_SHA=abc123 \+ PUBLISH_REQUESTED=true RELEASE_PRERELEASE='' RELEASE_TAG='' publication_allowed+ )"+ assert_equal true "$actual" "dev publication authorization"+ actual="$(+ DEPLOY_IMAGE=docker.io/significantgravitas/autogpt \+ GITHUB_EVENT_NAME=workflow_dispatch GITHUB_REF=refs/heads/dev GITHUB_SHA=abc123 \+ PUBLISH_REQUESTED=false RELEASE_PRERELEASE='' RELEASE_TAG='' publication_allowed+ )"+ assert_equal false "$actual" "validation-only dispatch authorization"+ actual="$(+ DEPLOY_IMAGE=docker.io/significantgravitas/autogpt \+ GITHUB_EVENT_NAME=release GITHUB_REF=refs/tags/autogpt-platform-beta-v0.7.1 \+ GITHUB_SHA=abc123 PUBLISH_REQUESTED='' RELEASE_PRERELEASE=false \+ RELEASE_TAG=autogpt-platform-beta-v0.7.1 publication_allowed+ )"+ assert_equal true "$actual" "release publication authorization"+ actual="$(+ DEPLOY_IMAGE=docker.io/significantgravitas/autogpt \+ GITHUB_EVENT_NAME=release GITHUB_REF=refs/tags/autogpt-platform-beta-v0.7.1 \+ GITHUB_SHA=abc123 PUBLISH_REQUESTED='' RELEASE_PRERELEASE=true \+ RELEASE_TAG=autogpt-platform-beta-v0.7.1 publication_allowed+ )"+ assert_equal false "$actual" "prerelease publication authorization"++ authorization_output="$(mktemp)"+ GITHUB_OUTPUT="$authorization_output" \+ DEPLOY_IMAGE=docker.io/significantgravitas/autogpt \+ GITHUB_EVENT_NAME=workflow_dispatch GITHUB_REF=refs/heads/dev GITHUB_SHA=abc123 \+ PUBLISH_REQUESTED=true RELEASE_PRERELEASE='' RELEASE_TAG='' authorize+ actual="$(<"$authorization_output")"+ assert_equal allowed=true "$actual" "authorization output"+ : >"$authorization_output"++ if DEPLOY_IMAGE=docker.io/significantgravitas/autogpt \+ GITHUB_EVENT_NAME=release GITHUB_REF=refs/tags/autogpt-platform-beta-v0.7 \+ GITHUB_SHA=abc123 RELEASE_TAG=autogpt-platform-beta-v0.7 resolve_publication 2>/dev/null; then+ echo "malformed release tag was accepted" >&2+ return 1+ fi+ if DEPLOY_IMAGE=docker.io/significantgravitas/autogpt \+ GITHUB_EVENT_NAME=release GITHUB_REF=refs/tags/autogpt-platform-beta-v0.7 \+ GITHUB_SHA=abc123 PUBLISH_REQUESTED='' RELEASE_PRERELEASE=false \+ RELEASE_TAG=autogpt-platform-beta-v0.7 publication_allowed 2>/dev/null; then+ echo "malformed release tag was authorized" >&2+ return 1+ fi+ if GITHUB_OUTPUT="$authorization_output" \+ DEPLOY_IMAGE=docker.io/significantgravitas/autogpt \+ GITHUB_EVENT_NAME=release GITHUB_REF=refs/tags/autogpt-platform-beta-v0.7 \+ GITHUB_SHA=abc123 PUBLISH_REQUESTED='' RELEASE_PRERELEASE=false \+ RELEASE_TAG=autogpt-platform-beta-v0.7 authorize 2>/dev/null; then+ echo "malformed release tag produced an authorization output" >&2+ return 1+ fi+ if [[ -s "$authorization_output" ]]; then+ echo "failed authorization wrote a publication output" >&2+ return 1+ fi+ rm -f "$authorization_output"+ if DEPLOY_IMAGE=docker.io/significantgravitas/autogpt \+ GITHUB_EVENT_NAME=workflow_dispatch GITHUB_REF=refs/heads/feature GITHUB_SHA=abc123 \+ RELEASE_TAG='' resolve_publication 2>/dev/null; then+ echo "feature branch publication was accepted" >&2+ return 1+ fi++ actual="$(runnable_manifest_rows <<'JSON'+{"mediaType":"application/vnd.oci.image.index.v1+json","manifests":[+ {"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","platform":{"os":"linux","architecture":"amd64"}},+ {"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","platform":{"os":"unknown","architecture":"unknown"},"annotations":{"vnd.docker.reference.type":"attestation-manifest","vnd.docker.reference.digest":"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}},+ {"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc","platform":{"os":"linux","architecture":"arm64"}}+]}+JSON+ )"+ assert_equal $'linux/amd64 sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nlinux/arm64 sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' "$actual" "attested manifest rows"++ if runnable_manifest_rows <<'JSON' >/dev/null 2>&1; then+{"mediaType":"application/vnd.oci.image.index.v1+json","manifests":[+ {"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","platform":{"os":"linux","architecture":"amd64"}},+ {"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","platform":{"os":"unknown","architecture":"unknown"}},+ {"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc","platform":{"os":"linux","architecture":"arm64"}}+]}+JSON+ echo "unclassified final manifest descriptor was accepted" >&2+ return 1+ fi++ actual="$(+ single_runnable_manifest_row amd64 \+ sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \+ <<<'{"mediaType":"application/vnd.oci.image.manifest.v1+json"}'+ )"+ assert_equal \+ 'linux/amd64 sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' \+ "$actual" "single image manifest row"++ actual="$(+ single_runnable_manifest_row arm64 \+ sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa <<'JSON'+{"mediaType":"application/vnd.oci.image.index.v1+json","manifests":[+ {"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","platform":{"os":"linux","architecture":"arm64"}},+ {"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc","platform":{"os":"unknown","architecture":"unknown"},"annotations":{"vnd.docker.reference.type":"attestation-manifest","vnd.docker.reference.digest":"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"}}+]}+JSON+ )"+ assert_equal \+ 'linux/arm64 sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' \+ "$actual" "attested image index row"++ if single_runnable_manifest_row amd64 \+ sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \+ <<<'{"mediaType":"application/vnd.oci.image.index.v1+json","manifests":[]}' \+ >/dev/null 2>&1; then+ echo "empty image index was accepted" >&2+ return 1+ fi+ if single_runnable_manifest_row amd64 \+ sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa <<'JSON' \+ >/dev/null 2>&1; then+{"mediaType":"application/vnd.oci.image.index.v1+json","manifests":[+ {"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","platform":{"os":"linux","architecture":"amd64"}},+ {"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc","platform":{"os":"linux","architecture":"arm64"}}+]}+JSON+ echo "multi-platform source index was accepted" >&2+ return 1+ fi+ if single_runnable_manifest_row amd64 \+ sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa <<'JSON' \+ >/dev/null 2>&1; then+{"mediaType":"application/vnd.oci.image.index.v1+json","manifests":[+ {"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","platform":{"os":"linux","architecture":"amd64"}},+ {"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc","platform":{"os":"unknown","architecture":"unknown"},"annotations":{"vnd.docker.reference.type":"attestation-manifest","vnd.docker.reference.digest":"sha256:dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"}}+]}+JSON+ echo "unlinked attestation manifest was accepted" >&2+ return 1+ fi++ actual="$(+ release_version_from_manifest \+ <<<'{"annotations":{"org.opencontainers.image.version":"v0.7.1"}}'+ )"+ assert_equal v0.7.1 "$actual" "release-version annotation"+ if release_version_from_manifest \+ <<<'{"annotations":{"org.opencontainers.image.version":"latest"}}' >/dev/null 2>&1; then+ echo "invalid release-version annotation was accepted" >&2+ return 1+ fi++ semver_is_newer v0.7.2 v0.7.1+ semver_is_newer v1.0.0 v0.99.99+ semver_is_newer v0.08.0 v0.7.99+ if semver_is_newer v0.7.1 v0.7.1; then+ echo "equal semantic version was treated as newer" >&2+ return 1+ fi+ if semver_is_newer v0.7.0 v0.7.1; then+ echo "older semantic version was treated as newer" >&2+ return 1+ fi++ latest_update_allowed v0.7.0 sha256:old v0.7.1 sha256:new+ latest_update_allowed v0.7.1 sha256:same v0.7.1 sha256:same+ if latest_update_allowed v0.7.2 sha256:newer v0.7.1 sha256:older 2>/dev/null; then+ echo "latest rollback was accepted" >&2+ return 1+ fi+ if latest_update_allowed v0.7.1 sha256:first v0.7.1 sha256:second 2>/dev/null; then+ echo "same-version digest replacement was accepted" >&2+ return 1+ fi++ echo "single-container publication helper tests passed"+}++if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then+ case "${1:-}" in+ publish)+ publish+ ;;+ authorize)+ authorize+ ;;+ self-test)+ self_test+ ;;+ *)+ echo "usage: $0 {authorize|publish|self-test}" >&2+ exit 2+ ;;+ esac+fidiff --git a/.github/scripts/platform-single-container-smoke.sh b/.github/scripts/platform-single-container-smoke.shindex 35cbf3d955..2aa1259fe1 100644--- a/.github/scripts/platform-single-container-smoke.sh+++ b/.github/scripts/platform-single-container-smoke.sh@@ -781,7 +781,6 @@ docker run --detach \--restart unless-stopped \--publish 127.0.0.1:3300:3000 \--env "AUTOGPT_PUBLIC_URL=${PUBLIC_URL}" \- --env AUTH_ALLOW_NEW_ACCOUNTS=true \--volume "${DATA_VOLUME}:/data" \"${SMOKE_IMAGE}" >/dev/nullwait_for_healthydiff --git a/.github/workflows/platform-single-container-docker.yml b/.github/workflows/platform-single-container-docker.ymlindex 5c9e31e022..abb94601d3 100644--- a/.github/workflows/platform-single-container-docker.yml+++ b/.github/workflows/platform-single-container-docker.yml@@ -5,27 +5,62 @@ on:branches: [dev]paths:- ".dockerignore"+ - ".github/scripts/platform-single-container-publish.sh"- ".github/scripts/platform-single-container-smoke.sh"- ".github/workflows/platform-single-container-docker.yml"- "autogpt_platform/**"pull_request:paths:- ".dockerignore"+ - ".github/scripts/platform-single-container-publish.sh"- ".github/scripts/platform-single-container-smoke.sh"- ".github/workflows/platform-single-container-docker.yml"- "autogpt_platform/**"+ release:+ types: [published]workflow_dispatch:+ inputs:+ publish:+ description: "Publish the current dev commit to Docker Hub"+ required: true+ type: boolean+ default: falseconcurrency:- group: ${{ github.workflow }}-${{ github.ref }}+ group: ${{ github.workflow }}-${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'release') && 'publication' || github.ref }}cancel-in-progress: ${{ github.event_name == 'pull_request' }}permissions:contents: read+env:+ DEPLOY_IMAGE: docker.io/significantgravitas/autogpt+jobs:+ authorize-publication:+ name: Authorize publication source+ runs-on: ubuntu-24.04+ outputs:+ allowed: ${{ steps.policy.outputs.allowed }}+ steps:+ - name: Check out repository+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1+ with:+ persist-credentials: false++ - name: Validate publication source+ id: policy+ shell: bash+ env:+ PUBLISH_REQUESTED: ${{ inputs.publish }}+ RELEASE_PRERELEASE: ${{ github.event.release.prerelease }}+ RELEASE_TAG: ${{ github.event.release.tag_name }}+ run: bash .github/scripts/platform-single-container-publish.sh authorize+build-and-scan:name: Build, smoke, and scan (${{ matrix.platform }})+ needs: authorize-publication+ if: ${{ github.event_name != 'release' || needs.authorize-publication.outputs.allowed == 'true' }}runs-on: ${{ matrix.runner }}timeout-minutes: 240strategy:@@ -48,6 +83,10 @@ jobs:shell: bashrun: python3 -m unittest discover -s autogpt_platform/single-container/tests -p 'test_*.py' -v+ - name: Test publication helpers+ shell: bash+ run: bash .github/scripts/platform-single-container-publish.sh self-test+- name: Set up Docker Buildxuses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0with:@@ -65,7 +104,7 @@ jobs:*.platform=${{ matrix.platform }}backend-server.cache-from=type=gha,scope=platform-single-container-backend-${{ matrix.suffix }}backend-server.cache-to=type=gha,scope=platform-single-container-backend-${{ matrix.suffix }},mode=max,ignore-error=true- single-container.args.IMAGE_VERSION=${{ github.sha }}+ single-container.args.IMAGE_VERSION=sha-${{ github.sha }}single-container.args.VCS_REF=${{ github.sha }}single-container.cache-from=type=gha,scope=platform-single-container-${{ matrix.suffix }}single-container.cache-to=type=gha,scope=platform-single-container-${{ matrix.suffix }},mode=max,ignore-error=true@@ -98,3 +137,183 @@ jobs:severity: HIGH,CRITICALexit-code: "1"timeout: 30m++ publish-platform-digests:+ name: Publish, smoke, and scan (${{ matrix.platform }})+ if: ${{ needs.authorize-publication.outputs.allowed == 'true' && needs.build-and-scan.result == 'success' }}+ needs: [authorize-publication, build-and-scan]+ environment: ${{ github.event_name == 'release' && 'dockerhub-release' || 'dockerhub-publish' }}+ runs-on: ${{ matrix.runner }}+ timeout-minutes: 240+ strategy:+ fail-fast: false+ matrix:+ include:+ - platform: linux/amd64+ runner: ubuntu-24.04+ suffix: amd64+ - platform: linux/arm64+ runner: ubuntu-24.04-arm+ suffix: arm64+ steps:+ - name: Check out repository+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1+ with:+ persist-credentials: false++ - name: Set up Docker Buildx+ uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0+ with:+ version: v0.36.0+ driver-opts: |+ image=docker.io/moby/buildkit:v0.32.0@sha256:1f8167fcb0eca5b7126353d35299386945cbb8949cc516c592a49f80cfce4fa2++ - name: Log in to Docker Hub+ uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0+ with:+ username: ${{ secrets.DOCKER_USER }}+ password: ${{ secrets.DOCKER_PASSWORD }}++ - name: Build and push platform digest+ id: build+ uses: docker/bake-action@d3418bd7d0e9324001bca92fa8ba175ea7e6dc9b # v7.3.0+ with:+ source: .+ files: autogpt_platform/single-container/docker-bake.hcl+ targets: single-container+ set: |+ *.platform=${{ matrix.platform }}+ backend-server.cache-from=type=gha,scope=platform-single-container-backend-${{ matrix.suffix }}+ backend-server.cache-to=type=gha,scope=platform-single-container-backend-${{ matrix.suffix }},mode=max,ignore-error=true+ single-container.args.IMAGE_VERSION=sha-${{ github.sha }}+ single-container.args.VCS_REF=${{ github.sha }}+ single-container.cache-from=type=gha,scope=platform-single-container-${{ matrix.suffix }}+ single-container.cache-to=type=gha,scope=platform-single-container-${{ matrix.suffix }},mode=max,ignore-error=true+ single-container.tags=${{ env.DEPLOY_IMAGE }}+ single-container.attest=type=provenance,mode=max+ single-container.attest=type=sbom+ single-container.output=type=image,name=${{ env.DEPLOY_IMAGE }},push-by-digest=true,name-canonical=true,push=true++ - name: Capture pushed digest+ id: digest+ shell: bash+ env:+ BUILD_METADATA: ${{ steps.build.outputs.metadata }}+ run: |+ set -euo pipefail+ digest="$(jq -er '."single-container"."containerimage.digest"' <<<"$BUILD_METADATA")"+ if [[ ! "$digest" =~ ^sha256:[0-9a-f]{64}$ ]]; then+ echo "build did not return a valid sha256 digest" >&2+ exit 1+ fi+ echo "digest=$digest" >> "$GITHUB_OUTPUT"++ - name: Pull the exact pushed digest+ shell: bash+ env:+ DIGEST: ${{ steps.digest.outputs.digest }}+ run: docker pull --platform "${{ matrix.platform }}" "${DEPLOY_IMAGE}@${DIGEST}"++ - name: Smoke-test the exact pushed digest+ shell: bash+ env:+ SMOKE_IMAGE: ${{ env.DEPLOY_IMAGE }}@${{ steps.digest.outputs.digest }}+ SMOKE_PLATFORM: ${{ matrix.platform }}+ run: bash .github/scripts/platform-single-container-smoke.sh++ - name: Scan the exact pushed digest for fixable critical vulnerabilities+ uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0+ env:+ TRIVY_PLATFORM: ${{ matrix.platform }}+ with:+ image-ref: ${{ env.DEPLOY_IMAGE }}@${{ steps.digest.outputs.digest }}+ format: table+ ignore-unfixed: true+ severity: CRITICAL+ exit-code: "1"+ timeout: 30m++ - name: Scan the exact pushed digest for embedded secrets+ uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0+ env:+ TRIVY_PLATFORM: ${{ matrix.platform }}+ with:+ image-ref: ${{ env.DEPLOY_IMAGE }}@${{ steps.digest.outputs.digest }}+ scanners: secret+ format: table+ severity: HIGH,CRITICAL+ exit-code: "1"+ timeout: 30m++ - name: Export verified digest+ shell: bash+ env:+ DIGEST: ${{ steps.digest.outputs.digest }}+ DIGEST_DIR: ${{ runner.temp }}/platform-single-container-publish-digests+ PLATFORM_SUFFIX: ${{ matrix.suffix }}+ run: |+ set -euo pipefail+ digest_hex="${DIGEST#sha256:}"+ [[ "$digest_hex" =~ ^[0-9a-f]{64}$ ]]+ mkdir -p "$DIGEST_DIR"+ # Artifact names carry the platform and verified digest between jobs.+ touch "${DIGEST_DIR}/${PLATFORM_SUFFIX}-${digest_hex}"++ - name: Upload verified digest+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1+ with:+ name: platform-single-container-publish-digest-${{ matrix.suffix }}+ path: ${{ runner.temp }}/platform-single-container-publish-digests/*+ if-no-files-found: error+ retention-days: 1+ compression-level: 0++ publish-manifest:+ name: Publish multi-platform manifest+ if: ${{ needs.authorize-publication.outputs.allowed == 'true' && needs.publish-platform-digests.result == 'success' }}+ needs: [authorize-publication, publish-platform-digests]+ environment: ${{ github.event_name == 'release' && 'dockerhub-release' || 'dockerhub-publish' }}+ runs-on: ubuntu-24.04+ timeout-minutes: 30+ steps:+ - name: Check out repository+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1+ with:+ persist-credentials: false++ - name: Download verified digests+ uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0+ with:+ pattern: platform-single-container-publish-digest-*+ path: ${{ runner.temp }}/platform-single-container-publish-digests+ merge-multiple: true++ - name: Set up Docker Buildx+ uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0+ with:+ version: v0.36.0+ driver-opts: |+ image=docker.io/moby/buildkit:v0.32.0@sha256:1f8167fcb0eca5b7126353d35299386945cbb8949cc516c592a49f80cfce4fa2++ - name: Log in to Docker Hub+ uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0+ with:+ username: ${{ secrets.DOCKER_USER }}+ password: ${{ secrets.DOCKER_PASSWORD }}++ - name: Publish and verify manifest+ shell: bash+ env:+ DIGEST_DIR: ${{ runner.temp }}/platform-single-container-publish-digests+ MANIFEST_METADATA: ${{ runner.temp }}/platform-single-container-manifest.json+ RELEASE_TAG: ${{ github.event.release.tag_name }}+ run: bash .github/scripts/platform-single-container-publish.sh publish++ - name: Update Docker Hub Overview+ uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4.0.0+ with:+ username: ${{ secrets.DOCKER_USER }}+ password: ${{ secrets.DOCKER_PASSWORD }}+ repository: significantgravitas/autogpt+ short-description: Run the AutoGPT Platform, including FalkorDB-backed memory, in one container.+ readme-filepath: ./autogpt_platform/single-container/README.mddiff --git a/.secrets.baseline b/.secrets.baselineindex ebbb89c813..1ae8d5ecf1 100644--- a/.secrets.baseline+++ b/.secrets.baseline@@ -294,7 +294,7 @@"filename": "autogpt_platform/backend/backend/blocks/wordpress/_config.py","hashed_secret": "e62679512436161b78e8a8d68c8829c2a1031ccb","is_verified": false,- "line_number": 17+ "line_number": 18}],"autogpt_platform/backend/backend/util/cache.py": [@@ -467,5 +467,5 @@}]},- "generated_at": "2026-04-24T16:42:44Z"+ "generated_at": "2026-08-11T17:17:27Z"}diff --git a/LICENSE b/LICENSEindex f141042fa4..b75444a0b0 100644--- a/LICENSE+++ b/LICENSE@@ -1,7 +1,7 @@-All portions of this repository are under one of two licenses.+All portions of this repository are under one of two licenses.- Everything inside the autogpt_platform folder is under the Polyform Shield License.-- Everything outside the autogpt_platform folder is under the MIT License.+- Everything outside the autogpt_platform folder is under the MIT License.More info:diff --git a/autogpt_platform/single-container/.env.example b/autogpt_platform/single-container/.env.exampleindex 0f0056eae0..f613c605e9 100644--- a/autogpt_platform/single-container/.env.example+++ b/autogpt_platform/single-container/.env.example@@ -8,12 +8,12 @@ AUTOGPT_PUBLIC_URL=http://localhost:3000AUTOGPT_ENABLE_BOT_SERVICES=falseAUTOGPT_ENABLE_LEGACY_AUTH=false-# Account policy. New-account signup is closed by default, including on-# localhost. To bootstrap the first administrator: set this to true,-# recreate the container, create the account, then run-# `docker exec <container> autogpt-admin promote <email>`. Set this back to-# false and recreate the container after all intended accounts exist.-AUTH_ALLOW_NEW_ACCOUNTS=false+# Account policy. New-account signup is open by default so a fresh container is+# usable. Create the intended accounts, run+# `docker exec <container> autogpt-admin promote <email>`, then set this to+# false and recreate the container to close registration. While this is true,+# anyone who can reach the app can create an account.+AUTH_ALLOW_NEW_ACCOUNTS=trueAUTH_SIGNUP_ALLOWLIST=# Email verification is unsupported and must remain false. Setting it to true# intentionally stops startup instead of silently running an incomplete flow.diff --git a/autogpt_platform/single-container/README.md b/autogpt_platform/single-container/README.mdnew file mode 100644index 0000000000..4d87ab0dce--- /dev/null+++ b/autogpt_platform/single-container/README.md@@ -0,0 +1,64 @@+# AutoGPT Platform++Run the AutoGPT Platform in one container. The image bundles the web app, APIs,+workers, PostgreSQL, RabbitMQ, a three-node Valkey cluster, and FalkorDB-backed+memory while persisting runtime data under `/data`.++> This single-node distribution is experimental. It is intended for local and+> small self-hosted installations, not high-availability deployments.++## Quick start++```bash+docker run -d \+ --name autogpt \+ --restart unless-stopped \+ --shm-size 2g \+ --ulimit nofile=65536:65536 \+ -p 127.0.0.1:3000:3000 \+ -e AUTOGPT_PUBLIC_URL=http://localhost:3000 \+ -v autogpt-data:/data \+ significantgravitas/autogpt:latest+```++The first boot can take several minutes. Wait until Docker reports the container+as `healthy`, then open [http://localhost:3000](http://localhost:3000).+Registration starts open; the loopback-only port binding above keeps it local.+If you expose the app to a network, anyone who can reach it can register until+you close signup.++After creating your account, promote it to administrator:++```bash+docker exec autogpt autogpt-admin promote [email protected]+```++Then recreate the container with `AUTH_ALLOW_NEW_ACCOUNTS=false` to close+registration. Keep the same `autogpt-data` volume so accounts, agents, memory,+and generated application secrets survive container replacement.++## Configuration++`AUTOGPT_PUBLIC_URL` must exactly match the URL used in the browser. For+example, publishing host port `8080` requires+`AUTOGPT_PUBLIC_URL=http://localhost:8080` and `-p 127.0.0.1:8080:3000`.++Configure model providers and optional integrations with environment variables.+Core memory is enabled and stored in the bundled FalkorDB; memory extraction+also needs a configured chat model and embedding provider.++The image supports `linux/amd64` and `linux/arm64`. Test installations used+about 5–6 GiB of memory during startup and steady-state health checks, though+actual usage depends on enabled services and workloads.++## Tags++- `latest` — most recent fully verified AutoGPT Platform release.+- `vX.Y.Z` — immutable AutoGPT Platform release.+- `sha-<git-sha>` — immutable build for an exact source revision.++## More information++- [AutoGPT repository](https://github.com/Significant-Gravitas/AutoGPT)+- [Security policy](https://github.com/Significant-Gravitas/AutoGPT/security/policy)+- [License](https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/LICENSE.md)diff --git a/autogpt_platform/single-container/entrypoint.sh b/autogpt_platform/single-container/entrypoint.shindex dc2ba4b556..5f29f4199f 100755--- a/autogpt_platform/single-container/entrypoint.sh+++ b/autogpt_platform/single-container/entrypoint.sh@@ -172,9 +172,10 @@ configure_environment() {}configure_account_registration() {- normalize_toggle AUTH_ALLOW_NEW_ACCOUNTS false+ normalize_toggle AUTH_ALLOW_NEW_ACCOUNTS trueif [[ "${AUTH_ALLOW_NEW_ACCOUNTS}" == true ]]; then- log "WARNING: open account registration is enabled; disable it after creating the intended accounts"+ log "WARNING: open account registration is enabled; anyone who can reach the app can sign up"+ log "after creating the intended accounts, set AUTH_ALLOW_NEW_ACCOUNTS=false and recreate the container"elselog "account registration is closed; temporarily set AUTH_ALLOW_NEW_ACCOUNTS=true to create intended accounts"log "after signup, run 'docker exec <container> autogpt-admin promote <email>', disable registration, and restart"diff --git a/autogpt_platform/single-container/tests/test_entrypoint.py b/autogpt_platform/single-container/tests/test_entrypoint.pyindex 186e707cd1..49dfe5de18 100644--- a/autogpt_platform/single-container/tests/test_entrypoint.py+++ b/autogpt_platform/single-container/tests/test_entrypoint.py@@ -55,7 +55,7 @@ class InternalServiceTopologyTest(unittest.TestCase):class AccountRegistrationTest(unittest.TestCase):- def test_defaults_closed_for_all_origins(self) -> None:+ def test_defaults_open_for_all_origins(self) -> None:for public_url in ("http://localhost:3000","http://127.0.0.1:3000",@@ -69,11 +69,10 @@ class AccountRegistrationTest(unittest.TestCase):):result = self._configure(public_url, allow_new_accounts)self.assertEqual(result.returncode, 0, result.stderr)- self.assertIn("account registration is closed", result.stdout)- self.assertIn("autogpt-admin promote", result.stdout)- self.assertTrue(result.stdout.endswith("false\n"))+ self.assertIn("open account registration is enabled", result.stdout)+ self.assertTrue(result.stdout.endswith("true\n"))- def test_remote_signup_requires_explicit_opt_in(self) -> None:+ def test_explicit_true_keeps_signup_open(self) -> None:result = self._configure("https://autogpt.example.com", allow_new_accounts="true")@@ -81,7 +80,7 @@ class AccountRegistrationTest(unittest.TestCase):self.assertIn("open account registration is enabled", result.stdout)self.assertTrue(result.stdout.endswith("true\n"))- def test_explicit_false_overrides_loopback_default(self) -> None:+ def test_explicit_false_closes_signup(self) -> None:result = self._configure("http://localhost:3000", allow_new_accounts="false")self.assertEqual(result.returncode, 0, result.stderr)self.assertIn("account registration is closed", result.stdout)diff --git a/autogpt_platform/single-container/tests/test_probe.py b/autogpt_platform/single-container/tests/test_probe.pyindex 93b346796c..dec176ad1b 100644--- a/autogpt_platform/single-container/tests/test_probe.py+++ b/autogpt_platform/single-container/tests/test_probe.py@@ -171,6 +171,5 @@ class ServiceProbeTest(unittest.TestCase):probe.probe_redis("127.0.0.1", 17000, 1, "", True)-if __name__ == "__main__":unittest.main()