@plainconceptsplatform/workflows 0.6.1 → 0.16.2
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.
- package/README.md +107 -88
- package/dist/catalog-installation.d.ts +39 -2
- package/dist/catalog-installation.js +172 -109
- package/dist/index.js +128 -73
- package/dist/package-baseline.d.ts +25 -0
- package/dist/package-baseline.js +138 -0
- package/dist/route-processing.d.ts +0 -2
- package/dist/route-processing.js +22 -91
- package/dist/stack-defaults.js +18 -12
- package/dist/tui.js +27 -43
- package/dist/worker-env.d.ts +46 -0
- package/dist/worker-env.js +179 -0
- package/dist/workflow-catalog.d.ts +4 -2
- package/dist/workflow-catalog.js +5 -3
- package/loops/actions/add-issue-labels/action.yml +20 -0
- package/loops/actions/audit-close/action.yml +180 -128
- package/loops/actions/classify-route/classify-route.sh +8 -2
- package/loops/actions/housekeeping/action.yml +251 -0
- package/loops/actions/merge-agent-pr/action.yml +13 -0
- package/loops/actions/report-workflow-errors/action.yml +414 -0
- package/loops/actions/validate-merge-gate-output/validate-merge-gate-output.sh +13 -1
- package/loops/actions/validate-triage-output/action.yml +1 -1
- package/loops/actions/validate-triage-output/validate-triage-output.sh +9 -5
- package/loops/actions/verify-composite-actions/verify-composite-actions.sh +53 -0
- package/loops/actions/verify-route-matrix/verify-route-matrix.sh +911 -170
- package/loops/templates/agentics/agentics-error-report.yml +98 -0
- package/loops/templates/opencode/opencode.ci.json +1 -1
- package/loops/workflows/agent-apply-review.md +438 -469
- package/loops/workflows/agent-audit.md +200 -213
- package/loops/workflows/agent-implement.md +591 -640
- package/loops/workflows/agent-merge-gate.md +826 -844
- package/loops/workflows/agent-refine.md +590 -633
- package/loops/workflows/agent-release.md +244 -258
- package/loops/workflows/agent-triage.md +476 -447
- package/loops/workflows/authorize-bot-work.yml +26 -6
- package/loops/workflows/shared/platform-defaults.md +18 -1
- package/loops/workflows/work-router.yml +1185 -1038
- package/package.json +9 -8
- package/dist/action-validation.test.d.ts +0 -1
- package/dist/action-validation.test.js +0 -87
- package/dist/catalog-installation.test.d.ts +0 -1
- package/dist/catalog-installation.test.js +0 -485
- package/dist/catalog-listing.test.d.ts +0 -1
- package/dist/catalog-listing.test.js +0 -150
- package/dist/index.test.d.ts +0 -1
- package/dist/index.test.js +0 -273
- package/dist/repository-inspection.test.d.ts +0 -1
- package/dist/repository-inspection.test.js +0 -77
- package/dist/route-processing.test.d.ts +0 -1
- package/dist/route-processing.test.js +0 -283
- package/dist/stack-defaults.test.d.ts +0 -1
- package/dist/stack-defaults.test.js +0 -266
- package/dist/tui.test.d.ts +0 -1
- package/dist/tui.test.js +0 -249
- package/dist/workflow-catalog.test.d.ts +0 -1
- package/dist/workflow-catalog.test.js +0 -29
- package/loops/actions/stale-recovery/action.yml +0 -288
- package/loops/actions/update-changelog/action.yml +0 -113
|
@@ -1,469 +1,438 @@
|
|
|
1
|
-
---
|
|
2
|
-
# Managed by @plainconceptsplatform/workflows. Source: loops/workflows/agent-apply-review.md. Update with `workflows update --force`; consumer edits may be overwritten.
|
|
3
|
-
env:
|
|
4
|
-
# Printed by the prompt as the verification block. Consumers set their own commands.
|
|
5
|
-
VERIFY_COMMANDS: ""
|
|
6
|
-
REPO_RULES: "Apply only actionable outstanding reviewer feedback to the selected bot pull request. Make minimal changes that address each comment. Preserve architecture and do not weaken tests. Run full verification after changes."
|
|
7
|
-
WORKING_LABEL: bot-working
|
|
8
|
-
REVIEW_LABEL: review
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
description:
|
|
43
|
-
required:
|
|
44
|
-
type: string
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
- name:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
- name:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
token: ${{ steps.app-token.outputs.token }}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
- **
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
```mermaid
|
|
441
|
-
flowchart TD
|
|
442
|
-
fbStart("Work Router<br/>apply-review route<br/>(review on bot PR)") --> fbSubject
|
|
443
|
-
fbSubject["Subject (rung 4)<br/>Our open PR? Substantive review?"] -->|✓| fbFacts
|
|
444
|
-
fbSubject -.->|✗| fbIdle
|
|
445
|
-
fbFacts("Facts (rung 3)<br/>Threads, comments, diff to disk") --> fbTriage
|
|
446
|
-
fbTriage["Triage<br/>Anything actionable and outstanding?"] -->|✓| fbReserve
|
|
447
|
-
fbTriage -.->|nothing| fbIdle
|
|
448
|
-
fbReserve("Reserve<br/>Propose bot-working on the issue") -->|✓| fbApply
|
|
449
|
-
fbApply("Apply<br/>Only what the feedback justifies") -->|✓| fbVerify
|
|
450
|
-
fbApply -.->|✗| fbFail
|
|
451
|
-
fbVerify["Verify<br/>/repo-verify passes?<br/>↻"] -->|✓| fbPush
|
|
452
|
-
fbVerify -.->|✗| fbApply
|
|
453
|
-
fbPush(("Pushed<br/>Same branch, bot-working removed"))
|
|
454
|
-
fbIdle(("Idle<br/>Not ours, or nothing to do"))
|
|
455
|
-
fbFail(("Fail<br/>review added, bot-working removed"))
|
|
456
|
-
|
|
457
|
-
classDef start fill:#ffffff,stroke:#172033,stroke-width:2px,color:#172033
|
|
458
|
-
classDef action fill:#eef0ff,stroke:#554cff,stroke-width:2px,color:#172033
|
|
459
|
-
classDef decision fill:#fff8e8,stroke:#c75b00,stroke-width:2px,color:#172033
|
|
460
|
-
classDef idle fill:#202c40,stroke:#738198,stroke-width:2px,color:#ffffff
|
|
461
|
-
classDef failure fill:#fff0f0,stroke:#ef2929,stroke-width:2px,color:#8b1a1a
|
|
462
|
-
classDef success fill:#e8f8ec,stroke:#18883c,stroke-width:2px,color:#145a32
|
|
463
|
-
class fbStart start
|
|
464
|
-
class fbFacts,fbReserve,fbApply action
|
|
465
|
-
class fbSubject,fbTriage,fbVerify decision
|
|
466
|
-
class fbIdle idle
|
|
467
|
-
class fbFail failure
|
|
468
|
-
class fbPush success
|
|
469
|
-
```
|
|
1
|
+
---
|
|
2
|
+
# Managed by @plainconceptsplatform/workflows. Source: loops/workflows/agent-apply-review.md. Update with `workflows update --force`; consumer edits may be overwritten.
|
|
3
|
+
env:
|
|
4
|
+
# Printed by the prompt as the verification block. Consumers set their own commands.
|
|
5
|
+
VERIFY_COMMANDS: ""
|
|
6
|
+
REPO_RULES: "Apply only actionable outstanding reviewer feedback to the selected bot pull request. Make minimal changes that address each comment. Preserve architecture and do not weaken tests. Run full verification after changes."
|
|
7
|
+
WORKING_LABEL: bot-working
|
|
8
|
+
REVIEW_LABEL: review
|
|
9
|
+
# Marks a park the machine caused — a crash, a timeout, an empty output — as opposed to one it
|
|
10
|
+
# decided on. The janitor retries these after a while and never touches a decision park, because
|
|
11
|
+
# re-running a decision produces the same decision. Created idempotently where it is applied.
|
|
12
|
+
STALLED_LABEL: stalled
|
|
13
|
+
PR_PENDING_LABEL: pr-pending
|
|
14
|
+
REVIEW_MARKER: "<!-- agent-apply-review -->"
|
|
15
|
+
INCOMPLETE_COMMENT: "Applying the review feedback ended without an outcome. This worker has no retry of its own: it runs again when somebody reviews or comments on the pull request, and the issue is flagged so it is not lost until then."
|
|
16
|
+
ISSUE_CONTEXT_PATH: /tmp/gh-aw/agent/issue-context.json
|
|
17
|
+
GH_AW_ALLOWED_BOTS: "platform-devbox[bot],github-actions[bot]"
|
|
18
|
+
GIT_AUTHOR_NAME: "github-actions[bot]"
|
|
19
|
+
GIT_AUTHOR_EMAIL: "github-actions[bot]@users.noreply.github.com"
|
|
20
|
+
GIT_COMMITTER_NAME: "github-actions[bot]"
|
|
21
|
+
GIT_COMMITTER_EMAIL: "github-actions[bot]@users.noreply.github.com"
|
|
22
|
+
description: |
|
|
23
|
+
Applies reviewer feedback to an open pull request the bot authored, then pushes the fixes to
|
|
24
|
+
the same branch. Called by the Work Router; does not trigger on public events.
|
|
25
|
+
|
|
26
|
+
`target: triggering` is enough for the push here, so unlike the merge gate this needs no
|
|
27
|
+
wildcard fetch: the event is the pull request and gh-aw has already checked out its head.
|
|
28
|
+
|
|
29
|
+
name: "Agent: Apply Review"
|
|
30
|
+
|
|
31
|
+
# Router-only worker. The Work Router owns triggers, classification, and rung 1-2 checks.
|
|
32
|
+
# This workflow receives the classified inputs and runs rung 3+.
|
|
33
|
+
imports:
|
|
34
|
+
- github/gh-aw/.github/workflows/shared/opencode.md@v0.87.5
|
|
35
|
+
- shared/platform-defaults.md
|
|
36
|
+
- shared/opencode-ci.md
|
|
37
|
+
|
|
38
|
+
on:
|
|
39
|
+
workflow_call:
|
|
40
|
+
inputs:
|
|
41
|
+
pr-number:
|
|
42
|
+
description: Pull request number to apply review feedback on.
|
|
43
|
+
required: true
|
|
44
|
+
type: string
|
|
45
|
+
linked-issue:
|
|
46
|
+
description: Issue number the pull request closes. May be empty.
|
|
47
|
+
required: false
|
|
48
|
+
type: string
|
|
49
|
+
|
|
50
|
+
# Rung 4. Router has classified the event; this job validates PR ownership and checks for
|
|
51
|
+
# substantive feedback. A custom job, not `on.steps`, because the prompt needs these values.
|
|
52
|
+
jobs:
|
|
53
|
+
subject:
|
|
54
|
+
runs-on: agents-arc
|
|
55
|
+
permissions:
|
|
56
|
+
contents: read
|
|
57
|
+
issues: read
|
|
58
|
+
pull-requests: read
|
|
59
|
+
outputs:
|
|
60
|
+
found: ${{ steps.subject.outputs.found }}
|
|
61
|
+
pr: ${{ steps.subject.outputs.pr }}
|
|
62
|
+
issue: ${{ steps.subject.outputs.issue }}
|
|
63
|
+
unresolved: ${{ steps.subject.outputs.unresolved }}
|
|
64
|
+
steps:
|
|
65
|
+
- name: Confirm this is our pull request and the feedback is substantive
|
|
66
|
+
id: subject
|
|
67
|
+
env:
|
|
68
|
+
GH_TOKEN: ${{ github.token }}
|
|
69
|
+
REPO: ${{ github.repository }}
|
|
70
|
+
PR: ${{ inputs.pr-number }}
|
|
71
|
+
LINKED_ISSUE: ${{ inputs.linked-issue }}
|
|
72
|
+
run: |
|
|
73
|
+
set -euo pipefail
|
|
74
|
+
|
|
75
|
+
none() {
|
|
76
|
+
echo "found=false" >> "$GITHUB_OUTPUT"
|
|
77
|
+
echo "$1"
|
|
78
|
+
exit 0
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
pr=$(gh pr view "$PR" --repo "$REPO" --json number,state,author,title,body)
|
|
82
|
+
[ "$(printf '%s' "$pr" | jq -r '.state')" = "OPEN" ] || none "PR #$PR is not open"
|
|
83
|
+
|
|
84
|
+
# Use GitHub's bot flag because App login formats differ across APIs.
|
|
85
|
+
author=$(printf '%s' "$pr" | jq -r '.author.login')
|
|
86
|
+
is_bot=$(printf '%s' "$pr" | jq -r '.author.is_bot')
|
|
87
|
+
[ "$is_bot" = "true" ] || \
|
|
88
|
+
none "PR #$PR was authored by $author, a human. Never push to a human's branch."
|
|
89
|
+
|
|
90
|
+
# The issue this pull request closes, preferring the router-provided linked issue.
|
|
91
|
+
if [ -n "$LINKED_ISSUE" ]; then
|
|
92
|
+
issue="$LINKED_ISSUE"
|
|
93
|
+
else
|
|
94
|
+
issue=$(printf '%s' "$pr" | jq -r '.body // ""' \
|
|
95
|
+
| grep -oiE '(close[sd]?|fixe?[sd]?|resolve[sd]?) +#[0-9]+' \
|
|
96
|
+
| grep -oE '[0-9]+' | head -n 1 || true)
|
|
97
|
+
fi
|
|
98
|
+
|
|
99
|
+
# Unresolved review threads, from the API rather than from the model's reading of it.
|
|
100
|
+
unresolved=$(gh api graphql -f query='
|
|
101
|
+
query($owner:String!, $name:String!, $number:Int!) {
|
|
102
|
+
repository(owner:$owner, name:$name) {
|
|
103
|
+
pullRequest(number:$number) {
|
|
104
|
+
reviewThreads(first:100) { nodes { isResolved isOutdated } }
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}' \
|
|
108
|
+
-f owner="${REPO%/*}" -f name="${REPO#*/}" -F number="$PR" \
|
|
109
|
+
--jq '[.data.repository.pullRequest.reviewThreads.nodes[]
|
|
110
|
+
| select(.isResolved == false and .isOutdated == false)] | length')
|
|
111
|
+
|
|
112
|
+
{
|
|
113
|
+
echo "found=true"
|
|
114
|
+
echo "pr=$PR"
|
|
115
|
+
echo "issue=${issue:-}"
|
|
116
|
+
echo "unresolved=$unresolved"
|
|
117
|
+
} >> "$GITHUB_OUTPUT"
|
|
118
|
+
echo "PR #$PR has $unresolved unresolved thread(s)"
|
|
119
|
+
|
|
120
|
+
reserve:
|
|
121
|
+
needs: subject
|
|
122
|
+
if: needs.subject.outputs.found == 'true' && needs.subject.outputs.issue != ''
|
|
123
|
+
runs-on: agents-arc
|
|
124
|
+
permissions:
|
|
125
|
+
contents: read
|
|
126
|
+
issues: write
|
|
127
|
+
steps:
|
|
128
|
+
- name: Checkout workflow actions
|
|
129
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
130
|
+
with:
|
|
131
|
+
persist-credentials: false
|
|
132
|
+
- name: Create bot token
|
|
133
|
+
id: app-token
|
|
134
|
+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
135
|
+
with:
|
|
136
|
+
client-id: ${{ secrets.BOT_APP_ID }}
|
|
137
|
+
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
|
|
138
|
+
- name: Mark the linked issue as in progress
|
|
139
|
+
uses: ./.github/actions/add-issue-labels
|
|
140
|
+
with:
|
|
141
|
+
token: ${{ steps.app-token.outputs.token }}
|
|
142
|
+
issue-number: ${{ needs.subject.outputs.issue }}
|
|
143
|
+
labels: ${{ env.WORKING_LABEL }}
|
|
144
|
+
- name: Clear the human-needed flag
|
|
145
|
+
uses: ./.github/actions/remove-issue-labels
|
|
146
|
+
with:
|
|
147
|
+
token: ${{ steps.app-token.outputs.token }}
|
|
148
|
+
issue-number: ${{ needs.subject.outputs.issue }}
|
|
149
|
+
labels: |-
|
|
150
|
+
${{ env.REVIEW_LABEL }}
|
|
151
|
+
${{ env.STALLED_LABEL }}
|
|
152
|
+
validate_output:
|
|
153
|
+
needs: [activation, subject, agent, safe_outputs]
|
|
154
|
+
if: always() && needs.agent.result == 'success' && needs.safe_outputs.result == 'success'
|
|
155
|
+
runs-on: agents-arc
|
|
156
|
+
permissions:
|
|
157
|
+
contents: read
|
|
158
|
+
pull-requests: read
|
|
159
|
+
outputs:
|
|
160
|
+
valid: ${{ steps.validate.outputs.valid }}
|
|
161
|
+
outcome: ${{ steps.validate.outputs.outcome }}
|
|
162
|
+
steps:
|
|
163
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
164
|
+
with:
|
|
165
|
+
persist-credentials: false
|
|
166
|
+
- id: output
|
|
167
|
+
uses: ./.github/actions/download-agent-output
|
|
168
|
+
with:
|
|
169
|
+
artifact-name: ${{ needs.activation.outputs.artifact_prefix }}agent
|
|
170
|
+
- name: Load unresolved review threads
|
|
171
|
+
env:
|
|
172
|
+
GH_TOKEN: ${{ github.token }}
|
|
173
|
+
REPO: ${{ github.repository }}
|
|
174
|
+
PR: ${{ needs.subject.outputs.pr }}
|
|
175
|
+
run: |
|
|
176
|
+
set -euo pipefail
|
|
177
|
+
gh api graphql -f query='
|
|
178
|
+
query($owner:String!, $name:String!, $number:Int!) {
|
|
179
|
+
repository(owner:$owner, name:$name) {
|
|
180
|
+
pullRequest(number:$number) {
|
|
181
|
+
reviewThreads(first:100) { nodes { id isResolved isOutdated } }
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}' -f owner="${REPO%/*}" -f name="${REPO#*/}" -F number="$PR" \
|
|
185
|
+
--jq '.data.repository.pullRequest.reviewThreads.nodes' > /tmp/review-threads.json
|
|
186
|
+
- id: validate
|
|
187
|
+
uses: ./.github/actions/validate-review-output
|
|
188
|
+
with:
|
|
189
|
+
output-file: ${{ steps.output.outputs.output-file }}
|
|
190
|
+
pr-number: ${{ needs.subject.outputs.pr }}
|
|
191
|
+
review-threads-file: /tmp/review-threads.json
|
|
192
|
+
conclude:
|
|
193
|
+
needs: [activation, subject, agent, safe_outputs, validate_output]
|
|
194
|
+
if: >
|
|
195
|
+
needs.agent.result == 'success' &&
|
|
196
|
+
needs.safe_outputs.result == 'success' &&
|
|
197
|
+
needs.validate_output.outputs.valid == 'true'
|
|
198
|
+
runs-on: agents-arc
|
|
199
|
+
permissions:
|
|
200
|
+
contents: write
|
|
201
|
+
issues: write
|
|
202
|
+
pull-requests: write
|
|
203
|
+
steps:
|
|
204
|
+
- name: Create bot token
|
|
205
|
+
id: app-token
|
|
206
|
+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
207
|
+
with:
|
|
208
|
+
client-id: ${{ secrets.BOT_APP_ID }}
|
|
209
|
+
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
|
|
210
|
+
- name: Checkout repository
|
|
211
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
212
|
+
with:
|
|
213
|
+
token: ${{ steps.app-token.outputs.token }}
|
|
214
|
+
fetch-depth: 0
|
|
215
|
+
- name: Apply agent output
|
|
216
|
+
uses: ./.github/actions/apply-agent-output
|
|
217
|
+
with:
|
|
218
|
+
artifact-name: ${{ needs.activation.outputs.artifact_prefix }}agent
|
|
219
|
+
token: ${{ steps.app-token.outputs.token }}
|
|
220
|
+
push-to-branch: 'true'
|
|
221
|
+
apply-labels: 'false'
|
|
222
|
+
- name: Release implemented review
|
|
223
|
+
if: needs.validate_output.outputs.outcome == 'implemented'
|
|
224
|
+
uses: ./.github/actions/remove-issue-labels
|
|
225
|
+
with:
|
|
226
|
+
token: ${{ steps.app-token.outputs.token }}
|
|
227
|
+
issue-number: ${{ needs.subject.outputs.issue }}
|
|
228
|
+
labels: ${{ env.WORKING_LABEL }}
|
|
229
|
+
- name: Flag review outcome
|
|
230
|
+
if: needs.validate_output.outputs.outcome != 'implemented'
|
|
231
|
+
uses: ./.github/actions/add-issue-labels
|
|
232
|
+
with:
|
|
233
|
+
token: ${{ steps.app-token.outputs.token }}
|
|
234
|
+
issue-number: ${{ needs.subject.outputs.issue }}
|
|
235
|
+
labels: ${{ env.REVIEW_LABEL }}
|
|
236
|
+
# Only the reservation comes off. pr-pending says a pull request for this issue is open and
|
|
237
|
+
# waiting, which is still true on both outcomes that reach here: already-satisfied and
|
|
238
|
+
# needs-human both leave the pull request open. Stripping it made the board show issues
|
|
239
|
+
# with open pull requests as having none — the exact bug the merge gate's own comment warns
|
|
240
|
+
# about, in the one file the route matrix was not checking.
|
|
241
|
+
- name: Release review outcome
|
|
242
|
+
if: needs.validate_output.outputs.outcome != 'implemented'
|
|
243
|
+
uses: ./.github/actions/remove-issue-labels
|
|
244
|
+
with:
|
|
245
|
+
token: ${{ steps.app-token.outputs.token }}
|
|
246
|
+
issue-number: ${{ needs.subject.outputs.issue }}
|
|
247
|
+
labels: ${{ env.WORKING_LABEL }}
|
|
248
|
+
incomplete:
|
|
249
|
+
needs: [subject, agent, safe_outputs, validate_output]
|
|
250
|
+
if: >
|
|
251
|
+
always() &&
|
|
252
|
+
needs.subject.outputs.found == 'true' &&
|
|
253
|
+
(needs.agent.result != 'success' || needs.safe_outputs.result != 'success' || needs.validate_output.outputs.valid != 'true')
|
|
254
|
+
runs-on: agents-arc
|
|
255
|
+
permissions:
|
|
256
|
+
contents: read
|
|
257
|
+
issues: write
|
|
258
|
+
steps:
|
|
259
|
+
- name: Checkout workflow actions
|
|
260
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
261
|
+
with:
|
|
262
|
+
persist-credentials: false
|
|
263
|
+
- name: Create bot token
|
|
264
|
+
id: app-token
|
|
265
|
+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
266
|
+
with:
|
|
267
|
+
client-id: ${{ secrets.BOT_APP_ID }}
|
|
268
|
+
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
|
|
269
|
+
- name: Release the issue
|
|
270
|
+
uses: ./.github/actions/remove-issue-labels
|
|
271
|
+
with:
|
|
272
|
+
token: ${{ steps.app-token.outputs.token }}
|
|
273
|
+
issue-number: ${{ needs.subject.outputs.issue }}
|
|
274
|
+
labels: ${{ env.WORKING_LABEL }}
|
|
275
|
+
- name: Flag for human review
|
|
276
|
+
uses: ./.github/actions/add-issue-labels
|
|
277
|
+
with:
|
|
278
|
+
token: ${{ steps.app-token.outputs.token }}
|
|
279
|
+
issue-number: ${{ needs.subject.outputs.issue }}
|
|
280
|
+
labels: |-
|
|
281
|
+
${{ env.REVIEW_LABEL }}
|
|
282
|
+
${{ env.STALLED_LABEL }}
|
|
283
|
+
- name: Report missing review feedback outcome
|
|
284
|
+
uses: ./.github/actions/create-issue-comment
|
|
285
|
+
with:
|
|
286
|
+
token: ${{ steps.app-token.outputs.token }}
|
|
287
|
+
issue-number: ${{ needs.subject.outputs.issue }}
|
|
288
|
+
body: |
|
|
289
|
+
${{ env.REVIEW_MARKER }}
|
|
290
|
+
${{ env.INCOMPLETE_COMMENT }}
|
|
291
|
+
[View this workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
|
292
|
+
|
|
293
|
+
if: needs.subject.outputs.found == 'true'
|
|
294
|
+
|
|
295
|
+
runs-on: agents-arc
|
|
296
|
+
runs-on-slim: agents-arc
|
|
297
|
+
|
|
298
|
+
secrets:
|
|
299
|
+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
300
|
+
|
|
301
|
+
engine:
|
|
302
|
+
id: opencode
|
|
303
|
+
version: "1.2.14"
|
|
304
|
+
env:
|
|
305
|
+
OPENAI_BASE_URL: https://forge.plainconcepts.com/v1
|
|
306
|
+
|
|
307
|
+
model: openai/glm-5-3
|
|
308
|
+
|
|
309
|
+
max-turns: 300
|
|
310
|
+
max-turn-cache-misses: 3000
|
|
311
|
+
max-ai-credits: 5000
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
permissions: read-all
|
|
315
|
+
|
|
316
|
+
# Rung 3. A reviewer often makes one point across several comments, so the agent needs the
|
|
317
|
+
# whole conversation, not just the one that triggered it. Fetching all of it is deterministic.
|
|
318
|
+
steps:
|
|
319
|
+
- name: Load the issue context
|
|
320
|
+
uses: ./.github/actions/load-issue-context
|
|
321
|
+
with:
|
|
322
|
+
token: ${{ github.token }}
|
|
323
|
+
issue-number: ${{ needs.subject.outputs.issue }}
|
|
324
|
+
output-path: ${{ env.ISSUE_CONTEXT_PATH }}
|
|
325
|
+
- name: Fetch the whole review conversation and the diff
|
|
326
|
+
env:
|
|
327
|
+
GH_TOKEN: ${{ github.token }}
|
|
328
|
+
REPO: ${{ github.repository }}
|
|
329
|
+
PR: ${{ inputs.pr-number }}
|
|
330
|
+
run: |
|
|
331
|
+
set -euo pipefail
|
|
332
|
+
mkdir -p /tmp/gh-aw/agent
|
|
333
|
+
gh pr diff "$PR" --repo "$REPO" > /tmp/gh-aw/agent/diff.patch
|
|
334
|
+
gh api "repos/$REPO/pulls/$PR/comments" --paginate \
|
|
335
|
+
--jq '[.[] | {id, path, line, author: .user.login, body, in_reply_to_id}]' \
|
|
336
|
+
> /tmp/gh-aw/agent/review-comments.json
|
|
337
|
+
gh api "repos/$REPO/issues/$PR/comments" --paginate \
|
|
338
|
+
--jq '[.[] | {author: .user.login, body}]' \
|
|
339
|
+
> /tmp/gh-aw/agent/conversation.json
|
|
340
|
+
gh api graphql -f query='
|
|
341
|
+
query($owner:String!, $name:String!, $number:Int!) {
|
|
342
|
+
repository(owner:$owner, name:$name) {
|
|
343
|
+
pullRequest(number:$number) {
|
|
344
|
+
reviewThreads(first:100) {
|
|
345
|
+
nodes { id
|
|
346
|
+
isResolved isOutdated path
|
|
347
|
+
comments(first:50) { nodes { author { login } body } }
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}' \
|
|
353
|
+
-f owner="${REPO%/*}" -f name="${REPO#*/}" -F number="$PR" \
|
|
354
|
+
--jq '.data.repository.pullRequest.reviewThreads.nodes' \
|
|
355
|
+
> /tmp/gh-aw/agent/review-threads.json
|
|
356
|
+
|
|
357
|
+
safe-outputs:
|
|
358
|
+
# A failed run is already a red run. An issue per failure buries the real backlog
|
|
359
|
+
# under noise nobody closes.
|
|
360
|
+
report-failure-as-issue: false
|
|
361
|
+
threat-detection: false
|
|
362
|
+
# target "*" because these workers are dispatched, not triggered by the pull request:
|
|
363
|
+
# the default "triggering" target has no pull request in context and rejects the push
|
|
364
|
+
# with "requires pull request context", so the agent's fix is computed and discarded.
|
|
365
|
+
push-to-pull-request-branch:
|
|
366
|
+
target: "*"
|
|
367
|
+
add-comment:
|
|
368
|
+
target: "*"
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
# The fleet is two machines, so this clock is also how long a stuck run can hold half of it.
|
|
372
|
+
# 240 went on to every worker at once when the provider was slow, which fixed the deaths and
|
|
373
|
+
# made every worker equally expensive to hang. These numbers are per worker: enough headroom
|
|
374
|
+
# for a slow gateway on the work it actually does, and not four hours for a run that reads one
|
|
375
|
+
# issue. Turns remain the guard against a confused agent looping; for a custom model the credit
|
|
376
|
+
# ceiling is models.dev fallback pricing and guards nothing.
|
|
377
|
+
#
|
|
378
|
+
# Applies review comments to an existing branch and verifies the result.
|
|
379
|
+
timeout-minutes: 90
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
1. You are applying review feedback to pull request
|
|
383
|
+
**#${{ needs.subject.outputs.pr }}**, which has
|
|
384
|
+
**${{ needs.subject.outputs.unresolved }}** unresolved review thread(s).
|
|
385
|
+
|
|
386
|
+
It has already been confirmed that this pull request is open, that we authored it, and that
|
|
387
|
+
the reviewer has write access. Do not re-check any of that.
|
|
388
|
+
|
|
389
|
+
2. Read `${{ env.ISSUE_CONTEXT_PATH }}`. It contains the issue body and discussion this pull
|
|
390
|
+
request closes. The acceptance criteria there define what the implementation must still
|
|
391
|
+
satisfy after the feedback is applied.
|
|
392
|
+
|
|
393
|
+
3. Read the whole conversation, not just the comment that triggered you. It is already on disk:
|
|
394
|
+
|
|
395
|
+
- `/tmp/gh-aw/agent/review-threads.json` , every thread with its resolved and outdated state
|
|
396
|
+
- `/tmp/gh-aw/agent/review-comments.json` , every inline comment with its file and line
|
|
397
|
+
- `/tmp/gh-aw/agent/conversation.json` , every conversation comment
|
|
398
|
+
- `/tmp/gh-aw/agent/diff.patch` , the current diff
|
|
399
|
+
|
|
400
|
+
A reviewer often makes one point across several comments. Applying them one at a time
|
|
401
|
+
produces contradictory commits, so read everything before changing anything.
|
|
402
|
+
|
|
403
|
+
4. Work out which items are genuinely actionable and still outstanding. Skip anything already
|
|
404
|
+
addressed by a later commit, anything a bot wrote, anything from the pull request author,
|
|
405
|
+
and anything that is a question rather than a request. You must account for every unresolved
|
|
406
|
+
human review thread by its `PRRT_...` ID. Do not claim feedback was implemented when no branch
|
|
407
|
+
change is needed: that requires reviewer confirmation.
|
|
408
|
+
|
|
409
|
+
5. Load only skills required by the feedback, then apply it. Make only changes the feedback
|
|
410
|
+
justifies: a review comment is not licence for unrelated refactoring. Never read outside this
|
|
411
|
+
repository root. Follow repository documentation and established conventions. Keep changes
|
|
412
|
+
focused, protect secrets, and do not modify generated files unless the feedback requires it.
|
|
413
|
+
Adhere to ${{ env.REPO_RULES }}.
|
|
414
|
+
|
|
415
|
+
6. Run the repository verification commands below, under the verification rules above. The
|
|
416
|
+
issue context at `${{ env.ISSUE_CONTEXT_PATH }}` defines the acceptance criteria the fix
|
|
417
|
+
must satisfy. Never push a branch that does not pass.
|
|
418
|
+
|
|
419
|
+
```
|
|
420
|
+
${{ env.VERIFY_COMMANDS }}
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
7. Select one review outcome.
|
|
424
|
+
|
|
425
|
+
- **implemented**: You made the requested change, verification passed, and you will propose
|
|
426
|
+
exactly one `push_to_pull_request_branch`.
|
|
427
|
+
- **already-satisfied**: The current branch already satisfies the request. Do not push; the
|
|
428
|
+
reviewer must confirm this assessment.
|
|
429
|
+
- **needs-human**: The feedback is ambiguous, unsafe, or cannot be applied. Do not push.
|
|
430
|
+
|
|
431
|
+
8. Emit exactly one `add_comment` on PR `${{ needs.subject.outputs.pr }}`. Include every
|
|
432
|
+
unresolved human review thread ID and an explanation for it, then exactly one line:
|
|
433
|
+
`**Review outcome:** implemented`, `**Review outcome:** already-satisfied`, or
|
|
434
|
+
`**Review outcome:** needs-human`.
|
|
435
|
+
|
|
436
|
+
9. Do not merge, close, or change labels. The workflow validates your outcome and owns those
|
|
437
|
+
state transitions.
|
|
438
|
+
|