opencode-azure-devops-pr-review 0.3.1 → 0.3.3
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/CHANGELOG.md +46 -0
- package/README.md +128 -86
- package/package.json +2 -11
- package/src/attribution.mjs +2 -4
- package/src/azure.mjs +5 -2
- package/src/host.mjs +28 -5
- package/src/runtime.mjs +13 -7
- package/src/session.mjs +6 -12
- package/AGENTS.md +0 -164
- package/CODE_OF_CONDUCT.md +0 -83
- package/CONTRIBUTING.md +0 -84
- package/SECURITY.md +0 -38
- package/config/settings.example.json +0 -55
- package/config/settings.schema.json +0 -316
- package/docs/ARCHITECTURE.md +0 -414
- package/docs/AZURE_DEVOPS.md +0 -217
- package/docs/COMMENTING.md +0 -399
- package/docs/DEBUGGING.md +0 -146
- package/docs/DEMO.md +0 -195
- package/docs/ENTERPRISE.md +0 -236
- package/docs/QUICKSTART.md +0 -238
- package/docs/RELEASING.md +0 -95
- package/docs/ROADMAP.md +0 -241
- package/docs/VALIDATION.md +0 -2127
- package/docs/VALIDATION_HISTORY.md +0 -1845
- package/docs/VERIFICATION.md +0 -42
- package/docs/assets/RECORDING.md +0 -131
- package/docs/assets/adjust-findings-teaser.gif +0 -0
- package/docs/assets/adjust-preview.png +0 -0
- package/docs/assets/adjust-publication.png +0 -0
- package/docs/assets/example-comments.md +0 -38
- package/docs/assets/generate-demo-gif.py +0 -25
- package/docs/assets/generate-demo.mjs +0 -141
- package/docs/assets/live-azure-readback.png +0 -0
- package/docs/assets/live-preview.png +0 -0
- package/docs/assets/live-review-teaser.gif +0 -0
- package/docs/assets/live-review.png +0 -0
- package/docs/assets/quick-review-demo.gif +0 -0
- package/docs/assets/record-terminal.py +0 -124
- package/docs/assets/render-terminal-demo.py +0 -168
- package/docs/assets/review-example.svg +0 -1
- package/docs/assets/walkthrough.svg +0 -1
- package/docs/releases/v0.1.0.md +0 -74
- package/docs/releases/v0.2.0.md +0 -107
- package/docs/releases/v0.2.1.md +0 -65
- package/docs/releases/v0.2.2.md +0 -76
- package/docs/releases/v0.2.3.md +0 -93
- package/docs/releases/v0.3.0.md +0 -125
- package/docs/releases/v0.3.1.md +0 -87
- package/install.sh +0 -171
- package/scripts/merge-settings.py +0 -120
- package/uninstall.sh +0 -50
package/docs/COMMENTING.md
DELETED
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
# Commenting
|
|
2
|
-
|
|
3
|
-
`/pr-comment` turns a COMPLETE review into PR comments in two steps: a model
|
|
4
|
-
plans the comments, then the runtime posts the saved plan itself.
|
|
5
|
-
|
|
6
|
-
```text
|
|
7
|
-
/pr-comment preview the latest review of this conversation
|
|
8
|
-
/pr-comment <review-id> preview a specific review
|
|
9
|
-
/pr-comment --publish post the saved preview (plan first if none)
|
|
10
|
-
/pr-comment <review-id> --publish
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Only reviews started in the same conversation are accepted; commands from one
|
|
14
|
-
of the review's own sessions (for example the verifier session that shows the
|
|
15
|
-
report) route to that conversation. Reviews are persisted, so this also works
|
|
16
|
-
after an OpenCode restart. A preview is refreshed on every `/pr-comment`
|
|
17
|
-
without `--publish`; `--publish` reuses an existing preview exactly.
|
|
18
|
-
|
|
19
|
-
## Automatic comments after a review
|
|
20
|
-
|
|
21
|
-
`afterReview` (per mode: `none`, the default, `preview` or `publish`) or a
|
|
22
|
-
flag right after the PR URL of a review command (`--preview`, `--publish`,
|
|
23
|
-
`--no-comment`, which wins for that run) starts the same planning and
|
|
24
|
-
publication after a review:
|
|
25
|
-
|
|
26
|
-
1. Only a COMPLETE review hands on; STALE, PARTIAL, INCOMPLETE, CANCELLED and
|
|
27
|
-
TIMED_OUT reviews never do, and nothing starts while the plugin unloads. A
|
|
28
|
-
`/pr-stop`, timeout or unload that arrives while a finished review's report
|
|
29
|
-
is still being delivered keeps the review COMPLETE (it can still be
|
|
30
|
-
commented on by hand) but starts no step; its receipt says `Automatic
|
|
31
|
-
comments are off for this review (stopped: …)`.
|
|
32
|
-
The review's `STARTED` notice and its receipt's PR comments section say
|
|
33
|
-
which step follows (and why: the setting or the flag).
|
|
34
|
-
2. After the review's receipt, a review without findings to comment on gets
|
|
35
|
-
one notice, `Automatic preview skipped` or `Automatic publication
|
|
36
|
-
skipped`: nothing is planned or posted and no model runs. A manual
|
|
37
|
-
`/pr-comment` still previews a summary-only comment.
|
|
38
|
-
3. Otherwise a separate comment run starts with its own run ID, `STARTED`
|
|
39
|
-
notice (`automatic preview after review <id> completed`) and receipt
|
|
40
|
-
(`Started automatically after review <id> completed`). `/pr-stop` stops it
|
|
41
|
-
like any run. When another AZPR command holds the conversation or the PR,
|
|
42
|
-
the step is skipped with a notice that names the `/pr-comment` command to
|
|
43
|
-
run when that command has finished.
|
|
44
|
-
4. Automatic publication posts each item that no safeguard holds back. An
|
|
45
|
-
item, the summary or an inline comment, waits in the saved preview for a
|
|
46
|
-
person when its text contains an Azure DevOps mention (`@<…>`), an image
|
|
47
|
-
(`).
|
|
85
|
-
|
|
86
|
-
The receipt says `Automatic
|
|
87
|
-
publication held back N item(s) for a person: …` with each item and why;
|
|
88
|
-
when every item is held, nothing is posted and the status is `PREVIEW`
|
|
89
|
-
(`held back every item`). A quick review's findings are posted with its
|
|
90
|
-
disclosure (`quick review, not independently verified`; the summary also
|
|
91
|
-
names incomplete coverage), also a high-severity finding: its verification
|
|
92
|
-
hint is advisory. When the plan has no inline comment and the planner
|
|
93
|
-
skipped every finding as `existing-thread` with a thread the runtime found
|
|
94
|
-
live before planning, typically AZPR's own comment from an earlier run,
|
|
95
|
-
there is nothing new to post: status `NOTHING_TO_POST`, `Automatic
|
|
96
|
-
publication found nothing new to post: …`, and the plan is saved (the
|
|
97
|
-
summary's marker follows the inline comments, so posting would add a
|
|
98
|
-
second summary for the same findings each time an unchanged PR is reviewed
|
|
99
|
-
again). `/pr-comment <id> --publish`, like every command you type, applies
|
|
100
|
-
none of these safeguards: it posts every item of the saved preview, and
|
|
101
|
-
items already posted are `ALREADY_PRESENT`.
|
|
102
|
-
|
|
103
|
-
Publication then follows the usual rules below (PR active, unchanged head,
|
|
104
|
-
markers, read-back). Automatic publication posts as the PAT owner, like
|
|
105
|
-
`/pr-comment --publish`.
|
|
106
|
-
|
|
107
|
-
## What is posted
|
|
108
|
-
|
|
109
|
-
- **One summary thread** (no file anchor): a 🤖 AI/model disclosure, optional
|
|
110
|
-
review notes (the change's purpose or what changed), an index of every
|
|
111
|
-
confirmed finding with 🔴 high / 🟡 medium / 🔵 low labels, and optional
|
|
112
|
-
details: confirmed findings without an inline comment and retained
|
|
113
|
-
improvement suggestions from the final report.
|
|
114
|
-
- **Inline threads** for confirmed high and medium findings, on the right side
|
|
115
|
-
of a changed file at the reviewed head. Titles start with `🔴 high:` or
|
|
116
|
-
`🟡 medium:`; bodies use **📝 Summary**, **🔎 Evidence** and
|
|
117
|
-
**💡 Suggested fix**, followed by the model attribution and a hidden marker.
|
|
118
|
-
|
|
119
|
-
Low findings, findings that cannot be anchored, and issues that an existing
|
|
120
|
-
discussion on the PR already covers are skipped with a local reason; skips are
|
|
121
|
-
listed in the preview and receipt. Each planner skip names one cause
|
|
122
|
-
(`low-severity`, `no-inline-location`, `existing-thread` with its `threadId`,
|
|
123
|
-
`cannot-anchor` or `too-long`), and the runtime checks what the cause states:
|
|
124
|
-
the severity, whether the location can carry an inline comment, that the
|
|
125
|
-
thread is live, and that the finding's lines were not in the page's source
|
|
126
|
-
excerpts. Whether a finding deserves a comment stays the planner's call. Findings of the same review never cover each
|
|
127
|
-
other: the verifier already merged duplicates, so each confirmed high or medium
|
|
128
|
-
finding gets its own comment unless one of those reasons applies.
|
|
129
|
-
|
|
130
|
-
### Quick reviews
|
|
131
|
-
|
|
132
|
-
A `/pr-quick` review is commented on with the same planner, preview,
|
|
133
|
-
publication and markers, so its comments have the same layout. Its REPORTED
|
|
134
|
-
findings take the place of confirmed ones; they were not independently
|
|
135
|
-
verified, which the disclosure line says in both the summary and every inline
|
|
136
|
-
comment, for example `AI-generated review; not human review or approval.
|
|
137
|
-
Review method: quick review, not independently verified. Models: …` (in zh-TW
|
|
138
|
-
`AI 審查,非人工審查或核准。審查方式:快速審查,未經獨立驗證。模型:…`). When the
|
|
139
|
-
review's coverage was incomplete, the summary's disclosure line adds
|
|
140
|
-
`coverage incomplete (…)` with the number of unreviewed changed files when it
|
|
141
|
-
is known and fixed short reasons otherwise; reviewer text never goes there.
|
|
142
|
-
|
|
143
|
-
Inline comments of a quick review are stricter: the finding's location must be
|
|
144
|
-
on a changed file at HEAD (a BASE location or unchanged code stays in the
|
|
145
|
-
summary index), and the planner's anchor must be found in the HEAD source the
|
|
146
|
-
runtime read. The quick reviewer's model plans the comments.
|
|
147
|
-
|
|
148
|
-
Without a verifier, two shards of a quick review can report one defect, for
|
|
149
|
-
example when a shard's tests lead its reviewer into another shard's changed
|
|
150
|
-
file. The runtime offers the planner such findings as `mergeCandidates`:
|
|
151
|
-
inline-eligible high or medium findings of different review sessions (recorded
|
|
152
|
-
by the runtime, not derived from IDs) with the same severity on overlapping
|
|
153
|
-
lines of one HEAD file, kept on one planning page (a group that does not fit a
|
|
154
|
-
page is not offered). The planner may then write one comment with `findingIds`
|
|
155
|
-
and a `mergeReason`, only when the findings state the same root cause with
|
|
156
|
-
compatible triggers and the same correction, and otherwise comments on each.
|
|
157
|
-
The runtime accepts a combination only if every member is in one listed group,
|
|
158
|
-
the members come from different sessions, share one severity and at least one
|
|
159
|
-
line, and the anchor lies within the shared lines; otherwise it asks for a
|
|
160
|
-
correction, and after the last one keeps the valid single comments and skips
|
|
161
|
-
the rest with a reason (they stay in the summary index; it never splits one
|
|
162
|
-
text into several). The summary index gives an accepted combination one row
|
|
163
|
-
with all its IDs, and the counts follow the rows; the review keeps every
|
|
164
|
-
finding. The runtime cannot tell a well-formed but wrong combination of two
|
|
165
|
-
different defects, so the prompt says to keep findings apart when unsure. No
|
|
166
|
-
dedicated duplicate stage runs, although planning pages, corrections or
|
|
167
|
-
continuations can still add sessions and model requests.
|
|
168
|
-
|
|
169
|
-
## Planning
|
|
170
|
-
|
|
171
|
-
Planning uses the review's risk model (the quick reviewer's model for a quick review) in pages of at most four findings, plus
|
|
172
|
-
segments of the final report for the summary details. Before planning, the
|
|
173
|
-
runtime reads every live thread once and fetches the HEAD source of each
|
|
174
|
-
finding's file. Each page then receives, inline: the verified findings,
|
|
175
|
-
`sourceExcerpts` (numbered HEAD lines around each finding, the whole file when it
|
|
176
|
-
has at most 400 lines), `existingDiscussions` (live threads with path, line,
|
|
177
|
-
author and the start of the first comment) and the report segment. The
|
|
178
|
-
changed-file list and the review's dispositions are inline
|
|
179
|
-
when they are small; on a large PR a page gets only those of its own findings
|
|
180
|
-
(plus what merged into them) and references to the complete lists, which the
|
|
181
|
-
runtime still uses for its own checks. Most pages finish in one model request without tools; the
|
|
182
|
-
planner reads more only for lines outside an excerpt or a full comment body.
|
|
183
|
-
A page that needs more reading returns `CONTINUE` with its finished items and a
|
|
184
|
-
continuation note (tools are withdrawn after 12 requests or about 48,000
|
|
185
|
-
characters of tool output); a new session continues the page. A page gets at
|
|
186
|
-
most three continuation sessions. When a checkpoint repeats an earlier one
|
|
187
|
-
without progress (same open findings, reads and notes), or the fourth session
|
|
188
|
-
still returns `CONTINUE`, the page ends there: its finished comments are kept,
|
|
189
|
-
its open findings are skipped with that reason and stay in the summary index,
|
|
190
|
-
and the other pages and publication go on. A PROGRESS notice names the page.
|
|
191
|
-
|
|
192
|
-
Two pages are planned at a time (one at a time when `workflow.parallelSessions`
|
|
193
|
-
is 1); a page's continuation sessions follow each other in its own lane, and the
|
|
194
|
-
PROGRESS notices and session titles name the page. No page depends on another
|
|
195
|
-
page's result:
|
|
196
|
-
|
|
197
|
-
- Only the first page may write the summary's review note. A note from any
|
|
198
|
-
other page is dropped without a correction turn; when the first page writes
|
|
199
|
-
none, the summary is posted without review notes.
|
|
200
|
-
- A page's anchor checks see the HEAD source the runtime fetched for its own
|
|
201
|
-
and earlier pages' findings, exactly as when pages ran one at a time.
|
|
202
|
-
- A checkpoint counts only the page's own work: its details and the tool
|
|
203
|
-
results the runtime recorded for its sessions.
|
|
204
|
-
- Pages are joined in page order, so the comments, their markers and the
|
|
205
|
-
ordinals of comments on identical lines do not depend on which page finishes
|
|
206
|
-
first.
|
|
207
|
-
|
|
208
|
-
When a page fails, no further page or continuation session starts, the stages
|
|
209
|
-
already running finish (including their correction turns and retries), and the
|
|
210
|
-
command reports the failure of the lowest failed page (INCOMPLETE) as before;
|
|
211
|
-
no preview is kept. `/pr-stop` cancels every running page.
|
|
212
|
-
|
|
213
|
-
Every page is validated item by item:
|
|
214
|
-
|
|
215
|
-
| Problem | Handling |
|
|
216
|
-
| --- | --- |
|
|
217
|
-
| Wrong severity label or case, missing title prefix, `<!--` in the body | Normalized automatically. |
|
|
218
|
-
| Repo-relative path (`src/a.ts`) | Normalized to `/src/a.ts`. |
|
|
219
|
-
| End line that does not match the quoted anchor | Derived from the anchor. |
|
|
220
|
-
| Anchor that exists at other lines in observed HEAD text | Moved to the unique matching lines. |
|
|
221
|
-
| Body over 1,200 characters, unknown path, missing anchor, ambiguous anchor, missing findings | Sent back as a correction turn; after `workflow.repairAttempts` the item is skipped (bodies up to 4,000 characters are accepted on the last pass). |
|
|
222
|
-
| A skip whose reason names another finding of this review | Sent back as a correction turn; on the last pass the skip stays, marked as not covered by the other finding. |
|
|
223
|
-
| A skip without a cause, or whose cause does not hold (a medium finding called low, an inline location called missing, a thread that is not live, `cannot-anchor` while the page's excerpts show the finding's lines) | Sent back as a correction turn; on the last pass the skip stays with what the runtime found. |
|
|
224
|
-
| Planner returns INCOMPLETE | Finished comments are kept; the rest are skipped with the planner's reason. |
|
|
225
|
-
| A summary note from a page other than the first | Dropped (`drop-unallowed-summary`), without a correction turn; the page's details are kept. |
|
|
226
|
-
|
|
227
|
-
A low finding never becomes an inline comment, and the verified severity always
|
|
228
|
-
wins over the planner's label.
|
|
229
|
-
|
|
230
|
-
## Adjusting findings after a preview
|
|
231
|
-
|
|
232
|
-
After reading a preview, a person can leave findings out of publication or
|
|
233
|
-
change their severity, and plan the preview again:
|
|
234
|
-
|
|
235
|
-
```text
|
|
236
|
-
/pr-comment <review-id> --exclude F-1,R-2
|
|
237
|
-
/pr-comment <review-id> --severity F-3=low,Q-1001=medium
|
|
238
|
-
/pr-comment <review-id> --exclude F-1 --severity F-3=low
|
|
239
|
-
/pr-comment <review-id> --reset
|
|
240
|
-
/pr-comment [review-id] --show
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
- The review ID is required: every review has its own F-1. IDs are those of
|
|
244
|
-
the review report (`f1` reads as F-1). Only findings the review can publish
|
|
245
|
-
are accepted: confirmed and verifier-added ones of a review or deep review,
|
|
246
|
-
reported ones of a quick review. A merged duplicate names the finding it was
|
|
247
|
-
merged into; any other ID refuses the whole command and changes nothing.
|
|
248
|
-
- Each list is complete and replaces the saved one (`none` empties it): after
|
|
249
|
-
`--exclude F-1`, a later `--exclude F-2` excludes only F-2 and restores F-1,
|
|
250
|
-
so name both (`--exclude F-1,F-2`) to keep both out; the receipt lists what
|
|
251
|
-
was excluded and restored. The other list is kept, except that excluding a
|
|
252
|
-
finding drops its severity change and a severity for an excluded finding
|
|
253
|
-
restores it. A finding named in both lists is refused, and a severity equal
|
|
254
|
-
to the review's is no change. `--reset` clears both.
|
|
255
|
-
- A changed severity changes how a finding is published (its title, whether it
|
|
256
|
-
can get an inline comment, the summary counts); it does not verify the
|
|
257
|
-
finding again or change its evidence, trigger or impact. When the finding
|
|
258
|
-
itself is wrong, exclude it.
|
|
259
|
-
- Each change plans the preview again with a model. The planner receives the
|
|
260
|
-
adjusted findings (without the excluded ones, with the new severities) and an
|
|
261
|
-
`adjustments` field that states them; the summary index and its counts
|
|
262
|
-
follow them. A finding set to low stays in the summary only, and a raised one
|
|
263
|
-
becomes eligible for an inline comment (it still needs a location that can
|
|
264
|
-
carry one and no live thread that covers it). The other comments are written
|
|
265
|
-
again, so their wording may change: read the whole preview before
|
|
266
|
-
publishing. The review itself, its findings and its report are not changed.
|
|
267
|
-
- An excluded finding is never assigned to a page, so it gets no comment of its
|
|
268
|
-
own. Any published text that names the ID of an excluded finding (the body of
|
|
269
|
-
any inline comment, combined ones included, the summary note or
|
|
270
|
-
`summaryDetails`) gets a correction turn; after the last one the comment is
|
|
271
|
-
skipped (its finding stays in the summary index) and the note or details are
|
|
272
|
-
dropped. The assembled preview is checked as well: a summary row is the
|
|
273
|
-
review's own text for its finding, so when a kept finding's summary names an
|
|
274
|
-
excluded one, the preview says which row and publication is held until you
|
|
275
|
-
exclude that finding as well or restore the excluded one. A reference
|
|
276
|
-
without the ID cannot be detected; the preview shows it.
|
|
277
|
-
- Excluding every finding plans nothing and posts nothing: the result is
|
|
278
|
-
`NOTHING_TO_POST`, not the summary of a review without defects.
|
|
279
|
-
`--exclude none` brings the findings back.
|
|
280
|
-
- Adjustments are saved with the review, with the time of each change, survive
|
|
281
|
-
a restart and apply to a later `/pr-comment <review-id>` until `--reset`. The
|
|
282
|
-
preview and the receipt list them; nothing posted to the PR mentions them.
|
|
283
|
-
- A review that was adjusted, also one reset since, is posted only from a
|
|
284
|
-
preview planned after its latest adjustment: every adjustment discards the
|
|
285
|
-
earlier preview in the same save, and `--publish` never plans and posts such
|
|
286
|
-
a review in one step (for example after a failed new preview, or a restart
|
|
287
|
-
while it was planned). An adjustment that cannot be saved changes nothing and
|
|
288
|
-
the receipt says so; a new preview that cannot be saved is dropped and has
|
|
289
|
-
to be planned again.
|
|
290
|
-
- Once publication of an adjusted preview has started (an item was sent, may
|
|
291
|
-
have landed or was found on the PR), the review is neither adjusted nor
|
|
292
|
-
planned again: `--publish` retries the same preview and `--show` shows it;
|
|
293
|
-
run a new review to change what is posted.
|
|
294
|
-
- Adjustments shape only what a publication adds; AZPR never changes or
|
|
295
|
-
replaces a posted comment. An item the PR already has (the same marker, from
|
|
296
|
-
an earlier publication; inline markers follow the anchored lines, not the
|
|
297
|
-
commit) is skipped as for any review and keeps its earlier text. For an
|
|
298
|
-
adjusted review the receipt names those items whose text differs from the
|
|
299
|
-
preview (also when a comment appears only as publication reads the threads
|
|
300
|
-
back), marks the summary and the comments whose severity you changed, and
|
|
301
|
-
counts the other AZPR comments on the PR, where a finding you excluded may
|
|
302
|
-
still be visible; edit them on the PR if they should change.
|
|
303
|
-
- `--show` prints the saved preview, with its adjustments, without a model or
|
|
304
|
-
an Azure DevOps request.
|
|
305
|
-
|
|
306
|
-
Without these options `/pr-comment` works as before: the planner's input and
|
|
307
|
-
system prompt, the saved review and the receipts are unchanged.
|
|
308
|
-
|
|
309
|
-
## Publication
|
|
310
|
-
|
|
311
|
-
Publication is deterministic runtime code using the Azure DevOps REST API
|
|
312
|
-
(api-version 7.1; see [Azure DevOps access](AZURE_DEVOPS.md)):
|
|
313
|
-
|
|
314
|
-
1. Read the PR and its iterations. Refuse if it is not active (INCOMPLETE) or if
|
|
315
|
-
its source commit differs from the reviewed head (STALE).
|
|
316
|
-
2. List every thread (one request returns all of them) and collect AZPR markers
|
|
317
|
-
from live comments.
|
|
318
|
-
3. For each saved item: skip it when its marker exists (`ALREADY_PRESENT`),
|
|
319
|
-
otherwise create it with the exact saved content and right-side coordinates
|
|
320
|
-
(`POSTED`); Azure DevOps attaches the iteration context itself. Each result
|
|
321
|
-
is saved immediately. A failed item does not stop the others (`FAILED`); a
|
|
322
|
-
create whose outcome is unknown (timeout, a lost connection, or a stop or
|
|
323
|
-
restart during the request) is `UNCERTAIN`. Writes are never retried
|
|
324
|
-
automatically.
|
|
325
|
-
4. List the threads again: created and uncertain items whose marker is present
|
|
326
|
-
become `VERIFIED`; an uncertain item without a marker stays `UNCERTAIN`,
|
|
327
|
-
because Azure DevOps may still finish the request. A created item whose
|
|
328
|
-
recorded thread is listed with its comment deleted is `DELETED`; one whose
|
|
329
|
-
marker is simply not found is `UNVERIFIED`.
|
|
330
|
-
|
|
331
|
-
Before each create, the attempt is recorded under `attempts/` in the state
|
|
332
|
-
directory, per PR and marker and shared by every review of that PR; an item
|
|
333
|
-
found on the PR is recorded with its thread as well. If that record cannot be
|
|
334
|
-
written before a create, nothing more is sent and the item is `FAILED`. A
|
|
335
|
-
later publication, from this review or another review of the same PR:
|
|
336
|
-
|
|
337
|
-
- never sends an item again whose create returned a thread ID, even while the
|
|
338
|
-
thread list does not show it yet (it is reported as `POSTED` or
|
|
339
|
-
`UNVERIFIED` with that thread) and even after someone deleted the comment
|
|
340
|
-
(`DELETED`);
|
|
341
|
-
- does not send an item with an unknown outcome until its marker appears or 15
|
|
342
|
-
minutes have passed since that attempt (`UNCERTAIN` until then);
|
|
343
|
-
- may send an item again whose create failed with a definite error.
|
|
344
|
-
|
|
345
|
-
Azure DevOps offers no way to confirm that an unknown create will never land.
|
|
346
|
-
After 15 minutes AZPR assumes it did not; a create the service completed even
|
|
347
|
-
later would appear twice.
|
|
348
|
-
|
|
349
|
-
One OpenCode process publishes one PR at a time. The record is not a lock
|
|
350
|
-
between processes: two separate OpenCode processes (for example a
|
|
351
|
-
`--standalone` instance next to the background service) that publish the same
|
|
352
|
-
PR at the same moment can both create an item. The TUI and desktop app use
|
|
353
|
-
the background service, so this needs a deliberately separate process.
|
|
354
|
-
|
|
355
|
-
The receipt status is `POSTED` when every item is verified, already present or
|
|
356
|
-
deleted on the PR, `PARTIALLY_POSTED` when some failed, and `FAILED` when none
|
|
357
|
-
succeeded. Run the same command again to finish: existing items are skipped by
|
|
358
|
-
their markers.
|
|
359
|
-
|
|
360
|
-
### Markers
|
|
361
|
-
|
|
362
|
-
Each item ends with `<!-- azpr-comment:<32 hex> -->`:
|
|
363
|
-
|
|
364
|
-
- Inline: hash of PR identity, file path, whitespace-normalized anchor text and
|
|
365
|
-
an ordinal for several comments on identical lines. No review ID or model
|
|
366
|
-
wording, so a later review of unchanged code finds the earlier comment and
|
|
367
|
-
does not post a duplicate. A different issue on exactly the same lines is
|
|
368
|
-
treated as already discussed; it stays in the report and the summary index.
|
|
369
|
-
- Summary: hash of PR identity, reviewed head and the inline markers, so a new
|
|
370
|
-
review of the same commit with the same comments does not post a second
|
|
371
|
-
summary.
|
|
372
|
-
|
|
373
|
-
A combined comment is one inline item with one marker; the publication
|
|
374
|
-
ledger records all its finding IDs (`findingIds`), and ledgers and plans saved
|
|
375
|
-
before that field existed are read as before.
|
|
376
|
-
|
|
377
|
-
Only an identical complete marker counts as already present. Neither the
|
|
378
|
-
review mode, the finding IDs nor the disclosure text is part of a marker, so a
|
|
379
|
-
`/pr-review` published after a `/pr-quick` of the same head finds the quick
|
|
380
|
-
comments: an inline comment on the same anchor with the same ordinal is
|
|
381
|
-
`ALREADY_PRESENT` (it keeps its quick disclosure; AZPR never edits it), a
|
|
382
|
-
second issue on that anchor has ordinal 1 and is posted, and the summary is
|
|
383
|
-
posted again only when the set of inline markers differs. A later review
|
|
384
|
-
therefore does not guarantee a summary that says it was verified.
|
|
385
|
-
|
|
386
|
-
A comment someone deletes on the PR stays deleted. Azure DevOps keeps listing
|
|
387
|
-
its thread, flagged deleted and without the comment's text, so the marker is
|
|
388
|
-
gone; AZPR recognizes the thread by the ID it recorded (from its create, or
|
|
389
|
-
from an earlier publication that found the comment) and reports the item as
|
|
390
|
-
`DELETED` instead of posting it again, also for a later review whose item has
|
|
391
|
-
the same marker. The record, and with it this protection, lasts 90 days from
|
|
392
|
-
when AZPR created or first found the comment; a comment deleted before this
|
|
393
|
-
machine's AZPR recorded it can be posted again.
|
|
394
|
-
|
|
395
|
-
## Retention
|
|
396
|
-
|
|
397
|
-
Plans and publication ledgers are saved with the review under
|
|
398
|
-
`${XDG_STATE_HOME:-~/.local/state}/opencode/azpr-v2/`. The newest 20 reviews are
|
|
399
|
-
kept; an evicted review cannot be commented on (run a new review).
|
package/docs/DEBUGGING.md
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
# Debugging reviews
|
|
2
|
-
|
|
3
|
-
Keep a failed run and inspect its original evidence before changing settings or
|
|
4
|
-
starting another model request. A passing test does not establish provider
|
|
5
|
-
acceptance, Azure source validity or report quality.
|
|
6
|
-
|
|
7
|
-
## A startup slash command becomes an ordinary prompt
|
|
8
|
-
|
|
9
|
-
On OpenCode 2.1.2 through 2.1.4, `opencode --prompt "/pr-review ..."` can
|
|
10
|
-
submit before a native Git package's command catalog has loaded. The host then
|
|
11
|
-
treats the text as an ordinary model prompt; AZPR has not received the command.
|
|
12
|
-
This was observed in local native-package TUI acceptance failures on 2.1.2 and
|
|
13
|
-
matches the host's
|
|
14
|
-
[startup submission](https://github.com/anomalyco/opencode/blob/v2.1.4/packages/tui/src/routes/home.tsx#L62)
|
|
15
|
-
and [command classification](https://github.com/anomalyco/opencode/blob/v2.1.4/packages/tui/src/component/prompt/index.tsx#L1153).
|
|
16
|
-
|
|
17
|
-
Start the TUI normally and wait for `/pr-review` to appear in slash-command
|
|
18
|
-
completion before submitting it. A command admitted by AZPR emits its own
|
|
19
|
-
`[AZPR ...] STARTED` receipt. Do not treat an ordinary assistant response as that
|
|
20
|
-
receipt or repeat a command without checking the original conversation. The
|
|
21
|
-
host fixture exercises interactive submission in both new and existing
|
|
22
|
-
conversations and verifies that `/pr-stop` cancels from that same TUI.
|
|
23
|
-
|
|
24
|
-
## Where things are
|
|
25
|
-
|
|
26
|
-
| Location | Contents |
|
|
27
|
-
| --- | --- |
|
|
28
|
-
| Receipt in the invoking conversation | Status, per-stage rows (role, shard, session, model, attempts, repair turns, tool errors/timeouts, failure class) and notices. |
|
|
29
|
-
| `PROGRESS` notices | Phases of the run: snapshot, shard counts, verification, retries, planning pages, posting. |
|
|
30
|
-
| The last review session (a verifier, or the duplicate check when one ran; the receipt names it) | The rendered report (`# AZPR <id> — <status>`). |
|
|
31
|
-
| `${XDG_STATE_HOME:-~/.local/state}/opencode/azpr-v2/reviews/` | Persisted completed reviews (plans and publication ledgers included). |
|
|
32
|
-
| `…/azpr-v2/receipts/` | Receipts that could not be queued to the conversation after three attempts. |
|
|
33
|
-
| `…/azpr-v2/data/` | Private source excerpts and large comment inputs for persisted reviews. |
|
|
34
|
-
| Debug directory (below) | Optional per-run diagnostics. |
|
|
35
|
-
|
|
36
|
-
## Enable diagnostics
|
|
37
|
-
|
|
38
|
-
In the settings file shown by `/pr-setup` (external configuration for native
|
|
39
|
-
packages, or installed `plugins/azpr-v2/settings.json` for source installs):
|
|
40
|
-
|
|
41
|
-
```json
|
|
42
|
-
{ "debug": { "enabled": true, "directory": "", "keepRuns": 20 }, "returnReport": "full" }
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Restart the OpenCode service (`opencode service restart`) after editing. An empty directory selects
|
|
46
|
-
`${XDG_STATE_HOME:-~/.local/state}/opencode/azpr-v2-debug/`; a relative path is
|
|
47
|
-
resolved against the active project. Each run creates a unique owner-only
|
|
48
|
-
directory named in the receipt. Debug data can contain source, PR details and
|
|
49
|
-
secrets echoed by a service; do not commit or upload it. When a run starts,
|
|
50
|
-
AZPR deletes its older run directories beyond `debug.keepRuns` (default 20;
|
|
51
|
-
`0` keeps all); a run still active in the same OpenCode process and anything
|
|
52
|
-
AZPR did not create are left alone. With debug enabled, private data of failed
|
|
53
|
-
runs is kept for inspection (stale scratch data is still removed after 24
|
|
54
|
-
hours), and every private session of a review that did not complete is kept
|
|
55
|
-
within the same limit of 20 runs.
|
|
56
|
-
|
|
57
|
-
| File | What it records |
|
|
58
|
-
| --- | --- |
|
|
59
|
-
| `run.json` | Run identity, relevant settings and start time. |
|
|
60
|
-
| `readiness.json` | Checked model slots, the Azure DevOps organization and api-version, and host capabilities. |
|
|
61
|
-
| `NN-ROLE.request.json` | Stage identity, the literal payload and the role instructions. |
|
|
62
|
-
| `NN-ROLE.response.json`, `NN-ROLE.response-repairN.json`, `NN-ROLE.response-follow-upN.json` | Visible answers of the first turn, each correction turn and a quick review's follow-up turn. |
|
|
63
|
-
| `NN-ROLE.result.json` | Status, repairs, unresolved issues, corrections, tool observations, failure class, timing and `tokens`: the token usage OpenCode reported for each model request of the stage (`input` without cached input, `cacheRead`, `cacheWrite`, `output`, `reasoning`), their sums and `cachedInputShare`. |
|
|
64
|
-
| `report.md` / `draft.md` | Rendered report or unconfirmed draft. |
|
|
65
|
-
| `comment-plan.json` | The saved plan with exact content, anchors, offsets and markers. |
|
|
66
|
-
| `azure-calls.jsonl` | Every Azure DevOps REST call, from the runtime and the reviewers' AZPR tools: method, call, file path or change page, attempt, HTTP status or error kind, duration, bytes, and whether it will be retried. Never credentials or comment bodies. |
|
|
67
|
-
| `result.json` | Final status, every stage record, Azure call and retry counts, the run's token totals with `cachedInputShare`, and warnings. A review records the comment step it hands on (`afterReview`: mode and source, when a step or `--no-comment` applies); an automatic comment run records `automatic` (mode, source, `sourceReview` and the reasons in `heldBack`). |
|
|
68
|
-
| `delivery.json` | Whether the final receipt was queued (and how many attempts). |
|
|
69
|
-
|
|
70
|
-
The numeric prefix is stage creation order; shards and verification sessions run
|
|
71
|
-
in parallel.
|
|
72
|
-
|
|
73
|
-
## Diagnosis order
|
|
74
|
-
|
|
75
|
-
1. `result.json`: which stage failed and its `failureClass`:
|
|
76
|
-
- `transient` was retried once in a new session (provider 408/409/425/429/5xx,
|
|
77
|
-
interrupted turn, unexpected message in the turn);
|
|
78
|
-
- `overflow` means the session needed compaction; the runtime split the shard;
|
|
79
|
-
- `permanent` (authentication, bad request) was not retried;
|
|
80
|
-
- `idle` means the stage inactivity watchdog stopped the stage after
|
|
81
|
-
`workflow.stageIdleSeconds` without activity; it was retried once in a new
|
|
82
|
-
session. Its error and `idleStop` name the last activity and when it
|
|
83
|
-
happened: after `model request N was sent` the model never answered,
|
|
84
|
-
after `model output was streamed` (or reasoning, or a tool call) the stream
|
|
85
|
-
stopped mid-answer, after `tool X started` a tool did not return, after
|
|
86
|
-
`tool X ended` no next model request came, after `shell asked for
|
|
87
|
-
approval` nobody approved;
|
|
88
|
-
- `cancelled` came from `/pr-stop`, a timeout or unload.
|
|
89
|
-
`requestObservations.retries` lists OpenCode's own retries of a provider
|
|
90
|
-
request (attempt, whether AZPR allowed it, the announced delay).
|
|
91
|
-
Receipt counters `stream-continuations` and `continuation-restarts` show
|
|
92
|
-
interrupted provider streams and answers the model started over.
|
|
93
|
-
2. The failed stage's request, response(s) and result together. `repairs` lists
|
|
94
|
-
what the runtime asked the model to correct; `unresolvedIssues` lists what
|
|
95
|
-
was still wrong after the last turn and therefore downgraded per item. For a
|
|
96
|
-
quick review, `sessionReads` counts the file contents that session's own
|
|
97
|
-
`azpr_read_diff` and `azpr_read_file` calls showed, the reads its location
|
|
98
|
-
checks accept; the result's `checks` hold each finding's location check.
|
|
99
|
-
`followUp` records a quick follow-up turn: the turn, the gaps the answer
|
|
100
|
-
named, how many assigned files it did not list as reviewed and the outcome
|
|
101
|
-
(`completed`, `still-partial`, `unusable`, or `failed` with its failure class
|
|
102
|
-
and error); the receipt shows `follow-up=<outcome>`.
|
|
103
|
-
3. Cost and prompt cache: `tokens` in each stage record. `cachedInputShare` is
|
|
104
|
-
`cacheRead / (input + cacheRead + cacheWrite)`. On a long session, a request
|
|
105
|
-
whose `cacheRead` is close to the previous request's prompt reused it; a run
|
|
106
|
-
that stays near 0% points at the host's cache affinity rather than at AZPR,
|
|
107
|
-
whose requests keep a stable prefix (OpenCode 2.0.22 with ChatGPT token
|
|
108
|
-
sharing sent no session headers; see [validation](VALIDATION.md)). Stages
|
|
109
|
-
that a cancellation interrupted have no `tokens`.
|
|
110
|
-
4. For comments: `comment-plan.json` and the publication ledger in the receipt.
|
|
111
|
-
`FAILED` and `UNVERIFIED` items are safe to publish again; existing items are
|
|
112
|
-
skipped by their markers, and an `UNVERIFIED` item is never sent twice.
|
|
113
|
-
`DELETED` items were deleted on the PR after AZPR created them and are not
|
|
114
|
-
posted again.
|
|
115
|
-
|
|
116
|
-
Common receipts:
|
|
117
|
-
|
|
118
|
-
| Message | Next step |
|
|
119
|
-
| --- | --- |
|
|
120
|
-
| `Azure DevOps rejected the PAT for organization …` | Renew or correct the PAT in `azure.pat` or the file named by `azure.patFile` (organization-scoped, Code Read, Pull Request Threads Read & write) and restart the OpenCode service. |
|
|
121
|
-
| `The provider reports the usage quota as used up (provider.quota)` / `OpenCode reports the free model's usage limit as reached (provider.free-limit)` | The stage failed without a new-session retry, which would fail the same way. Choose another model in the settings, or wait until the provider's quota or the free limit resets. |
|
|
122
|
-
| `azure.patFile could not be used …` / `azure.patFile changed since OpenCode loaded it` | Make it a regular file you own with only the PAT (`chmod 600`), or restart the OpenCode service after replacing it. |
|
|
123
|
-
| `Azure DevOps refused … (HTTP 403 …)` | Add the missing PAT scope or project/repository access. |
|
|
124
|
-
| `network error (ConnectionRefused)` with a hint to set `azure.proxy` | dev.azure.com is reachable only through a proxy; set `azure.proxy` (see [proxies](AZURE_DEVOPS.md#proxies-and-tls-inspection)). |
|
|
125
|
-
| `the server's TLS certificate was not accepted (…)` | The proxy inspects HTTPS; set `azure.caFile` to its root CA certificate. |
|
|
126
|
-
| `A proxy refused … (HTTP 407)` / `A proxy or gateway answered …` | The proxy wants credentials in `azure.proxy`, or it blocks dev.azure.com. |
|
|
127
|
-
| `azpr_read_file failed: …` in a stage's tool errors | The model asked for a missing path or invalid range; the review continues and reports the gap. |
|
|
128
|
-
| `permission.rejected` … `cannot use paths outside the local OpenCode project` | A reviewer used a native tool on a repository path; it was refused instead of waiting for an approval and the model was pointed to the azpr tools. |
|
|
129
|
-
| `settings.json changed since OpenCode loaded it` | Restart the OpenCode service. Running commands were unaffected. |
|
|
130
|
-
| `Host configuration changed private agent …` | Another config or plugin changed an `azpr-*` agent; resolve it and reload. |
|
|
131
|
-
| `No completed review is available for this conversation` | Run the comment command in the review's conversation, or run a new review. |
|
|
132
|
-
| `PR source commit changed after the review` | The PR got new commits; run a new review before commenting. |
|
|
133
|
-
| `Started automatically after review <id> completed (afterReview.review: preview)` or `(--publish)` | This comment run followed a COMPLETE review because of `afterReview` or the review command's flag; it is otherwise an ordinary `/pr-comment` run. |
|
|
134
|
-
| `Automatic publication held back N item(s) for a person: …` (status `POSTED` or another publication status) | Those items' text has an `@<…>` mention, an image, HTML that embeds content or runs a script, HTML that hides text (a comment, `<!…>`, `<?…>` or `</` without a tag name), or a `javascript:`, `vbscript:`, `data:` or `file://` link; the other items were published. Literal code counts only for mentions, or where its Markdown could be read another way (a fence in a list or after an HTML line, a backtick after a link, tag or bare address; see [commenting](COMMENTING.md)). Read the preview, then post the held items with `/pr-comment <id> --publish` (posted items are `ALREADY_PRESENT`). `result.json` lists them under `automatic.heldBack`. With status `STALE` nothing was posted and the line offers no command: the PR changed, so run a new review. |
|
|
135
|
-
| `Automatic publication held back every item: …` (status `PREVIEW`) | Every item was held for one of those reasons, so nothing was posted. Read the preview, then post it with `/pr-comment <id> --publish`. |
|
|
136
|
-
| `Automatic publication found nothing new to post: …` (status `NOTHING_TO_POST`) | Every finding is already discussed by a live thread of the PR, typically AZPR's own comment from an earlier run, so only a repeated summary would have been posted. Nothing needs doing; the plan is saved, and `/pr-comment <id> --publish` would post that summary. |
|
|
137
|
-
| `Automatic preview skipped: the review has no findings to comment on` (or `publication`) | Nothing was planned, posted or sent to a model. `/pr-comment <id>` still previews a summary-only comment. |
|
|
138
|
-
| `Automatic … skipped: another AZPR command is running in this conversation or on this PR` | Wait for that command, then run the `/pr-comment` command the notice names. |
|
|
139
|
-
| `Automatic comments are off for this review (stopped: …)` on a COMPLETE receipt | `/pr-stop`, a timeout or an unload arrived while the finished review's report was delivered. The review is kept; no comment step started. Run `/pr-comment <id>` to preview it. |
|
|
140
|
-
| `Unknown option after the PR URL` / `Use at most one of --preview, --publish or --no-comment` | Only these flags may follow the URL, at most one; start your context with a word. Nothing was started. |
|
|
141
|
-
| `SETUP REQUIRED` … `could not be used when OpenCode loaded AZPR: …` | The reason names the problem (no file yet, an unreadable file, invalid JSON, a setting that fails validation or an unusable PAT file) without its value. Fix it, then restart the OpenCode service. |
|
|
142
|
-
| `No --pat-file was given, and the default PAT file … could not be used` | `/pr-setup` looked for the PAT in `${XDG_CONFIG_HOME:-~/.config}/azpr/pat` (or, with `--replace`, the PAT file already set). Create it as the [quickstart](QUICKSTART.md#2-save-the-pat-in-a-private-file-terminal) shows, or name your file with `--pat-file`. Nothing was saved. |
|
|
143
|
-
| `/pr-check` row `AZPR` WARNING: `Another AZPR entry is configured but not running` | Two `plugins` entries load AZPR, usually after `opencode plugin add` with a new version; OpenCode runs the first and lists the other as a duplicate. Remove the one you do not want (see [upgrading](../README.md#upgrading)). |
|
|
144
|
-
| `This review's private data is no longer available` | The review was evicted or its data removed; run a new review. |
|
|
145
|
-
| Skipped finding: `The comment planner repeated a checkpoint without progress` or `did not finish the page in 4 sessions` | The planner kept asking for more reading on that page; the finding has no inline comment but stays in the summary index, and the other comments were planned as usual. Inspect the page's planning stages; `/pr-comment <id>` (a preview) plans again. |
|
|
146
|
-
| `Stage inactivity watchdog stopped this stage: no activity for … s after …` (`failure=idle`, plus an inactivity notice) | The model stream, a tool or OpenCode stopped responding for `workflow.stageIdleSeconds`; the stage ran again in a new session. Repeated stops after `model request N was sent` point at the provider. Raise the setting only if a model really needs longer for one answer (live stages so far stayed under 151 s without any event). |
|