Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b193aaf8f7 | |||
| a4ab3ef27e | |||
| db0a73dda7 | |||
| f0fb098451 | |||
| 6e67975eca | |||
| 85358bbe4a |
+15
-1
@@ -1,3 +1,17 @@
|
|||||||
{
|
{
|
||||||
"permissionMode": "bypass"
|
"permissionMode": "bypass",
|
||||||
|
"permissions": {
|
||||||
|
"allow": [
|
||||||
|
"Bash(git *)",
|
||||||
|
"Bash(python scripts/agent_poller.py *)",
|
||||||
|
"Bash(python scripts/run_pipeline.py *)",
|
||||||
|
"Bash(python scripts/create_failure_issue.py *)",
|
||||||
|
"Bash(python -m pytest *)",
|
||||||
|
"Bash(python -c *)",
|
||||||
|
"Bash(curl *)"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -225,6 +225,10 @@ QE-Agent 开 Issue (qe-feedback / bug / ci-failure)
|
|||||||
验证不通过 → 重新分析根因 → 回到开发
|
验证不通过 → 重新分析根因 → 回到开发
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 关键约束
|
||||||
|
|
||||||
|
1. **任何对 git 管理内容的修改必须走完整流程**:开 Issue → 改动 → 提交 PR → CI 通过 → merge → close Issue。无论是自主轮询还是与用户互动触发的改动,一律遵守此规则。绝不直接改文件而不走 Issue 流程。
|
||||||
|
|
||||||
## 提交规范
|
## 提交规范
|
||||||
|
|
||||||
- **格式**:`fix: <简短描述> - Closes #N` 或 `feat: <描述> - Closes #N`
|
- **格式**:`fix: <简短描述> - Closes #N` 或 `feat: <描述> - Closes #N`
|
||||||
|
|||||||
+7
-6
@@ -303,12 +303,13 @@ QE-Agent 领取 (step 1-2)
|
|||||||
|
|
||||||
## 关键约束
|
## 关键约束
|
||||||
|
|
||||||
1. **只修改 `tests/acceptance/`** — 不碰应用代码、不碰 `skills/`、不碰 `scripts/`(除非是修复 agent_poller 或 create_failure_issue)
|
1. **任何对 git 管理内容的修改必须走完整流程**:开 Issue → 改动 → 提交 PR → CI 通过 → merge → close Issue。无论是自主轮询还是与用户互动触发的改动,一律遵守此规则。绝不直接改文件而不走 Issue 流程。
|
||||||
2. **不碰 `tests/unit/`、`tests/integration/`** — 那是开发团队维护的
|
2. **只修改 `tests/acceptance/`** — 不碰应用代码、不碰 `skills/`、不碰 `scripts/`(除非是修复 agent_poller 或 create_failure_issue)
|
||||||
3. **每次只处理一个 issue** — 不混入多个 issue 的改动
|
3. **不碰 `tests/unit/`、`tests/integration/`** — 那是开发团队维护的
|
||||||
4. **`Closes #<N>` 必须出现在 commit message 中**
|
4. **每次只处理一个 issue** — 不混入多个 issue 的改动
|
||||||
5. **本地验证必须通过再 push** — 至少 Layer A + Layer B
|
5. **`Closes #<N>` 必须出现在 commit message 中**
|
||||||
6. **如果 Layer C(QE Audit)需要验证但 API 不可用** — 在 issue 下评论注明,标记 `--run-acceptance` 通过后 merge
|
6. **本地验证必须通过再 push** — 至少 Layer A + Layer B
|
||||||
|
7. **如果 Layer C(QE Audit)需要验证但 API 不可用** — 在 issue 下评论注明,标记 `--run-acceptance` 通过后 merge
|
||||||
|
|
||||||
## Session 收尾
|
## Session 收尾
|
||||||
|
|
||||||
|
|||||||
+31
-19
@@ -74,11 +74,34 @@ def list_issues(labels: list[str] | None = None):
|
|||||||
return issues
|
return issues
|
||||||
|
|
||||||
|
|
||||||
|
def _get_blocking_refs(issue_num: int) -> set[int]:
|
||||||
|
"""Extract all issue references from an issue body + comments.
|
||||||
|
|
||||||
|
Scans both the issue body and all comments for #N patterns,
|
||||||
|
returning a set of referenced issue numbers.
|
||||||
|
"""
|
||||||
|
refs: set[int] = set()
|
||||||
|
# Body
|
||||||
|
issue = _req("GET", f"/issues/{issue_num}")
|
||||||
|
body = issue.get("body", "") or ""
|
||||||
|
refs.update(int(m.group(1)) for m in re.finditer(r'#(\d+)', body))
|
||||||
|
# Comments
|
||||||
|
try:
|
||||||
|
comments = _req("GET", f"/issues/{issue_num}/comments")
|
||||||
|
for c in comments:
|
||||||
|
cbody = c.get("body", "") or ""
|
||||||
|
refs.update(int(m.group(1)) for m in re.finditer(r'#(\d+)', cbody))
|
||||||
|
except SystemExit:
|
||||||
|
pass
|
||||||
|
return refs
|
||||||
|
|
||||||
|
|
||||||
def blocked_check():
|
def blocked_check():
|
||||||
"""Check all blocked issues: if blocking issues are now closed, unblock.
|
"""Check all blocked issues: if blocking issues are now closed, unblock.
|
||||||
|
|
||||||
Used by agents during polling to ensure blocked label doesn't persist
|
Scans issue body + comments for blocking references.
|
||||||
after blocking issues are resolved.
|
If no references found or all referenced issues are closed,
|
||||||
|
removes the 'blocked' label.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
all_blocked = _req("GET", "/issues?state=open&labels=blocked")
|
all_blocked = _req("GET", "/issues?state=open&labels=blocked")
|
||||||
@@ -92,13 +115,7 @@ def blocked_check():
|
|||||||
|
|
||||||
unblocked_count = 0
|
unblocked_count = 0
|
||||||
for issue in all_blocked:
|
for issue in all_blocked:
|
||||||
body = issue.get("body", "")
|
blocking_nums = _get_blocking_refs(issue["number"])
|
||||||
if not body:
|
|
||||||
continue
|
|
||||||
|
|
||||||
blocking_nums = {int(m.group(1)) for m in re.finditer(r'#(\d+)', body)}
|
|
||||||
if not blocking_nums:
|
|
||||||
continue
|
|
||||||
|
|
||||||
all_resolved = True
|
all_resolved = True
|
||||||
for blk in blocking_nums:
|
for blk in blocking_nums:
|
||||||
@@ -115,9 +132,9 @@ def blocked_check():
|
|||||||
new_label_names = [l for l in current_label_names if l != "blocked"]
|
new_label_names = [l for l in current_label_names if l != "blocked"]
|
||||||
new_label_ids = _label_names_to_ids(new_label_names)
|
new_label_ids = _label_names_to_ids(new_label_names)
|
||||||
_req("PUT", f"/issues/{issue['number']}/labels", {"labels": new_label_ids})
|
_req("PUT", f"/issues/{issue['number']}/labels", {"labels": new_label_ids})
|
||||||
|
reason = "所有阻塞 Issue 均已关闭" if blocking_nums else "无阻塞引用,移除残留 blocked 标签"
|
||||||
print(f"Unblocked #{issue['number']}: {issue['title']}")
|
print(f"Unblocked #{issue['number']}: {issue['title']}")
|
||||||
comment_issue(issue["number"],
|
comment_issue(issue["number"], f"阻塞已解除:{reason}。")
|
||||||
f"阻塞已解除:所有阻塞 Issue 均已关闭。")
|
|
||||||
unblocked_count += 1
|
unblocked_count += 1
|
||||||
|
|
||||||
if unblocked_count == 0:
|
if unblocked_count == 0:
|
||||||
@@ -158,8 +175,8 @@ def close_issue(num, body=None):
|
|||||||
def _unblock_issues_blocked_by(closed_num):
|
def _unblock_issues_blocked_by(closed_num):
|
||||||
"""Check issues blocked by *closed_num* and unblock if all blockers resolved.
|
"""Check issues blocked by *closed_num* and unblock if all blockers resolved.
|
||||||
|
|
||||||
Finds open issues with 'blocked' label whose body references *closed_num*
|
Scans both body and comments for #N references. If *closed_num* appears
|
||||||
via a '阻塞: #N' pattern. If all referenced blocking issues are now closed,
|
in any blocked issue and all referenced issues are now closed,
|
||||||
removes the 'blocked' label and comments on the unblocked issue.
|
removes the 'blocked' label and comments on the unblocked issue.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
@@ -170,12 +187,7 @@ def _unblock_issues_blocked_by(closed_num):
|
|||||||
return
|
return
|
||||||
|
|
||||||
for issue in all_blocked:
|
for issue in all_blocked:
|
||||||
body = issue.get("body", "")
|
blocking_nums = _get_blocking_refs(issue["number"])
|
||||||
if not body:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Extract all issue numbers from the body (e.g. #21, #40)
|
|
||||||
blocking_nums = {int(m.group(1)) for m in re.finditer(r'#(\d+)', body)}
|
|
||||||
if closed_num not in blocking_nums:
|
if closed_num not in blocking_nums:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user