π OpenHands: AI-Driven Development
feat: add ready-for-dev issue readiness gate with type-specific criteria (#16449)
OpenHands Botcf2c5685735b
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.ymlindex 9d3050cd18..2570322d19 100644--- a/.github/ISSUE_TEMPLATE/bug_report.yml+++ b/.github/ISSUE_TEMPLATE/bug_report.yml@@ -67,7 +67,23 @@ body:id: actualattributes:label: Actual Behavior- description: What actually happened?+ description: |+ What actually happened? To qualify for the `ready-for-dev` label, show+ how you reproduced the bug in a live Agent Canvas session using one of+ the supported run methods, and attach a screenshot or video of the bug+ in this section.+ Run methods (reference at least one):+ - `npx @openhands/agent-canvas` (or `agent-canvas` if installed globally)+ - `npm run dev` / `npm run dev:minimal` (from a source checkout)+ - The hosted canvas at `app.all-hands.dev/canvas`+ Drag a screenshot/video into this field, or paste a link.+ placeholder: |+ Run method: `npm run dev`++ 1. npm install && npm run dev+ 2. Open http://localhost:8000+ 3. β¦+ 4. Observed the error shown in the attached screenshot.validations:required: true@@ -88,6 +104,20 @@ body:validations:required: false+ - type: textarea+ id: acceptance+ attributes:+ label: Acceptance Criteria+ description: |+ Required for the `ready-for-dev` label. Testable, checkable bullets a+ reviewer can verify. Describe the *fixed* state, not the bug.+ placeholder: |+ - [ ] A screenshot/video demonstrating the bug can be replicated on main is attached to the PR.+ - [ ] A screenshot/video demonstrating that the bug is fixed on the PR branch is attached to the PR.+ - [ ] β¦+ validations:+ required: false+- type: textareaid: screenshotsattributes:diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.ymlnew file mode 100644index 0000000000..c127811762--- /dev/null+++ b/.github/ISSUE_TEMPLATE/feature_request.yml@@ -0,0 +1,60 @@+name: Feature Request+description: Suggest an enhancement or new capability for Agent Canvas.+title: "[Feature]: "+labels: ["enhancement"]+body:+ - type: markdown+ attributes:+ value: |+ Thanks for taking the time to suggest a feature! Please fill out the+ sections below so we can understand and scope the request.++ - type: textarea+ id: problem+ attributes:+ label: Problem or Motivation+ description: What problem does this feature solve, or what is it hard to do today?+ placeholder: Today it is hard to β¦+ validations:+ required: true++ - type: textarea+ id: desired+ attributes:+ label: Desired Behavior+ description: |+ Required for the `ready-for-dev` label. Describe the behavior you want as+ if it already worked, in concrete terms a reviewer can understand.+ placeholder: |+ As a user, I can β¦ so that β¦+ validations:+ required: true++ - type: textarea+ id: acceptance+ attributes:+ label: Acceptance Criteria+ description: |+ Required for the `ready-for-dev` label. Testable, checkable bullets a+ reviewer can verify to confirm the feature is done.+ placeholder: |+ - [ ] A screenshot/video demonstrating the feature behavior is attached to the PR.+ - [ ] β¦+ validations:+ required: true++ - type: textarea+ id: alternatives+ attributes:+ label: Alternatives Considered+ description: What other approaches did you consider, and why did they fall short?+ validations:+ required: false++ - type: textarea+ id: additional+ attributes:+ label: Additional Context+ description: Screenshots, mockups, links, or anything else that helps.+ validations:+ required: falsediff --git a/.github/pull_request_template.md b/.github/pull_request_template.mdindex a54313bc15..990282aaca 100644--- a/.github/pull_request_template.md+++ b/.github/pull_request_template.md@@ -25,7 +25,11 @@ exactly what command you ran and include logs, screenshots, or reproduction note-## Issue Number-<!-- Required if there is a relevant issue to this PR. -->+<!-- Required. The linked issue must carry the `ready-for-dev` label, which+means it has clear acceptance criteria (and, for bugs, reproduction evidence).+If no such issue exists yet, open one using the Bug or Feature Request template+and wait for it to be labeled `ready-for-dev` before opening this PR. -->+Fixes ### How to Test@@ -40,6 +44,9 @@ If you could not test this, say why.<!--Provide a video or screenshots of testing your PR. e.g. you added a new feature to the gui, show us the video of you testing it successfully.+For bug fixes: reproduction evidence is required. Show the bug reproduced (the+error state) and then the result after your fix. A terminal screenshot or video+is fine for non-UI bugs.-->## Typediff --git a/.github/scripts/check_issue_readiness.py b/.github/scripts/check_issue_readiness.pynew file mode 100644index 0000000000..8f685b9d4a--- /dev/null+++ b/.github/scripts/check_issue_readiness.py@@ -0,0 +1,293 @@+"""Determine whether an issue meets the `ready-for-dev` readiness criteria.++The criteria are type-specific:++- Bug reports (labeled `bug`): the Actual Behavior section must reference at+ least one supported run method (`agent-canvas`, `npm run`, or+ `app.all-hands.dev/canvas`) *and* embed a screenshot or video, plus a+ non-empty Acceptance Criteria section with at least one checklist item.++- Enhancements (labeled `enhancement`): the body must contain non-empty+ Desired Behavior and Acceptance Criteria sections, the latter with at least+ one checklist item.++GitHub issue forms render each field as an `### <Label>` (h3) heading followed+by the field text, with empty optional fields rendered as `_No response_`. This+parser splits the body on those headings so each criterion is checked against+the right field rather than the whole body.++Local usage:++ python .github/scripts/check_issue_readiness.py --body-file /tmp/issue.md \+ --labels bug+ python .github/scripts/check_issue_readiness.py --event-path "$GITHUB_EVENT_PATH"+"""++from __future__ import annotations++import argparse+import json+import os+import re+import sys+from dataclasses import dataclass, field+from pathlib import Path++BUG_LABEL = "bug"+ENHANCEMENT_LABEL = "enhancement"++# Issue-form fields render as `### Label` h3 headings. Match case-insensitively+# and tolerate trailing whitespace/colons. `^###\s+` is specific enough because+# h1/h2 are not produced by issue forms.+HEADING_RE = re.compile(r"(?m)^###\s+(.+?)\s*$")++# `_No response_` is what GitHub writes for an empty optional form field.+NO_RESPONSE = "_No response_"++# A supported way to run Agent Canvas. The Reproduction section must mention at+# least one. `agent-canvas` covers `npx @openhands/agent-canvas`,+# `agent-canvas --version`, the published binary, etc. `npm run` covers+# `npm run dev` / `npm run dev:minimal`. The hosted canvas URL is matched+# literally.+RUN_METHOD_PATTERNS: tuple[re.Pattern[str], ...] = (+ re.compile(r"agent-canvas", re.IGNORECASE),+ re.compile(r"npm\s+run", re.IGNORECASE),+ re.compile(r"app\.all-hands\.dev/canvas", re.IGNORECASE),+)++# Markdown image: +MARKDOWN_IMAGE_RE = re.compile(r"!\[[^\]]*\]\([^)]+\)")+# HTML <img ...> and <video ...> tags.+HTML_IMG_RE = re.compile(r"<img\b[^>]*\bsrc\s*=", re.IGNORECASE)+HTML_VIDEO_RE = re.compile(r"<video\b", re.IGNORECASE)+# GitHub-uploaded assets (images and videos both use this URL shape).+GITHUB_ATTACHMENT_RE = re.compile(+ r"https?://(?:www\.)?github\.com/user-attachments/assets/"+)+# Direct links to video files.+VIDEO_FILE_RE = re.compile(+ r"https?://\S+\.(?:mp4|webm|mov|avi|mkv|ogv|3gp|m4v)(?:\S*)",+ re.IGNORECASE,+)+# Known video-hosting services.+VIDEO_HOST_RE = re.compile(+ r"https?://(?:[a-z0-9-]+\.)?(?:youtube\.com|youtu\.be|loom\.com|vimeo\.com|asciinema\.org|streamable\.com)/",+ re.IGNORECASE,+)++# An Acceptance Criteria item is a markdown checklist bullet (`- [ ]` or+# `- [x]`). We require at least one so the section is verifiable.+CHECKLIST_ITEM_RE = re.compile(r"(?m)^\s*[-*]\s*\[[ xX]\]")+++@dataclass+class ReadinessResult:+ """Outcome of a readiness check."""++ ready: bool+ reasons: list[str] = field(default_factory=list)++ def add(self, reason: str) -> None:+ self.reasons.append(reason)+ self.ready = False+++def visible_text(text: str) -> str:+ """Return field text with HTML comments stripped and emptiness normalized."""+ cleaned = re.sub(r"<!--[\s\S]*?-->", "", text).strip()+ if cleaned == NO_RESPONSE:+ return ""+ return cleaned+++def extract_sections(body: str) -> dict[str, str]:+ """Split the body into a {heading: text} map using `### <heading>` boundaries.++ Issue forms render every field this way. Free-form issues (not created via a+ form) may still use `###` headings; if they don't, the map is empty and the+ caller falls back to whole-body checks.+ """+ matches = list(HEADING_RE.finditer(body))+ sections: dict[str, str] = {}+ for index, match in enumerate(matches):+ start = match.end()+ end = matches[index + 1].start() if index + 1 < len(matches) else len(body)+ sections[match.group(1).strip().lower()] = body[start:end]+ return sections+++def find_section(sections: dict[str, str], *labels: str) -> str:+ """Return the first matching section text by case-insensitive label."""+ for label in labels:+ if label in sections:+ return sections[label]+ return ""+++def has_screenshot_or_video(text: str) -> bool:+ if MARKDOWN_IMAGE_RE.search(text):+ return True+ if HTML_IMG_RE.search(text):+ return True+ if HTML_VIDEO_RE.search(text):+ return True+ if GITHUB_ATTACHMENT_RE.search(text):+ return True+ if VIDEO_FILE_RE.search(text):+ return True+ if VIDEO_HOST_RE.search(text):+ return True+ return False+++def references_run_method(text: str) -> bool:+ return any(pattern.search(text) for pattern in RUN_METHOD_PATTERNS)+++def has_checklist_item(text: str) -> bool:+ return bool(CHECKLIST_ITEM_RE.search(text))+++def check_bug(sections: dict[str, str]) -> ReadinessResult:+ result = ReadinessResult(ready=True)++ actual = visible_text(find_section(sections, "actual behavior", "actual"))+ if not actual:+ result.add(+ "Fill in the `### Actual Behavior` section showing how you reproduced "+ "the bug in a live Agent Canvas session."+ )+ else:+ if not references_run_method(actual):+ result.add(+ "The Actual Behavior section must reference a supported run method: "+ "`agent-canvas`, `npm run`, or `app.all-hands.dev/canvas`."+ )+ if not has_screenshot_or_video(actual):+ result.add(+ "The Actual Behavior section must include a screenshot or video of "+ "the bug (drag a file into the field or paste a link)."+ )++ acceptance = visible_text(find_section(sections, "acceptance criteria", "acceptance"))+ if not acceptance:+ result.add("Add an `### Acceptance Criteria` section with testable checklist items.")+ elif not has_checklist_item(acceptance):+ result.add(+ "The Acceptance Criteria section must contain at least one checklist item "+ "(`- [ ] β¦`)."+ )++ return result+++def check_enhancement(sections: dict[str, str]) -> ReadinessResult:+ result = ReadinessResult(ready=True)++ desired = visible_text(find_section(sections, "desired behavior", "desired"))+ if not desired:+ result.add(+ "Add a `### Desired Behavior` section describing the behavior you want."+ )++ acceptance = visible_text(find_section(sections, "acceptance criteria", "acceptance"))+ if not acceptance:+ result.add("Add an `### Acceptance Criteria` section with testable checklist items.")+ elif not has_checklist_item(acceptance):+ result.add(+ "The Acceptance Criteria section must contain at least one checklist item "+ "(`- [ ] β¦`)."+ )++ return result+++def evaluate_readiness(body: str, labels: list[str]) -> ReadinessResult:+ """Return the readiness result for an issue body + label set.++ An issue is only a candidate when it carries the `bug` or `enhancement`+ label. If it has neither, it is treated as not-ready-for-dev (the gate does+ not apply a label it cannot validate).+ """+ label_set = {label.lower() for label in labels}+ sections = extract_sections(body or "")++ if BUG_LABEL in label_set:+ return check_bug(sections)+ if ENHANCEMENT_LABEL in label_set:+ return check_enhancement(sections)++ return ReadinessResult(+ ready=False,+ reasons=[+ "The issue has neither the `bug` nor `enhancement` label, so its "+ "readiness criteria cannot be evaluated. Add the appropriate label."+ ],+ )+++def body_and_labels_from_event(event_path: Path) -> tuple[str, list[str]]:+ payload = json.loads(event_path.read_text())+ issue = payload.get("issue") or payload.get("pull_request")+ if not isinstance(issue, dict):+ raise ValueError("GitHub event payload does not contain an issue object")+ body = issue.get("body")+ body = body if isinstance(body, str) else ""+ labels = [label["name"] for label in issue.get("labels", []) if isinstance(label, dict)]+ return body, labels+++def parse_args() -> argparse.Namespace:+ parser = argparse.ArgumentParser(+ description="Evaluate whether an issue meets the ready-for-dev criteria."+ )+ parser.add_argument("--body-file", type=Path, help="Read the issue body from a file.")+ parser.add_argument(+ "--labels",+ help="Comma-separated issue labels (e.g. 'bug,frontend').",+ default="",+ )+ parser.add_argument(+ "--event-path",+ type=Path,+ default=Path(os.environ["GITHUB_EVENT_PATH"])+ if "GITHUB_EVENT_PATH" in os.environ+ else None,+ help="Read body and labels from a GitHub event payload.",+ )+ parser.add_argument(+ "--json",+ action="store_true",+ help="Emit a JSON result instead of human-readable text.",+ )+ return parser.parse_args()+++def main() -> int:+ args = parse_args()++ if args.body_file is not None:+ body = args.body_file.read_text()+ labels = [label.strip() for label in args.labels.split(",") if label.strip()]+ elif args.event_path is not None:+ body, labels = body_and_labels_from_event(args.event_path)+ else:+ raise SystemExit("Pass --body-file or set GITHUB_EVENT_PATH.")++ result = evaluate_readiness(body, labels)++ if args.json:+ print(json.dumps({"ready": result.ready, "reasons": result.reasons}))+ else:+ if result.ready:+ print("Issue meets ready-for-dev criteria.")+ else:+ print("Issue does not meet ready-for-dev criteria:")+ for reason in result.reasons:+ print(f" - {reason}")++ return 0 if result.ready else 1+++if __name__ == "__main__":+ sys.exit(main())diff --git a/.github/scripts/check_pr_description.py b/.github/scripts/check_pr_description.pyindex f341adc93c..93f91ff38f 100644--- a/.github/scripts/check_pr_description.py+++ b/.github/scripts/check_pr_description.py@@ -7,6 +7,16 @@ Additional checks:checked.- If frontend code was touched, the description must include a screenshot orvideo.+- If the PR is marked as a Bug fix, the description must include a screenshot+ or video showing reproduction evidence β regardless of whether frontend+ code was touched.+- The body must reference at least one issue (e.g. `Fixes #123`) and at least+ one referenced issue must carry the `ready-for-dev` label. The API lookup is+ only performed in CI (when GITHUB_EVENT_PATH and GITHUB_TOKEN are available).+- The PR's Type checkbox must match the linked issue's labels: a "Bug fix" PR+ should link an issue with the `bug` label; a "Feature" PR should link one+ with the `enhancement` label. This prevents a contributor from bypassing+ bug-specific requirements by mislabeling the PR type.Local usage example:python .github/scripts/check_pr_description.py --body-file /tmp/pr-body.md \@@ -58,6 +68,28 @@ HUMAN_TESTED_RE = re.compile(r"(?im)^\s*[-*]\s*\[(?P<box>[ xX])\]\s*.*?human has tested these changes")+# Issue references in the PR body: "Fixes #123", "Closes #123", "Resolves #123",+# or a bare "#123" in the Issue Number section. We capture the issue number.+# GitHub auto-linking keywords: close, closes, closed, fix, fixes, fixed,+# resolve, resolves, resolved (case-insensitive).+ISSUE_REF_RE = re.compile(+ r"(?i)(?:fix|clos|resolv)(?:e?(?:s|d)?|ing)?\s+#(\d+)"+)+BARE_ISSUE_REF_RE = re.compile(r"(?<!\w)#(\d+)")++READY_FOR_DEV_LABEL = "ready-for-dev"+BUG_LABEL = "bug"+ENHANCEMENT_LABEL = "enhancement"++# PR Type checkboxes in the `## Type` section. We capture which type the author+# checked so we can cross-check it against the linked issue's labels.+PR_TYPE_BUG_RE = re.compile(+ r"(?im)^\s*[-*]\s*\[(?P<box>[ xX])\]\s*Bug fix"+)+PR_TYPE_FEATURE_RE = re.compile(+ r"(?im)^\s*[-*]\s*\[(?P<box>[ xX])\]\s*Feature"+)+# Markdown image: MARKDOWN_IMAGE_RE = re.compile(r"!\[[^\]]*\]\([^)]+\)")# HTML <img ...> and <video ...> tags.@@ -184,6 +216,163 @@ def validate_frontend_screenshot(body: str, files: list[str]) -> list[str]:]+def validate_bug_fix_evidence(body: str) -> list[str]:+ """Require reproduction evidence when the PR is marked as a Bug fix.++ A bug-fix PR must include a screenshot or video showing the bug reproduced+ and then fixed. This applies regardless of whether frontend code was touched+ β a terminal screenshot showing the error before and the fix after is just+ as valid as a UI screenshot.+ """+ pr_type = extract_pr_type(body)+ if pr_type != BUG_LABEL:+ return []+ if has_screenshot_or_video(body):+ return []+ return [+ "This PR is marked as a Bug fix but the description has no screenshot or "+ "video. Add reproduction evidence under `## Video/Screenshots` showing the "+ "bug before the fix and the result after (drag a file into the editor or "+ "paste a video link)."+ ]+++def extract_linked_issue_numbers(body: str) -> list[int]:+ """Return issue numbers referenced in the PR body.++ Looks for GitHub auto-close keywords (`Fixes #N`, `Closes #N`,+ `Resolves #N`) anywhere in the body, plus bare `#N` references inside the+ `## Issue Number` section.+ """+ numbers: list[int] = []+ seen: set[int] = set()++ for match in ISSUE_REF_RE.finditer(body):+ number = int(match.group(1))+ if number not in seen:+ numbers.append(number)+ seen.add(number)++ sections = extract_sections(body)+ issue_section = sections.get("Issue Number", "")+ if visible_text(issue_section):+ for match in BARE_ISSUE_REF_RE.finditer(issue_section):+ number = int(match.group(1))+ if number not in seen:+ numbers.append(number)+ seen.add(number)++ return numbers+++def extract_pr_type(body: str) -> str | None:+ """Return the checked PR type from the `## Type` section.++ Returns "bug" if the "Bug fix" checkbox is checked, "enhancement" if the+ "Feature" checkbox is checked, or None if neither is checked or the section+ is absent.+ """+ bug_match = PR_TYPE_BUG_RE.search(body)+ if bug_match and bug_match.group("box").strip().lower() == "x":+ return BUG_LABEL+ feature_match = PR_TYPE_FEATURE_RE.search(body)+ if feature_match and feature_match.group("box").strip().lower() == "x":+ return ENHANCEMENT_LABEL+ return None+++def fetch_issue_labels(repo: str, issue_number: int, token: str) -> list[str]:+ """Fetch label names for an issue via the GitHub REST API."""+ import urllib.request++ url = f"https://api.github.com/repos/{repo}/issues/{issue_number}/labels"+ req = urllib.request.Request(+ url,+ headers={+ "Authorization": f"Bearer {token}",+ "Accept": "application/vnd.github+json",+ },+ )+ with urllib.request.urlopen(req) as resp: # noqa: S310 - trusted HTTPS API+ data = json.loads(resp.read().decode())+ return [label["name"] for label in data if isinstance(label, dict)]+++def validate_linked_issue_ready(+ body: str, repo: str | None = None, token: str | None = None+) -> list[str]:+ """Require a linked issue carrying the `ready-for-dev` label.++ Also cross-checks the PR's Type checkbox against the linked issue's labels:+ a "Bug fix" PR must link an issue with the `bug` label, and a "Feature" PR+ must link one with the `enhancement` label.++ When `repo` and `token` are not provided (local `--body-file` mode), only+ checks that the body references at least one issue β the API lookup is+ skipped.+ """+ errors: list[str] = []++ numbers = extract_linked_issue_numbers(body)+ if not numbers:+ errors.append(+ "Link an issue in the `## Issue Number` section (e.g. `Fixes #123`). "+ "The issue must carry the `ready-for-dev` label."+ )+ return errors++ if not repo or not token:+ return errors++ import urllib.error++ pr_type = extract_pr_type(body)++ checked: list[int] = []+ found_ready = False+ found_type_match = False++ for number in numbers:+ try:+ labels = fetch_issue_labels(repo, number, token)+ except urllib.error.HTTPError as exc:+ if exc.code == 404:+ continue+ raise+ checked.append(number)++ if READY_FOR_DEV_LABEL in labels:+ found_ready = True++ if pr_type and pr_type in [label.lower() for label in labels]:+ found_type_match = True++ if not found_ready:+ if checked:+ ref = ", ".join(f"#{n}" for n in checked)+ errors.append(+ f"None of the linked issues ({ref}) carry the `ready-for-dev` label. "+ "The issue must meet the type-specific readiness criteria before a PR "+ "can be opened against it."+ )+ else:+ errors.append(+ f"Referenced issue(s) {', '.join(f'#{n}' for n in numbers)} could not "+ "be found in this repository. Link an issue in this repo."+ )++ if pr_type and not found_type_match and checked:+ type_name = "bug" if pr_type == BUG_LABEL else "enhancement"+ ref = ", ".join(f"#{n}" for n in checked)+ errors.append(+ f"This PR is marked as `{type_name}` but none of the linked issues "+ f"({ref}) carry the `{pr_type}` label. Ensure the linked issue has the "+ f"correct type label (`{pr_type}`)."+ )++ return errors++def validate_pr_body(body: str, files: list[str] | None = None) -> list[str]:errors: list[str] = []@@ -206,6 +395,7 @@ def validate_pr_body(body: str, files: list[str] | None = None) -> list[str]:errors.extend(validate_human_tested_checkbox(body))errors.extend(validate_frontend_screenshot(body, files or []))+ errors.extend(validate_bug_fix_evidence(body))return errors@@ -313,6 +503,15 @@ def main() -> int:files = []errors = validate_pr_body(body, files)++ repo = None+ token = os.environ.get("GITHUB_TOKEN")+ if args.event_path is not None and args.body_file is None:+ payload = json.loads(args.event_path.read_text())+ repo = payload.get("repository", {}).get("full_name")++ errors.extend(validate_linked_issue_ready(body, repo, token))+for error in errors:print(f"::error::{error}")diff --git a/.github/scripts/post-readiness-comment.mjs b/.github/scripts/post-readiness-comment.mjsnew file mode 100644index 0000000000..02562d72f6--- /dev/null+++ b/.github/scripts/post-readiness-comment.mjs@@ -0,0 +1,184 @@+#!/usr/bin/env node++/**+ * Post (or update) a `ready-for-dev` readiness comment on an issue.+ *+ * Upserts by a hidden HTML marker so repeated runs update the same comment+ * instead of spamming duplicates. Uses the GITHUB_TOKEN available to the+ * workflow via the GH_TOKEN env var.+ *+ * Usage:+ * node post-readiness-comment.mjs \+ * --issue-number 123 \+ * --repo OpenHands/OpenHands \+ * --reasons-file /tmp/reasons.txt \+ * --ready # optional: post a "ready" message instead of "not ready"+ */++import { readFileSync } from "node:fs";++const MARKER = "<!-- issue-readiness-check -->";+const API_ROOT = process.env.GITHUB_API_URL ?? "https://api.github.com";++function parseArgs(argv) {+ const args = {};+ for (let i = 0; i < argv.length; i += 1) {+ const arg = argv[i];+ if (!arg.startsWith("--")) continue;+ const [rawKey, inlineValue] = arg.slice(2).split("=", 2);+ const key = rawKey.replaceAll("-", "_");+ if (inlineValue !== undefined) {+ args[key] = inlineValue;+ continue;+ }+ const next = argv[i + 1];+ if (next && !next.startsWith("--")) {+ args[key] = next;+ i += 1;+ } else {+ args[key] = "";+ }+ }+ return args;+}++function requireValue(name, value) {+ if (!value) throw new Error(`Missing required value: ${name}`);+ return value;+}++async function listComments(repo, issueNumber, token) {+ // Paginate through all comments so the marker is found even on issues+ // with >100 comments.+ const all = [];+ let page = 1;+ while (true) {+ const url = `${API_ROOT}/repos/${repo}/issues/${issueNumber}/comments?per_page=100&page=${page}`;+ const resp = await fetch(url, {+ headers: {+ Authorization: `Bearer ${token}`,+ Accept: "application/vnd.github+json",+ "X-GitHub-Api-Version": "2022-11-28",+ },+ });+ if (!resp.ok) {+ throw new Error(`Failed to list comments: ${resp.status} ${await resp.text()}`);+ }+ const batch = await resp.json();+ all.push(...batch);+ if (batch.length < 100) break;+ page += 1;+ }+ return all;+}++async function createComment(repo, issueNumber, body, token) {+ const url = `${API_ROOT}/repos/${repo}/issues/${issueNumber}/comments`;+ const resp = await fetch(url, {+ method: "POST",+ headers: {+ Authorization: `Bearer ${token}`,+ Accept: "application/vnd.github+json",+ "X-GitHub-Api-Version": "2022-11-28",+ "Content-Type": "application/json",+ },+ body: JSON.stringify({ body }),+ });+ if (!resp.ok) {+ throw new Error(`Failed to create comment: ${resp.status} ${await resp.text()}`);+ }+ return resp.json();+}++async function updateComment(repo, commentId, body, token) {+ const url = `${API_ROOT}/repos/${repo}/issues/comments/${commentId}`;+ const resp = await fetch(url, {+ method: "PATCH",+ headers: {+ Authorization: `Bearer ${token}`,+ Accept: "application/vnd.github+json",+ "X-GitHub-Api-Version": "2022-11-28",+ "Content-Type": "application/json",+ },+ body: JSON.stringify({ body }),+ });+ if (!resp.ok) {+ throw new Error(`Failed to update comment: ${resp.status} ${await resp.text()}`);+ }+ return resp.json();+}++async function main() {+ const args = parseArgs(process.argv.slice(2));+ const issueNumber = requireValue("issue-number", args.issue_number);+ const repo = requireValue("repo", args.repo);+ const token = process.env.GH_TOKEN;+ if (!token) throw new Error("GH_TOKEN env var is required");++ const isReady = args.ready === "" || args.ready === "true";+ const reasonsFile = args.reasons_file || args.reasons;+ const reasons = reasonsFile+ ? readFileSync(reasonsFile, "utf8")+ .split("\n")+ .map((line) => line.trim())+ .filter(Boolean)+ : [];++ const reasonList = reasons.length+ ? reasons.map((r) => `- ${r}`).join("\n")+ : "- The issue does not meet the ready-for-dev criteria.";++ const body = isReady+ ? [+ MARKER,+ "### β `ready-for-dev` label applied",+ "",+ "This issue meets the readiness criteria and is ready for contribution.",+ "A contributor can now open a PR that links this issue (`Fixes #<number>`).",+ "",+ "_This is an automated check β no AI was used to generate this comment._",+ ].join("\n")+ : [+ MARKER,+ "### β οΈ Not yet `ready-for-dev`",+ "",+ "This issue does not yet meet the readiness criteria, so the",+ "`ready-for-dev` label has not been applied (or has been removed).",+ "The criteria are type-specific:",+ "",+ "**Bug reports** (`bug` label):",+ "- The `### Actual Behavior` section must reference a supported run method",+ " (`agent-canvas`, `npm run`, or `app.all-hands.dev/canvas`) **and** include",+ " a screenshot or video of the bug.",+ "- An `### Acceptance Criteria` section with at least one checklist item (`- [ ] β¦`).",+ "",+ "**Enhancements** (`enhancement` label):",+ "- A `### Desired Behavior` section.",+ "- An `### Acceptance Criteria` section with at least one checklist item.",+ "",+ "What is missing:",+ "",+ reasonList,+ "",+ "Edit the issue to address the gaps and the `ready-for-dev` label will be",+ "applied automatically.",+ "",+ "_This is an automated check β no AI was used to generate this comment._",+ ].join("\n");++ const comments = await listComments(repo, issueNumber, token);+ const existing = comments.find((comment) => comment.body?.includes(MARKER));++ if (existing) {+ await updateComment(repo, existing.id, body, token);+ console.log(`Updated readiness comment ${existing.id} on issue #${issueNumber}`);+ } else {+ const created = await createComment(repo, issueNumber, body, token);+ console.log(`Created readiness comment ${created.id} on issue #${issueNumber}`);+ }+}++main().catch((error) => {+ console.error(error);+ process.exit(1);+});diff --git a/.github/scripts/tests/__init__.py b/.github/scripts/tests/__init__.pynew file mode 100644index 0000000000..e69de29bb2diff --git a/.github/scripts/tests/test_issue_readiness.py b/.github/scripts/tests/test_issue_readiness.pynew file mode 100644index 0000000000..51b5bcfd94--- /dev/null+++ b/.github/scripts/tests/test_issue_readiness.py@@ -0,0 +1,229 @@+"""Tests for check_issue_readiness.py β the ready-for-dev gate logic."""++import sys+from pathlib import Path++# Make the sibling script importable.+sys.path.insert(0, str(Path(__file__).resolve().parent.parent))++from check_issue_readiness import (+ evaluate_readiness,+ extract_sections,+ has_screenshot_or_video,+ references_run_method,+ has_checklist_item,+ visible_text,+ BUG_LABEL,+ ENHANCEMENT_LABEL,+)++# ---------------------------------------------------------------------------+# Helper builders+# ---------------------------------------------------------------------------++BUG_BODY_READY = """### Actual Behavior+I ran `npm run dev` and saw this:++++The button was misaligned.++### Expected Behavior+The button should be centered.++### Acceptance Criteria+- [ ] Button is centered+- [ ] No layout shift on resize+"""++BUG_BODY_NO_RUN_METHOD = """### Actual Behavior+The button was misaligned.++### Acceptance Criteria+- [ ] Button is centered+"""++BUG_BODY_NO_SCREENSHOT = """### Actual Behavior+I ran `npm run dev` and saw the button was misaligned.++### Acceptance Criteria+- [ ] Button is centered+"""++BUG_BODY_NO_ACCEPTANCE = """### Actual Behavior+I ran `npm run dev` and saw this:+++"""++BUG_BODY_EMPTY_ACTUAL = """### Actual Behavior+_No response_++### Acceptance Criteria+- [ ] Button is centered+"""++BUG_BODY_AGENT_CANVAS = """### Actual Behavior+I used agent-canvas to reproduce this.++++### Acceptance Criteria+- [ ] Fixed+"""++BUG_BODY_HOSTED_URL = """### Actual Behavior+Reproduced on app.all-hands.dev/canvas β see video below.++<video src="https://example.com/bug.mp4"></video>++### Acceptance Criteria+- [ ] Fixed+"""++ENHANCEMENT_BODY_READY = """### Desired Behavior+The button should animate on hover.++### Acceptance Criteria+- [ ] Hover animation works+- [ ] No perf regression+"""++ENHANCEMENT_BODY_NO_DESIRED = """### Acceptance Criteria+- [ ] Something+"""++ENHANCEMENT_BODY_NO_ACCEPTANCE = """### Desired Behavior+The button should animate on hover.+"""++ENHANCEMENT_BODY_PROSE_ACCEPTANCE = """### Desired Behavior+The button should animate on hover.++### Acceptance Criteria+Make it look nice.+"""+++# ---------------------------------------------------------------------------+# Bug readiness+# ---------------------------------------------------------------------------++def test_bug_ready_npm_run_screenshot():+ result = evaluate_readiness(BUG_BODY_READY, [BUG_LABEL])+ assert result.ready, result.reasons++def test_bug_ready_agent_canvas():+ result = evaluate_readiness(BUG_BODY_AGENT_CANVAS, [BUG_LABEL])+ assert result.ready, result.reasons++def test_bug_ready_hosted_url():+ result = evaluate_readiness(BUG_BODY_HOSTED_URL, [BUG_LABEL])+ assert result.ready, result.reasons++def test_bug_not_ready_no_run_method():+ result = evaluate_readiness(BUG_BODY_NO_RUN_METHOD, [BUG_LABEL])+ assert not result.ready+ assert any("run method" in r for r in result.reasons)++def test_bug_not_ready_no_screenshot():+ result = evaluate_readiness(BUG_BODY_NO_SCREENSHOT, [BUG_LABEL])+ assert not result.ready+ assert any("screenshot" in r for r in result.reasons)++def test_bug_not_ready_no_acceptance():+ result = evaluate_readiness(BUG_BODY_NO_ACCEPTANCE, [BUG_LABEL])+ assert not result.ready+ assert any("Acceptance Criteria" in r for r in result.reasons)++def test_bug_not_ready_empty_actual():+ result = evaluate_readiness(BUG_BODY_EMPTY_ACTUAL, [BUG_LABEL])+ assert not result.ready+ assert any("Actual Behavior" in r for r in result.reasons)+++# ---------------------------------------------------------------------------+# Enhancement readiness+# ---------------------------------------------------------------------------++def test_enhancement_ready():+ result = evaluate_readiness(ENHANCEMENT_BODY_READY, [ENHANCEMENT_LABEL])+ assert result.ready, result.reasons++def test_enhancement_not_ready_no_desired():+ result = evaluate_readiness(ENHANCEMENT_BODY_NO_DESIRED, [ENHANCEMENT_LABEL])+ assert not result.ready+ assert any("Desired Behavior" in r for r in result.reasons)++def test_enhancement_not_ready_no_acceptance():+ result = evaluate_readiness(ENHANCEMENT_BODY_NO_ACCEPTANCE, [ENHANCEMENT_LABEL])+ assert not result.ready+ assert any("Acceptance Criteria" in r for r in result.reasons)++def test_enhancement_not_ready_prose_acceptance():+ result = evaluate_readiness(ENHANCEMENT_BODY_PROSE_ACCEPTANCE, [ENHANCEMENT_LABEL])+ assert not result.ready+ assert any("checklist" in r for r in result.reasons)+++# ---------------------------------------------------------------------------+# No type label+# ---------------------------------------------------------------------------++def test_no_type_label_not_ready():+ result = evaluate_readiness("### Something\nSome text", ["frontend"])+ assert not result.ready+ assert any("neither" in r.lower() for r in result.reasons)+++# ---------------------------------------------------------------------------+# Unit-level helpers+# ---------------------------------------------------------------------------++def test_has_screenshot_markdown_image():+ assert has_screenshot_or_video("")++def test_has_screenshot_github_attachment():+ assert has_screenshot_or_video("https://github.com/user-attachments/assets/abc123")++def test_has_screenshot_html_video():+ assert has_screenshot_or_video('<video src="bug.mp4"></video>')++def test_has_screenshot_youtube():+ assert has_screenshot_or_video("https://youtube.com/watch?v=abc123")++def test_has_screenshot_none():+ assert not has_screenshot_or_video("Just text, no media")++def test_references_run_method_npm():+ assert references_run_method("I ran npm run dev")++def test_references_run_method_agent_canvas():+ assert references_run_method("Used agent-canvas to test")++def test_references_run_method_hosted():+ assert references_run_method("Reproduced on app.all-hands.dev/canvas")++def test_references_run_method_none():+ assert not references_run_method("I clicked the button")++def test_has_checklist_item():+ assert has_checklist_item("- [ ] Do something")+ assert has_checklist_item("- [x] Done")+ assert has_checklist_item(" * [ ] Indented")++def test_has_checklist_item_none():+ assert not has_checklist_item("Just prose, no checklist")++def test_visible_text_strips_html_comments():+ assert visible_text("<!-- hidden -->visible text") == "visible text"++def test_visible_text_no_response():+ assert visible_text("_No response_") == ""++def test_extract_sections():+ sections = extract_sections("### Title One\nText 1\n### Title Two\nText 2")+ assert "title one" in sections+ assert "title two" in sections+ assert "Text 1" in sections["title one"]+ assert "Text 2" in sections["title two"]diff --git a/.github/scripts/tests/test_pr_description.py b/.github/scripts/tests/test_pr_description.pynew file mode 100644index 0000000000..dcb4cda38e--- /dev/null+++ b/.github/scripts/tests/test_pr_description.py@@ -0,0 +1,224 @@+"""Tests for check_pr_description.py β PR description validation logic."""++import sys+import urllib.error+from pathlib import Path+from unittest.mock import patch++sys.path.insert(0, str(Path(__file__).resolve().parent.parent))++from check_pr_description import (+ extract_linked_issue_numbers,+ extract_pr_type,+ validate_linked_issue_ready,+ validate_bug_fix_evidence,+ BUG_LABEL,+ ENHANCEMENT_LABEL,+ READY_FOR_DEV_LABEL,+)++# ---------------------------------------------------------------------------+# extract_linked_issue_numbers+# ---------------------------------------------------------------------------++def test_extract_fixes():+ assert extract_linked_issue_numbers("## Issue Number\n\nFixes #123\n") == [123]++def test_extract_fix_singular():+ assert extract_linked_issue_numbers("## Issue Number\n\nFix #123\n") == [123]++def test_extract_closes():+ assert extract_linked_issue_numbers("## Issue Number\n\nCloses #456\n") == [456]++def test_extract_close_singular():+ assert extract_linked_issue_numbers("## Issue Number\n\nClose #456\n") == [456]++def test_extract_resolves():+ assert extract_linked_issue_numbers("## Issue Number\n\nResolves #789\n") == [789]++def test_extract_resolve_singular():+ assert extract_linked_issue_numbers("## Issue Number\n\nResolve #789\n") == [789]++def test_extract_bare_in_issue_section():+ assert extract_linked_issue_numbers("## Issue Number\n\n#42\n") == [42]++def test_extract_none_when_no_ref():+ assert extract_linked_issue_numbers("## Issue Number\n\nNo existing issue.\n") == []++def test_extract_multiple():+ assert extract_linked_issue_numbers("## Issue Number\n\nFixes #1 and Closes #2\n") == [1, 2]++def test_bare_outside_section_ignored():+ body = "Some text #99 here\n## Issue Number\n\nNo issue\n"+ assert extract_linked_issue_numbers(body) == []++def test_fixes_anywhere_in_body():+ body = "See Fixes #55 in the summary\n## Issue Number\n\n"+ assert extract_linked_issue_numbers(body) == [55]+++# ---------------------------------------------------------------------------+# validate_linked_issue_ready β local mode (no API)+# ---------------------------------------------------------------------------++def test_local_mode_has_issue_ref_no_errors():+ assert validate_linked_issue_ready("## Issue Number\n\nFixes #123\n") == []++def test_local_mode_no_issue_ref_errors():+ errors = validate_linked_issue_ready("## Issue Number\n\nNo issue\n")+ assert len(errors) == 1+ assert "Link an issue" in errors[0]+++# ---------------------------------------------------------------------------+# validate_linked_issue_ready β API mode (mocked)+# ---------------------------------------------------------------------------++def test_api_issue_has_ready_for_dev():+ with patch("check_pr_description.fetch_issue_labels", return_value=["enhancement", "ready-for-dev"]):+ errors = validate_linked_issue_ready("Fixes #123\n", "owner/repo", "fake-token")+ assert errors == []++def test_api_issue_missing_ready_for_dev():+ with patch("check_pr_description.fetch_issue_labels", return_value=["enhancement"]):+ errors = validate_linked_issue_ready("Fixes #123\n", "owner/repo", "fake-token")+ assert len(errors) == 1+ assert "ready-for-dev" in errors[0]++def test_api_one_of_multiple_has_ready_for_dev():+ labels_map = {123: ["bug"], 456: ["enhancement", "ready-for-dev"]}+ def mock_labels(repo, number, token):+ return labels_map.get(number, [])+ with patch("check_pr_description.fetch_issue_labels", side_effect=mock_labels):+ errors = validate_linked_issue_ready("Fixes #123 and Closes #456\n", "owner/repo", "fake-token")+ assert errors == []++def test_api_issue_404():+ with patch("check_pr_description.fetch_issue_labels", side_effect=urllib.error.HTTPError(None, 404, "Not Found", {}, None)):+ errors = validate_linked_issue_ready("Fixes #999\n", "owner/repo", "fake-token")+ assert len(errors) == 1+ assert "could not" in errors[0]+++# ---------------------------------------------------------------------------+# extract_pr_type+# ---------------------------------------------------------------------------++def test_pr_type_bug_checked():+ body = "## Type\n\n- [x] Bug fix\n- [ ] Feature\n"+ assert extract_pr_type(body) == BUG_LABEL++def test_pr_type_feature_checked():+ body = "## Type\n\n- [ ] Bug fix\n- [x] Feature\n"+ assert extract_pr_type(body) == ENHANCEMENT_LABEL++def test_pr_type_nothing_checked():+ body = "## Type\n\n- [ ] Bug fix\n- [ ] Feature\n"+ assert extract_pr_type(body) is None++def test_pr_type_no_section():+ body = "## Summary\n\nNo type section\n"+ assert extract_pr_type(body) is None+++# ---------------------------------------------------------------------------+# Type cross-check (mocked API)+# ---------------------------------------------------------------------------++def test_type_check_bug_pr_bug_issue_no_errors():+ body = "## Issue Number\n\nFixes #123\n\n## Type\n\n- [x] Bug fix\n- [ ] Feature\n"+ with patch("check_pr_description.fetch_issue_labels", return_value=["bug", "ready-for-dev"]):+ errors = validate_linked_issue_ready(body, "owner/repo", "fake-token")+ assert errors == []++def test_type_check_bug_pr_enhancement_issue_mismatch():+ body = "## Issue Number\n\nFixes #123\n\n## Type\n\n- [x] Bug fix\n- [ ] Feature\n"+ with patch("check_pr_description.fetch_issue_labels", return_value=["enhancement", "ready-for-dev"]):+ errors = validate_linked_issue_ready(body, "owner/repo", "fake-token")+ assert any("bug" in e for e in errors)++def test_type_check_feature_pr_enhancement_issue_no_errors():+ body = "## Issue Number\n\nFixes #123\n\n## Type\n\n- [ ] Bug fix\n- [x] Feature\n"+ with patch("check_pr_description.fetch_issue_labels", return_value=["enhancement", "ready-for-dev"]):+ errors = validate_linked_issue_ready(body, "owner/repo", "fake-token")+ assert errors == []++def test_type_check_feature_pr_bug_issue_mismatch():+ body = "## Issue Number\n\nFixes #123\n\n## Type\n\n- [ ] Bug fix\n- [x] Feature\n"+ with patch("check_pr_description.fetch_issue_labels", return_value=["bug", "ready-for-dev"]):+ errors = validate_linked_issue_ready(body, "owner/repo", "fake-token")+ assert any("enhancement" in e for e in errors)++def test_type_check_no_type_checked_no_type_error():+ body = "## Issue Number\n\nFixes #123\n"+ with patch("check_pr_description.fetch_issue_labels", return_value=["ready-for-dev"]):+ errors = validate_linked_issue_ready(body, "owner/repo", "fake-token")+ assert errors == []+++# ---------------------------------------------------------------------------+# validate_bug_fix_evidence+# ---------------------------------------------------------------------------++BUG_FIX_BODY_NO_EVIDENCE = """## Type++- [x] Bug fix+- [ ] Feature+"""++BUG_FIX_BODY_WITH_SCREENSHOT = """## Type++- [x] Bug fix+- [ ] Feature++## Video/Screenshots++ β +"""++FEATURE_BODY = """## Type++- [ ] Bug fix+- [x] Feature+"""++def test_bug_fix_no_screenshot_errors():+ errors = validate_bug_fix_evidence(BUG_FIX_BODY_NO_EVIDENCE)+ assert len(errors) == 1+ assert "reproduction evidence" in errors[0].lower()++def test_bug_fix_with_screenshot_no_errors():+ errors = validate_bug_fix_evidence(BUG_FIX_BODY_WITH_SCREENSHOT)+ assert errors == []++def test_feature_no_bug_evidence_check():+ errors = validate_bug_fix_evidence(FEATURE_BODY)+ assert errors == []++def test_no_type_no_bug_evidence_check():+ errors = validate_bug_fix_evidence("## Summary\n\nNo type\n")+ assert errors == []++def test_bug_fix_with_github_attachment_no_errors():+ body = """## Type++- [x] Bug fix++## Video/Screenshots++https://github.com/user-attachments/assets/abc123+"""+ errors = validate_bug_fix_evidence(body)+ assert errors == []++def test_bug_fix_with_video_link_no_errors():+ body = """## Type++- [x] Bug fix++## Video/Screenshots++https://youtube.com/watch?v=abc123+"""+ errors = validate_bug_fix_evidence(body)+ assert errors == []diff --git a/.github/workflows/ci-script-tests.yml b/.github/workflows/ci-script-tests.ymlnew file mode 100644index 0000000000..037a712121--- /dev/null+++ b/.github/workflows/ci-script-tests.yml@@ -0,0 +1,37 @@+---+name: CI Script Tests++# Runs the pytest suite for .github/scripts/ β the Python checkers that power+# the issue-readiness and PR-description gates. This catches regressions in the+# checking logic whenever those scripts are modified.++on:+ pull_request:+ paths:+ - ".github/scripts/**"+ - ".github/workflows/ci-script-tests.yml"+ push:+ branches: [main]+ paths:+ - ".github/scripts/**"+ - ".github/workflows/ci-script-tests.yml"++permissions:+ contents: read++jobs:+ test:+ runs-on: ubuntu-24.04+ timeout-minutes: 5+ steps:+ - uses: actions/checkout@v7++ - uses: actions/setup-python@v6+ with:+ python-version: "3.13"++ - name: Install pytest+ run: pip install pytest++ - name: Run script tests+ run: python -m pytest .github/scripts/tests/ -vdiff --git a/.github/workflows/issue-readiness-check.yml b/.github/workflows/issue-readiness-check.ymlnew file mode 100644index 0000000000..3ab803794d--- /dev/null+++ b/.github/workflows/issue-readiness-check.yml@@ -0,0 +1,108 @@+---+name: Issue Readiness Check++# Manages the `ready-for-dev` label based on type-specific readiness criteria.+#+# Bug reports (label `bug`): the Actual Behavior section must reference a+# supported run method (`agent-canvas`, `npm run`, or+# `app.all-hands.dev/canvas`) and embed a screenshot or video, plus an+# Acceptance Criteria section with at least one checklist item.+#+# Enhancements (label `enhancement`): the body must contain Desired Behavior and+# Acceptance Criteria sections, the latter with at least one checklist item.+#+# When criteria are met the label is added (idempotently); when they are not the+# label is removed. A feedback comment is posted (or updated) in three cases:+# 1. The issue is first opened or reopened β always comment so the author+# knows whether their issue is ready or what is missing.+# 2. The label is being added (issue became ready) β comment celebrating it.+# 3. The label is being removed (issue was ready but is no longer) β comment+# explaining what changed.+# Edits that do not change the label state do not produce a new comment. All+# comments are upserted by a hidden marker so there is at most one per issue.++on:+ issues:+ types: [opened, edited, reopened, labeled, unlabeled]++permissions:+ issues: write+ contents: read++concurrency:+ group: issue-readiness-${{ github.event.issue.number }}+ cancel-in-progress: false++jobs:+ check:+ if: github.event.issue.state == 'open' && github.event.issue.pull_request == null+ runs-on: ubuntu-24.04+ timeout-minutes: 5+ steps:+ - name: Checkout trusted workflow scripts+ uses: actions/checkout@v7++ - name: Evaluate issue readiness+ id: readiness+ env:+ GITHUB_EVENT_PATH: ${{ github.event_path }}+ run: |+ set -euo pipefail+ python .github/scripts/check_issue_readiness.py --json > /tmp/result.json+ echo "ready=$(jq -r '.ready' /tmp/result.json)" >> "$GITHUB_OUTPUT"+ # Write reasons to a file so the comment step can read them+ # without shell-escaping multiline text.+ jq -r '.reasons[]?' /tmp/result.json > /tmp/reasons.txt || true+ echo "reasons_file=/tmp/reasons.txt" >> "$GITHUB_OUTPUT"++ - name: Add ready-for-dev label+ if: steps.readiness.outputs.ready == 'true'+ env:+ GH_TOKEN: ${{ github.token }}+ run: |+ set -euo pipefail+ # Capture stderr β tolerate "label already present" (exit 0+ # from gh) but surface unexpected errors to the step summary.+ if ! gh issue edit "${{ github.event.issue.number }}" \+ --repo "${{ github.repository }}" \+ --add-label "ready-for-dev" 2>/tmp/gh-err.txt; then+ echo "::warning::Failed to add ready-for-dev label:" >> "$GITHUB_STEP_SUMMARY"+ cat /tmp/gh-err.txt >> "$GITHUB_STEP_SUMMARY"+ fi++ - name: Remove ready-for-dev label+ if: steps.readiness.outputs.ready != 'true' && contains(github.event.issue.labels.*.name, 'ready-for-dev')+ env:+ GH_TOKEN: ${{ github.token }}+ run: |+ set -euo pipefail+ # Capture stderr β tolerate "label already removed" but+ # surface unexpected errors.+ if ! gh issue edit "${{ github.event.issue.number }}" \+ --repo "${{ github.repository }}" \+ --remove-label "ready-for-dev" 2>/tmp/gh-err.txt; then+ echo "::warning::Failed to remove ready-for-dev label:" >> "$GITHUB_STEP_SUMMARY"+ cat /tmp/gh-err.txt >> "$GITHUB_STEP_SUMMARY"+ fi++ - name: Post feedback comment+ if: >-+ github.event.action == 'opened'+ || github.event.action == 'reopened'+ || (steps.readiness.outputs.ready == 'true' && !contains(github.event.issue.labels.*.name, 'ready-for-dev'))+ || (steps.readiness.outputs.ready != 'true' && contains(github.event.issue.labels.*.name, 'ready-for-dev'))+ env:+ GH_TOKEN: ${{ github.token }}+ run: |+ set -euo pipefail+ if [ "${{ steps.readiness.outputs.ready }}" = "true" ]; then+ node .github/scripts/post-readiness-comment.mjs \+ --issue-number "${{ github.event.issue.number }}" \+ --repo "${{ github.repository }}" \+ --ready+ else+ node .github/scripts/post-readiness-comment.mjs \+ --issue-number "${{ github.event.issue.number }}" \+ --repo "${{ github.repository }}" \+ --reasons-file "${{ steps.readiness.outputs.reasons_file }}"+ fidiff --git a/.github/workflows/pr-description-check.yml b/.github/workflows/pr-description-check.ymlindex fb0647b7ad..700f241741 100644--- a/.github/workflows/pr-description-check.yml+++ b/.github/workflows/pr-description-check.yml@@ -11,6 +11,7 @@ on:permissions:contents: readpull-requests: read+ issues: readjobs:validate-pr-description:@@ -38,7 +39,7 @@ jobs:--paginate --jq '.[].filename' > pr-files.txtecho "count=$(wc -l < pr-files.txt)" >> "$GITHUB_OUTPUT"- - name: Validate HUMAN note, PR template, and frontend evidence+ - name: Validate HUMAN note, PR template, frontend evidence, and linked-issue readinessenv:GITHUB_TOKEN: ${{ github.token }}run: python .github/scripts/check_pr_description.py --files-file pr-files.txt