@ranger1/dx 0.1.37 → 0.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
Binary file
|
|
@@ -82,10 +82,7 @@ python3 ~/.opencode/agents/gh_review_harvest.py \
|
|
|
82
82
|
|
|
83
83
|
- 读取 `rawFile`(JSON)后,提取“建议/问题”并生成 findings:
|
|
84
84
|
- 覆盖 humans + bots(不做作者白名单)。
|
|
85
|
-
- 去噪:丢弃任何 body 中包含 `<!-- pr-review-loop-marker` 的内容。
|
|
86
85
|
- 忽略纯审批/无内容:如 `LGTM`、`Looks good`、`Approved` 等。
|
|
87
|
-
- 默认策略:
|
|
88
|
-
- `isResolved=true` 或 `isOutdated=true` 的 thread 在 harvest 阶段直接丢弃(不进入 rawFile,不消耗 LLM token)。
|
|
89
86
|
- 分类规则(大致):
|
|
90
87
|
- P0: 明确安全漏洞/数据泄漏/资金损失/远程执行
|
|
91
88
|
- P1: 逻辑 bug/权限绕过/会导致线上错误
|
|
@@ -16,6 +16,8 @@ from datetime import datetime, timezone
|
|
|
16
16
|
from pathlib import Path
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
MARKER_SUBSTR = "<!-- pr-review-loop-marker"
|
|
20
|
+
|
|
19
21
|
def _repo_root():
|
|
20
22
|
try:
|
|
21
23
|
p = subprocess.run(
|
|
@@ -61,6 +63,15 @@ def _run_capture(cmd):
|
|
|
61
63
|
return 127, "", str(e)
|
|
62
64
|
|
|
63
65
|
|
|
66
|
+
def _has_loop_marker(text):
|
|
67
|
+
if not text:
|
|
68
|
+
return False
|
|
69
|
+
try:
|
|
70
|
+
return MARKER_SUBSTR in str(text)
|
|
71
|
+
except Exception:
|
|
72
|
+
return False
|
|
73
|
+
|
|
74
|
+
|
|
64
75
|
def _require_gh_auth():
|
|
65
76
|
rc, out, err = _run_capture(["gh", "auth", "status"])
|
|
66
77
|
if rc == 127:
|
|
@@ -126,6 +137,10 @@ def _flatten_threads(gql_data):
|
|
|
126
137
|
comments_nodes = comments_conn.get("nodes") or []
|
|
127
138
|
comments = []
|
|
128
139
|
for c in comments_nodes:
|
|
140
|
+
body = (c or {}).get("body") or ""
|
|
141
|
+
body_text = (c or {}).get("bodyText") or ""
|
|
142
|
+
if _has_loop_marker(body) or _has_loop_marker(body_text):
|
|
143
|
+
continue
|
|
129
144
|
author = (c or {}).get("author") or {}
|
|
130
145
|
comments.append(
|
|
131
146
|
{
|
|
@@ -136,12 +151,15 @@ def _flatten_threads(gql_data):
|
|
|
136
151
|
"login": author.get("login"),
|
|
137
152
|
"type": author.get("__typename"),
|
|
138
153
|
},
|
|
139
|
-
"body":
|
|
140
|
-
"bodyText":
|
|
154
|
+
"body": body,
|
|
155
|
+
"bodyText": body_text,
|
|
141
156
|
"createdAt": (c or {}).get("createdAt"),
|
|
142
157
|
"updatedAt": (c or {}).get("updatedAt"),
|
|
143
158
|
}
|
|
144
159
|
)
|
|
160
|
+
|
|
161
|
+
if not comments:
|
|
162
|
+
continue
|
|
145
163
|
threads.append(
|
|
146
164
|
{
|
|
147
165
|
"id": (t or {}).get("id"),
|
|
@@ -244,6 +262,11 @@ def main(argv):
|
|
|
244
262
|
reviews = _gh_api_json([f"repos/{owner_repo}/pulls/{pr_number}/reviews", "--paginate"])
|
|
245
263
|
issue_comments = _gh_api_json([f"repos/{owner_repo}/issues/{pr_number}/comments", "--paginate"])
|
|
246
264
|
|
|
265
|
+
if isinstance(reviews, list):
|
|
266
|
+
reviews = [r for r in reviews if not _has_loop_marker((r or {}).get("body") or "")]
|
|
267
|
+
if isinstance(issue_comments, list):
|
|
268
|
+
issue_comments = [c for c in issue_comments if not _has_loop_marker((c or {}).get("body") or "")]
|
|
269
|
+
|
|
247
270
|
now = datetime.now(timezone.utc).isoformat()
|
|
248
271
|
payload = {
|
|
249
272
|
"repo": owner_repo,
|
|
@@ -67,7 +67,7 @@ agent: sisyphus
|
|
|
67
67
|
- `runId: <RUN_ID>`(来自 Step 1 的输出,必须透传,禁止自行生成)
|
|
68
68
|
- `contextFile: ./.cache/<file>.md`(来自 Step 1 的输出)
|
|
69
69
|
- reviewer 默认读 `contextFile`;必要时允许用 `git/gh` 只读命令拿 diff
|
|
70
|
-
- 忽略问题:1.格式化代码引起的噪音 2.已经lint检查以外的格式问题
|
|
70
|
+
- 忽略问题:1.格式化代码引起的噪音 2.已经lint检查以外的格式问题 3.忽略单元测试不足的问题
|
|
71
71
|
- 特别关注: 逻辑、安全、性能、可维护性
|
|
72
72
|
- 同时要注意 pr 前面轮次的 修复和讨论,对于已经拒绝、已修复的问题不要反复的提出
|
|
73
73
|
- 同时也要注意fix的过程中有没有引入新的问题。
|