Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions .github/scripts/issue_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,24 @@ def _section_text(body: str, start: int) -> str:
return "\n".join(lines[start + 1 : end])


def _without_fenced_code(text: str) -> str:
"""Remove Markdown fences so examples cannot satisfy issue requirements."""
kept: list[str] = []
fence: tuple[str, int] | None = None
for line in text.splitlines():
Comment thread
stranske marked this conversation as resolved.
match = re.match(r"\s{0,3}(`{3,}|~{3,})", line)
if match:
marker = match.group(1)
if fence is None:
fence = (marker[0], len(marker))
elif marker[0] == fence[0] and len(marker) >= fence[1]:
fence = None
Comment thread
stranske marked this conversation as resolved.
Outdated
continue
if fence is None:
kept.append(line)
return "\n".join(kept)
Comment thread
coderabbitai[bot] marked this conversation as resolved.


@dataclass
class Report:
ok: bool = True
Expand Down Expand Up @@ -247,7 +265,9 @@ def validate(body: str) -> Report:
tasks_at = _find(body, REQUIRED["Tasks"])
if tasks_at is not None:
task_items = re.findall(
r"^\s*[-*]\s*\[[ xX]\]\s*(.+)$", _section_text(body, tasks_at), re.M
r"^\s*[-*]\s*\[[ xX]\]\s*(.+)$",
_without_fenced_code(_section_text(body, tasks_at)),
re.M,
)
if not task_items:
report.problems.append(
Expand All @@ -260,7 +280,7 @@ def validate(body: str) -> Report:

acceptance_at = _find(body, REQUIRED["Acceptance Criteria"])
if acceptance_at is not None:
acceptance = _section_text(body, acceptance_at)
acceptance = _without_fenced_code(_section_text(body, acceptance_at))
if not GATE.search(acceptance):
report.problems.append(
"`Acceptance Criteria` names no test, runnable command or observable "
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/agents-63-issue-intake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ jobs:
)
)
) &&
!contains(github.event.issue.labels.*.name, 'agents:auto-pilot')
(github.event_name != 'issues' ||
!contains(github.event.issue.labels.*.name, 'agents:auto-pilot'))
name: Normalize workflow inputs
runs-on: ubuntu-latest
outputs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/agents-issue-optimizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ jobs:
- name: Release failed format lease
if: >-
(failure() || cancelled()) &&
steps.check.outputs.should_run == 'true' &&
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
(steps.check.outputs.phase == 'format' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.phase == 'format') ||
(github.event_name == 'issues' && github.event.label.name == 'agents:format'))
Expand Down
21 changes: 18 additions & 3 deletions scripts/langchain/issue_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ def _strip_reuse_marker(text: str) -> str:
VERIFY_HINT_REGEX = re.compile(r"\(verify:\s*([^\n)]+)\)", re.IGNORECASE)
SAFE_VERIFY_COMMAND_RE = re.compile(
r"^(?:"
r"(?:python(?:3)?\s+-m\s+)?pytest\b"
r"(?:python(?:3)?\s+-m\s+)?(?:pytest|unittest)\b"
r"|node\s+--test\b"
r"|(?:npm|pnpm|yarn)\s+(?:run\s+)?(?:test|vitest|jest|playwright)\b"
r"|(?:make|just|cargo|go|dotnet)\s+(?:test|check)\b"
r"|gh\s+(?:workflow\s+run|run)\b"
r"|gh\s+(?:workflow\s+run|run)\s+\S+"
Comment thread
stranske marked this conversation as resolved.
r"|curl\s+\S+"
r")",
re.IGNORECASE,
Expand Down Expand Up @@ -477,10 +477,25 @@ def _strip_original_issue_blocks(text: str) -> str:
kept.append(text[cursor : match.start()])
depth = 1
end = match.end()
fence: tuple[str, int] | None = None
for tag in _DETAILS_TAG_RE.finditer(text, match.end()):
# Literal HTML in the verbatim Original-Issue fence is content, not
# structural markup. Only count tags outside Markdown fences.
before = text[end : tag.start()]
for line in before.splitlines():
fence_match = re.match(r"\s{0,3}(`{3,}|~{3,})", line)
if not fence_match:
continue
marker = fence_match.group(1)
if fence is None:
fence = (marker[0], len(marker))
elif marker[0] == fence[0] and len(marker) >= fence[1]:
fence = None
end = tag.end()
if fence is not None:
continue
depth += -1 if tag.group(0).startswith("</") else 1
if depth == 0:
Comment thread
stranske marked this conversation as resolved.
end = tag.end()
break
else:
# Leave malformed markup intact rather than silently discarding it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ jobs:
(github.event.issue.state != 'closed' &&
(contains(toJson(github.event.issue.labels.*.name), 'agent:') ||
contains(toJson(github.event.issue.labels.*.name), 'agents:')))) &&
!contains(github.event.issue.labels.*.name, 'agents:auto-pilot')
(github.event_name != 'issues' ||
!contains(github.event.issue.labels.*.name, 'agents:auto-pilot'))
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.check.outputs.should_run }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ jobs:
- name: Release failed format lease
if: >-
(failure() || cancelled()) &&
steps.check.outputs.should_run == 'true' &&
(steps.check.outputs.phase == 'format' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.phase == 'format') ||
(github.event_name == 'issues' && github.event.label.name == 'agents:format'))
Expand Down
Loading