opencode-azure-devops-pr-review 0.2.3 → 0.3.0

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.
@@ -1,12 +1,176 @@
1
1
  # Validation
2
2
 
3
3
  This page records validation of the Azure DevOps REST implementation and the
4
- 0.1.0, 0.2.0, 0.2.1, 0.2.2 and 0.2.3 distributions. Host integration, provider
4
+ 0.1.0, 0.2.0, 0.2.1, 0.2.2 and 0.2.3 distributions, and the 0.3.0 release
5
+ candidate. Host integration, provider
5
6
  admission, source fidelity, model quality and publication are separate claims; a
6
7
  passing fixture establishes only the first. Earlier revisions and their live
7
8
  acceptance runs, including the MCP-based runs, are preserved in
8
9
  [validation history](VALIDATION_HISTORY.md).
9
10
 
11
+ ## Summary
12
+
13
+ - **Every change, in CI.** `npm run check` and the offline test suite, then
14
+ five runs on the real OpenCode 2.1.4 host with isolated profiles and fake
15
+ model and Azure DevOps services: fresh, replacement and native installation
16
+ (including an authenticating proxy and a custom CA certificate), a 120-file
17
+ review in shards with a context-overflow split and idempotent publication,
18
+ and a refused background summary followed by a permanent failure.
19
+ - **Live, with real models on Azure DevOps Services.** Reviews, comment
20
+ previews and publication on three test PRs with 1, 35 and 316 changed
21
+ files. On OpenCode 2.1.4 with gpt-6-luna, all six quick and review runs
22
+ completed without a retry or a failed stage; both modes found all 24 seeded
23
+ policy defects of the 316-file PR and the 3 known defects of the 1-file PR.
24
+ Live automatic publication on the 35-file PR (OpenCode 2.1.2) posted and
25
+ read back its comments, and a second run on the unchanged PR wrote nothing.
26
+ - **Every release.** Following the [releasing guide](RELEASING.md), the
27
+ candidate is installed from a clean source archive and from its public Git
28
+ commit before it is tagged, and the published npm package is installed from
29
+ the registry; its integrity must match the package built from the tag.
30
+
31
+ These checks show that the workflow works and what it found on these test
32
+ PRs. Findings vary between models and runs, so they are not a general
33
+ accuracy score; see [known limitations](#known-limitations).
34
+
35
+ ## 0.3.0 release candidate acceptance (2026-10-26)
36
+
37
+ Environment: Ubuntu 22.04.5 under WSL2, Node 22.23.3, npm 10.9.9 and OpenCode
38
+ CLI 2.1.4. The candidate contains the finding-adjustment workflow merged in
39
+ PR #29, including the final fixes in `d4fd8dd`. Release preparation changes
40
+ the package version, description, documentation and recording tool, and adds
41
+ the code of conduct and a recorded demonstration to the npm package; the
42
+ runtime, prompts, settings and installers are unchanged from that reviewed
43
+ revision.
44
+
45
+ - `npm run check` and **417 offline tests** passed, including the adjustment
46
+ save failure, the final summary's excluded-ID check, and an earlier comment
47
+ read back after a refused write without a local publication record.
48
+ - All five real-host fixtures passed with isolated profiles and fake model
49
+ and Azure services: fresh source installation, replacement installation,
50
+ native packed package installation, comment scale and background compaction.
51
+ Fresh and native runs cover the authenticating proxy, custom CA, external
52
+ settings, restart and idempotent publication. The scale fixture reviewed
53
+ 120 files with one overflow split and eight planning sessions, at most two
54
+ in flight; its largest provider request was 33,419 characters. The
55
+ background-compaction fixture classified the failure as permanent and ran
56
+ one functional session.
57
+ - `npm pack --dry-run --json` lists **75 files**, including the entry, runtime,
58
+ prompts, configuration example and schema, license, code of conduct, 0.3.0
59
+ release notes and the new demonstration media. Tests, private settings and
60
+ `.local/` records are excluded.
61
+ - These release fixtures make no paid-model request or real Azure publication.
62
+ The live adjustment runs below used the earlier `cbbed6b` implementation;
63
+ the subsequent persistence, read-back and final-summary fixes have offline
64
+ regression tests. Host fixtures exercise the surrounding workflow.
65
+ - A live run on the candidate's runtime was recorded for the
66
+ [demonstration](DEMO.md): OpenCode 2.1.4 with `openai/gpt-6-luna`, the plugin
67
+ installed from public Git commit `dfba561`, on the 1-file test PR. The review
68
+ completed in 66 seconds with three confirmed findings and two merged
69
+ duplicates, and its automatic preview took 14 seconds. `--exclude F-3
70
+ --severity F-2=low` planned a new preview in 8 seconds with one inline
71
+ comment and F-2 in the summary only. Publication posted the summary and that
72
+ comment, both read back as `VERIFIED`, and a repeated publication reported
73
+ `ALREADY_PRESENT=2`. This run took the normal adjustment and publication
74
+ path; the failure paths of the later fixes are covered by the offline tests.
75
+
76
+ This is a pre-publication record. Public Git installation and clean-source
77
+ archive acceptance are checked on the release candidate; registry integrity
78
+ and installation from npm are checked only after publication, following the
79
+ [releasing guide](RELEASING.md). This record does not claim a published 0.3.0
80
+ package has been tested.
81
+
82
+ ## Adjusting findings after a preview (2026-10-25)
83
+
84
+ Commit `cbbed6b` (branch `comment-adjustments`) was installed through
85
+ OpenCode's plugin manager as `github:WTLAIB/opencode-azure-devops-pr-review-v2#cbbed6b…`
86
+ on the OpenCode 2.1.4 service (its 29 installed files equal the commit), with
87
+ gpt-6-luna for every review and quick role, gpt-6.1-sol for every deep role,
88
+ output in zh-TW and `afterReview` none for every mode; the service was restored to the published 0.2.3 package
89
+ afterwards. Every command ran in the conversation of its review unless noted.
90
+ Before the runs that publish, the earlier AZPR comments of the 1-file PR were
91
+ deleted and the local publication records of the 1-file and 316-file PRs were
92
+ moved aside, so that comments on the same lines were posted again instead of
93
+ being reported as `DELETED`.
94
+
95
+ **Preview only, with the earlier comments still on the 1-file PR.** Its four
96
+ AZPR threads made the planner skip all three findings as already discussed, so
97
+ these previews had no inline comment.
98
+
99
+ | Command | Planner input | Result | Planning |
100
+ | --- | --- | --- | --- |
101
+ | `/pr-review <URL>` | — | COMPLETE in 89 s: 6 candidates, 3 confirmed medium findings F-1, F-2, F-3 (the 3 known defects) | — |
102
+ | `/pr-comment` | F-1, F-2, F-3; no `adjustments` field | Index medium 3; the review note named the snapshot, reservation and ordering contracts | 1 request, 9 s |
103
+ | `/pr-comment <id> --show` | — | The saved preview; no model or Azure DevOps request | — |
104
+ | `/pr-comment <id> --exclude f1` | F-2, F-3; `adjustments.excludedFindings` F-1 | Index medium 2; F-1 named nowhere, and the note no longer mentioned the snapshot contract | 1 request, 12 s |
105
+ | `/pr-comment <id> --severity F-2=low,F-3=high` | F-2 low, F-3 high; F-1 still excluded; `severityChanges` | Index high 1, low 1; F-2 skipped as low severity | 1 request, 5 s |
106
+ | The same adjustments again | — | "already has these adjustments; nothing was planned"; no model | — |
107
+ | `/pr-comment <id> --reset` | F-1, F-2, F-3; no `adjustments` field | Index medium 3, as before the adjustments | 1 request, 8 s |
108
+
109
+ **The 1-file PR without earlier comments** (three reviews, each COMPLETE in
110
+ 86–93 s):
111
+
112
+ - Review A: excluding all three findings answered `NOTHING_TO_POST` in 3 s
113
+ without a model, and `--publish` posted nothing. `--exclude none` stopped
114
+ with `/pr-stop` while it was planned ended `CANCELLED` with the adjustment
115
+ saved and no preview: `--publish` was refused ("was adjusted and has no
116
+ preview planned since") and `--show` reported no saved preview. Setting all
117
+ three to low then planned a summary without inline comments, which was posted.
118
+ - Review B, of the same commit: excluding one finding and setting the other two
119
+ to low gave a summary with the marker of review A's summary. Publication
120
+ skipped it as `ALREADY_PRESENT`, and the receipt said that the PR keeps its
121
+ earlier text, which may still list findings you excluded. Afterwards
122
+ `--exclude none` and a plain `/pr-comment <id>` were refused, `--show` said
123
+ that publication had started, and `--publish` again changed nothing.
124
+ - Review C confirmed five medium findings, two pairs of them the same defects
125
+ from both reviewers (F-1 and R-1, F-2 and R-3). `--exclude R-1,R-3 --severity
126
+ R-2=high,F-2=low` planned 2 inline comments (R-2 high, F-1 medium) and a
127
+ summary with high 1, medium 1, low 1; all three were posted and read back,
128
+ and no posted text names R-1 or R-3. They were deleted again before the deep
129
+ run below.
130
+ - `/pr-deep` COMPLETE in 116 s: 6 candidates, 3 confirmed medium findings
131
+ (the verifier merged the duplicates). `--exclude F-3 --severity F-1=high`,
132
+ planned by gpt-6.1-sol in 19 s (1 request, no correction turn), gave 2 inline
133
+ comments (F-1 high, F-2 medium) and a summary with high 1, medium 1; all
134
+ three were posted and read back with the gpt-6.1-sol disclosure, and no
135
+ posted text names F-3. Afterwards an adjustment was refused and `--publish`
136
+ again reported `ALREADY_PRESENT` for all three. These comments are kept on
137
+ the PR.
138
+
139
+ **The 316-file PR** (no comments before):
140
+
141
+ - `/pr-quick` COMPLETE in 186 s (48 findings reported), preview with 25 inline
142
+ comments, 13 of them combining findings of two shards. `--exclude Q-11001
143
+ --severity Q-12014=medium,Q-1013=low` (preview only, 102 s): Q-1001, combined
144
+ with Q-11001 before, got a comment of its own; Q-12014, raised from low, was
145
+ combined with Q-1022 on the same line; Q-1013 stayed in the summary only; the
146
+ disclosure still says the review was not independently verified, and the
147
+ preview names Q-11001 nowhere.
148
+ - `/pr-review` COMPLETE in 333 s: 27 confirmed (37 merged), preview with 26
149
+ inline comments and 1 low finding in the summary. R-1009, R-1010 and R-1011
150
+ repeat F-1009, F-1010 and F-1011 from the other reviewer.
151
+ - Refused without a change: the same command from another conversation ("No
152
+ completed review is available for this conversation"), `--exclude F-9999`
153
+ ("not a finding of review …", listing the IDs that can be adjusted) and
154
+ `--exclude R-1001` ("was merged into F-1001; adjust F-1001 instead").
155
+ - `--exclude R-1009` with the OpenCode service restarted while it was planned:
156
+ the service reloaded in 7 s; `--show` reported no saved preview and
157
+ `--publish` was refused. A plain `/pr-comment <id>` then planned the preview
158
+ with R-1009 still excluded (85 s).
159
+ - `--exclude R-1009,R-1010,R-1011 --severity F-1013=high,F-1016=low,F-1022=medium`
160
+ (63 s) planned 23 inline comments and a summary with high 5, medium 18, low 1:
161
+ F-1013 titled high, F-1022 (raised from low) with an inline comment, F-1016
162
+ in the summary only. All 24 items were posted and read back; the three
163
+ repeated defects have one comment each, and no posted text names R-1009,
164
+ R-1010 or R-1011. After publication, adjustments and a plain re-plan were
165
+ refused and `--publish` again reported `ALREADY_PRESENT` for all 24 items.
166
+ These comments are kept on the PR.
167
+
168
+ No planning stage of these runs needed a correction turn, and the runtime's
169
+ check for published text that names an excluded finding never had to act: the
170
+ model left excluded findings out of its text. That check, and the receipt line
171
+ that counts other AZPR comments of the PR, are covered by the offline tests
172
+ only.
173
+
10
174
  ## 0.2.3 release acceptance (2026-10-24)
11
175
 
12
176
  Environment: Ubuntu 22.04.5 under WSL2, Node 22.23.3 and OpenCode CLI 2.1.4.
@@ -294,7 +458,7 @@ problem messages were added on top of 0.1.0; review prompts were unchanged.
294
458
  and all but 0 to 6 of them render no active markup. Those few contain
295
459
  `<!X…>` or `<?…>`, which browsers turn into comments and no rule checks;
296
460
  the previous revision held them only because of code elsewhere in the
297
- text. The same run found the gaps listed under Not yet validated.
461
+ text. The same run found the gaps closed below.
298
462
  - All four real-host fixtures passed on OpenCode 2.1.2. The 15 previews
299
463
  saved from real reviews still have no held item. No live run: real
300
464
  comment text has not contained the held constructs, in code or not.
@@ -1876,38 +2040,27 @@ So host retries needed no change. The watchdog's default of 600 s is four
1876
2040
  times the longest quiet stretch observed; a stopped stage is retried like a
1877
2041
  transient failure, and its error names the last activity.
1878
2042
 
1879
- ## Not yet validated
1880
-
1881
- - Automatic publication from the setting (`afterReview: publish`) with a
1882
- real model: the live publications above used the `--publish` flag, which
1883
- differs only in where the step comes from. The item checks did not trigger
1884
- in any live run, since real comment text had none of the held constructs;
1885
- they were validated with the fixture services and the saved live previews
1886
- only. A quick review's automatic publication has not run live. The
1887
- repeated-summary rule did trigger live (above).
1888
- - Azure DevOps's own rendering and sanitizing of comments was not tested
1889
- against the content checks of automatic publication: the fuzzing rendered
1890
- with commonmark.js and markdown-it and read the HTML with parse5.
1891
- - A defect whose evidence spans a test and unchanged code in different shards
1892
- is found by gpt-6.1-sol (2 of 2 runs on PR #4) and missed by gpt-5.6-luna and
1893
- gpt-6-luna; other PRs are not yet measured.
1894
- - Azure DevOps Server, and repository files that are not UTF-8 text.
1895
- - `azure.caFile` with a real proxy: the corporate network above ran with
1896
- `verifyTls: false`; whether its proxy inspects TLS, and trusting its root CA
1897
- instead, were not checked. `azure.caFile` was validated with the fixture
1898
- proxy and CA above only. Proxies that require NTLM or Kerberos are not
1899
- supported directly.
1900
- - The stage inactivity watchdog with a real provider: no live stall has
1901
- occurred since it was added. It was validated with the fixture provider's
1902
- stalled HTTP stream; a stalled OpenAI WebSocket stream was not produced on
1903
- purpose.
1904
- - Streamed reasoning from a real reasoning model: the fixture streams answer
1905
- text only. A model that thinks without streaming anything looks silent to
1906
- the watchdog for that time.
1907
- - Planning more than two pages at a time (not measured), and `/pr-stop` while
1908
- pages are planned side by side with a real provider (only the fixtures and
1909
- offline tests cancel running pages).
1910
- - `/pr-quick` beyond these runs on three test PRs with one model: its
1911
- false-positive rate and misses on other PRs and models, a published quick
1912
- review of a multi-shard PR (only the 1-file PR's was posted), and combining
1913
- duplicates on a real multi-shard PR other than the test PR.
2043
+ ## Known limitations
2044
+
2045
+ - **Tested environment.** OpenCode CLI 2.1.4 (V2 plugin API) on Ubuntu 22.04
2046
+ under WSL2. Other OpenCode 2.x versions add a host notice to receipts and
2047
+ are not validated; OpenCode 1.x is not supported. Other operating systems
2048
+ are not validated yet.
2049
+ - **Azure DevOps Services only.** Azure DevOps Server (on-premises) is not
2050
+ supported by the current URL handling.
2051
+ - **File encoding and size.** Files are read as UTF-8, so text in another
2052
+ encoding, such as Big5 or Shift_JIS, reaches the reviewers with replacement
2053
+ characters. Binary files and files over 10 MB are reported but not shown,
2054
+ and content search covers a commit archive of at most
2055
+ `azure.archiveMegabytes` (100 MB by default).
2056
+ - **Corporate proxies.** AZPR has run live through a company HTTP proxy with
2057
+ `azure.verifyTls: false`. Trusting an inspecting proxy's root CA with
2058
+ `azure.caFile` is verified with a test proxy only, and proxies that require
2059
+ NTLM or Kerberos authentication are not supported directly.
2060
+ - **Quick reviews are not independently verified.** `/pr-quick` reports what
2061
+ one reviewer per shard found and says so in its report and comments; use
2062
+ `/pr-review` when findings need a second check.
2063
+ - **Findings depend on the model.** Results vary between models and between
2064
+ runs of the same model. On the 35-file test PR, gpt-6.1-sol found a defect
2065
+ whose evidence spans a test and unchanged code in another shard, which
2066
+ gpt-6-luna missed; `/pr-deep` runs the same review with stronger models.
@@ -23,6 +23,46 @@ is implied by the source audit or offline checks. Record any later host smoke
23
23
  result with its exact scope instead of promoting it to full service acceptance.
24
24
 
25
25
 
26
+ ## Open items as of 2026-10-23 (archived 2026-10-24)
27
+
28
+ Until 2026-10-24 the current validation page listed the following items under
29
+ "Not yet validated". It now keeps a shorter list of known limitations for
30
+ users; the items are preserved here as written.
31
+
32
+ - Automatic publication from the setting (`afterReview: publish`) with a
33
+ real model: the live publications above used the `--publish` flag, which
34
+ differs only in where the step comes from. The item checks did not trigger
35
+ in any live run, since real comment text had none of the held constructs;
36
+ they were validated with the fixture services and the saved live previews
37
+ only. A quick review's automatic publication has not run live. The
38
+ repeated-summary rule did trigger live (above).
39
+ - Azure DevOps's own rendering and sanitizing of comments was not tested
40
+ against the content checks of automatic publication: the fuzzing rendered
41
+ with commonmark.js and markdown-it and read the HTML with parse5.
42
+ - A defect whose evidence spans a test and unchanged code in different shards
43
+ is found by gpt-6.1-sol (2 of 2 runs on PR #4) and missed by gpt-5.6-luna and
44
+ gpt-6-luna; other PRs are not yet measured.
45
+ - Azure DevOps Server, and repository files that are not UTF-8 text.
46
+ - `azure.caFile` with a real proxy: the corporate network above ran with
47
+ `verifyTls: false`; whether its proxy inspects TLS, and trusting its root CA
48
+ instead, were not checked. `azure.caFile` was validated with the fixture
49
+ proxy and CA above only. Proxies that require NTLM or Kerberos are not
50
+ supported directly.
51
+ - The stage inactivity watchdog with a real provider: no live stall has
52
+ occurred since it was added. It was validated with the fixture provider's
53
+ stalled HTTP stream; a stalled OpenAI WebSocket stream was not produced on
54
+ purpose.
55
+ - Streamed reasoning from a real reasoning model: the fixture streams answer
56
+ text only. A model that thinks without streaming anything looks silent to
57
+ the watchdog for that time.
58
+ - Planning more than two pages at a time (not measured), and `/pr-stop` while
59
+ pages are planned side by side with a real provider (only the fixtures and
60
+ offline tests cancel running pages).
61
+ - `/pr-quick` beyond these runs on three test PRs with one model: its
62
+ false-positive rate and misses on other PRs and models, a published quick
63
+ review of a multi-shard PR (only the 1-file PR's was posted), and combining
64
+ duplicates on a real multi-shard PR other than the test PR.
65
+
26
66
  ## Previous current validation — stability revision fd604a8 (archived 2026-10-10)
27
67
 
28
68
  This section is the validation page as it stood before AZPR replaced the Azure DevOps MCP server with its own REST client. It describes the MCP-based runtime calls and is kept unchanged below.
@@ -74,8 +74,15 @@ emoji-capable font with `--emoji-font /absolute/path/to/font.ttf`; fonts are not
74
74
  copied into the media or distributed with this project. Use `--crop-bottom 2`
75
75
  when the last two terminal rows contain only the local status/path bar and a
76
76
  blank margin. This crops the rendered viewport, adds a visible crop disclosure,
77
- and leaves the original cast untouched. Inspect the rows first; never crop a
78
- finding or result.
77
+ and leaves the original cast untouched; the rendered image omits the cropped
78
+ rows. Crop the empty input box too when it names a chat model that the AZPR run
79
+ did not use. Inspect the rows first; never crop a finding or result.
80
+
81
+ OpenCode 2.1.4's TUI shows a sidebar on wide terminals. Hide it before the
82
+ segments you show by sending its toggle through the control file
83
+ (`{"text":"\u0018"}`, then `{"text":"b"}`). Receipts name the private debug
84
+ directory, which includes the local path; leave frames that show it out of the
85
+ edit.
79
86
 
80
87
  Create an edit manifest describing the portions of the original recording to
81
88
  show. `start` and `end` are seconds in the cast. `seconds` is the output duration.
Binary file
@@ -45,7 +45,7 @@ small_font = ImageFont.truetype(str(args.font), 12)
45
45
  cell_width, cell_height = font.getlength('M'), 21
46
46
  padding, top, bottom = 24, 88, 45
47
47
  width = round(header['width'] * cell_width + padding * 2)
48
- height = header['height'] * cell_height + top + bottom
48
+ height = visible_rows * cell_height + top + bottom
49
49
  width += width % 2
50
50
  height += height % 2
51
51
  palette = {'black': '#1c2028', 'red': '#ec7279', 'green': '#9dd39b',
@@ -0,0 +1,125 @@
1
+ # Azure DevOps PR Review for OpenCode — 0.3.0
2
+
3
+ AI reviews. You decide what gets posted. This release lets you exclude findings
4
+ or change their severity after reading a comment preview. AZPR prepares a new
5
+ preview without rerunning the review, while keeping the original findings and
6
+ report intact.
7
+
8
+ ## Try it after a preview
9
+
10
+ Use your review ID and finding IDs from its report:
11
+
12
+ ```text
13
+ /pr-comment <review-id> --exclude F-1 --severity F-2=low
14
+ ```
15
+
16
+ F-1 is excluded from the new preview; F-2 appears as low in the summary, with no
17
+ new inline comment. Comment planning uses a model again, so other wording may
18
+ change. Read the whole new preview, then publish from the same conversation:
19
+
20
+ ```text
21
+ /pr-comment <review-id> --publish
22
+ ```
23
+
24
+ ## What changed
25
+
26
+ - **Choose the findings and severity.** `--exclude` and `--severity` each
27
+ replace their own saved list; `none` empties that list. For example,
28
+ `--exclude F-1` followed by `--exclude F-2` excludes only F-2. Name both to
29
+ keep both out. `--reset` clears both lists and plans again. A changed
30
+ severity changes publication, not the evidence or verification of a finding.
31
+ Excluding every finding plans and posts nothing (`NOTHING_TO_POST`).
32
+ - **Reopen the saved preview.** `/pr-comment [review-id] --show` displays it
33
+ without a model or Azure DevOps request. It includes the saved adjustments.
34
+ - **Read the new preview before publishing.** An adjusted review, including
35
+ one reset since, needs a saved preview planned after its latest adjustment.
36
+ Adjustments are saved together with dropping the earlier preview; a failed
37
+ save changes nothing. A new preview whose save fails is dropped. After a
38
+ stop or restart during planning, prepare a new preview before publishing.
39
+ Once publication starts, the review cannot be adjusted or planned again;
40
+ `--publish` retries the same saved content.
41
+ - **Excluded IDs stay out of new comments.** The planner receives the adjusted
42
+ findings, and the assembled preview is checked too. When a retained
43
+ finding's summary names an excluded ID, publication is held until you
44
+ exclude that finding as well or restore the other. References without the
45
+ ID cannot be detected by this check.
46
+ - **Earlier PR comments keep their text.** AZPR still skips comments it already
47
+ posted and never edits them. An adjusted review's receipt names items whose
48
+ actual text differs from the preview, including comments that appear only
49
+ when AZPR reads the threads back. It also counts other AZPR comments on the
50
+ PR, where an excluded finding may still be visible.
51
+ - The README opens with a real OpenCode 2.1.4 recording of adjusting findings
52
+ and publishing, and the README and quickstart show the adjustment workflow.
53
+ The npm package includes the code of conduct. CI actions are pinned by commit
54
+ and updated with Dependabot.
55
+
56
+ The options work with review, deep and quick results. Quick findings remain
57
+ not independently verified. Without adjustments, comment planning and
58
+ publication retain their existing behavior. See the
59
+ [commenting guide](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/blob/v0.3.0/docs/COMMENTING.md#adjusting-findings-after-a-preview)
60
+ for the complete rules.
61
+
62
+ ## Installation
63
+
64
+ ```sh
65
+ opencode plugin add opencode-azure-devops-pr-review@0.3.0
66
+ ```
67
+
68
+ Alternatively, install the same release from Git:
69
+
70
+ ```sh
71
+ opencode plugin add 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.3.0'
72
+ ```
73
+
74
+ Add only one of them. Follow the
75
+ [quickstart](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/blob/v0.3.0/docs/QUICKSTART.md)
76
+ for a private PAT file, `/pr-setup`, a service restart and the first review.
77
+
78
+ ## Upgrading
79
+
80
+ For a native installation, edit its existing entry in the OpenCode
81
+ configuration's `plugins` list:
82
+
83
+ - For npm, change the package specification to
84
+ `opencode-azure-devops-pr-review@0.3.0`.
85
+ - For Git, change the tag suffix to `#v0.3.0`.
86
+
87
+ If the entry is an object, change only `package`; preserve `options.settingsFile`
88
+ and any other options. Keep one AZPR entry and restart the OpenCode service.
89
+ External settings, the PAT file and review records remain in place; a working
90
+ configuration needs no new `/pr-setup`. Exact version pins are not advanced by
91
+ `opencode plugin update`. This release adds no settings or required migration.
92
+
93
+ For a source installation, extract the new archive and run its installer with
94
+ `--replace` to retain settings:
95
+
96
+ ```sh
97
+ sh install.sh --config-dir /absolute/path/to/v2-opencode-config --replace
98
+ ```
99
+
100
+ Automatic comments remain opt-in through `afterReview` or a review command
101
+ flag. Use `/pr-review <PR URL> --preview` when you want to inspect and adjust
102
+ findings before publication.
103
+
104
+ ## Compatibility and validation
105
+
106
+ The tested target remains OpenCode CLI **2.1.4** (V2 plugin API), Node.js
107
+ **22.23.3**, Ubuntu **22.04.5** under WSL2, and Azure DevOps Services REST API
108
+ **7.1**. OpenCode 1.x and Azure DevOps Server are not supported; other operating
109
+ systems remain unvalidated.
110
+
111
+ The [validation record](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/blob/v0.3.0/docs/VALIDATION.md)
112
+ separates release checks with fake services from live runs. The earlier live
113
+ adjustment runs on 1-file and 316-file Azure DevOps test PRs preceded the final
114
+ persistence and read-back fixes; a recorded live run on the 1-file test PR used
115
+ this release's runtime. None of them establish a general review accuracy score.
116
+
117
+ The npm package, Git package and source archive contain the same runtime, with
118
+ no npm dependencies or install scripts. The release source artifact is
119
+ `opencode-azure-devops-pr-review-v2-0.3.0.tar.gz`, with checksums in `SHA256SUMS`.
120
+ The README's 15-second recording of adjusting findings and publishing comes
121
+ from that live run. The earlier walkthrough of the review, preview and
122
+ publication workflow remains attached to
123
+ [v0.2.0](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/releases/tag/v0.2.0).
124
+ The [demo guide](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/blob/v0.3.0/docs/DEMO.md)
125
+ describes both recordings.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "opencode-azure-devops-pr-review",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
- "description": "Azure DevOps PR reviews from a URL in OpenCode, with no checkout, configurable models, separate verification, and comment previews",
5
+ "description": "Azure DevOps PR reviews from a URL in OpenCode, with no checkout, configurable models, separate verification, and comment previews you can adjust before posting",
6
6
  "scripts": {
7
7
  "test": "node --test tests/*.test.mjs",
8
8
  "check": "node --check src/session.mjs && node --check src/runtime.mjs && node --check src/comment-data.mjs && node --check src/comment-work.mjs && node --check src/comments.mjs && node --check src/config.mjs && node --check src/output.mjs && node --check src/diagnostics.mjs && node --check src/attribution.mjs && node --check src/host.mjs && node --check src/tool-queue.mjs && node --check src/azure.mjs && node --check src/diff.mjs && node --check src/search.mjs && node --check src/review-tools.mjs && node --check src/review-work.mjs && node --check src/store.mjs && node --check src/plugin.js && node --check src/setup.mjs && node --check server.js && sh -n install.sh && sh -n uninstall.sh"
@@ -44,6 +44,7 @@
44
44
  "docs/",
45
45
  "AGENTS.md",
46
46
  "CONTRIBUTING.md",
47
+ "CODE_OF_CONDUCT.md",
47
48
  "SECURITY.md"
48
49
  ],
49
50
  "publishConfig": {
@@ -236,7 +236,7 @@ export function renderCheckReport(snapshot, checks, readiness) {
236
236
  /** Publication ledger rows for receipts. */
237
237
  export function renderPublication(review, result) {
238
238
  const rows = [...(review.publication ?? new Map()).values()].map(entry =>
239
- `- ${entry.kind === 'summary' ? 'PR summary' : `${(entry.findingIds ?? [entry.findingId]).join(', ')} (${entry.path}:${entry.startLine})`}: ${entry.state}${entry.threadId ? `; thread=${entry.threadId}` : ''}${entry.error ? `; error=${entry.error}` : ''}${entry.contentMismatch ? '; returned text differs' : ''}`).join('\n');
239
+ `- ${entry.kind === 'summary' ? 'PR summary' : `${(entry.findingIds ?? [entry.findingId]).join(', ')} (${entry.path}:${entry.startLine})`}: ${entry.state}${entry.threadId ? `; thread=${entry.threadId}` : ''}${entry.error ? `; error=${entry.error}` : ''}${entry.contentMismatch ? '; returned text differs' : ''}${entry.earlierText ? '; the PR keeps its earlier text' : ''}`).join('\n');
240
240
  const counts = result?.counts ? Object.entries(result.counts).map(([state, count]) => `${state}=${count}`).join(', ') : '';
241
241
  return `Publication${counts ? ` (${counts})` : ''}${result?.readBack && result.readBack !== 'complete' ? `; read-back ${result.readBack}` : ''}:\n${rows || '- Nothing recorded.'}\n\nPOSTED/VERIFIED entries were created by AZPR and VERIFIED ones were read back from Azure DevOps. ALREADY_PRESENT entries existed before this run. DELETED entries were created by AZPR and later deleted on the PR; AZPR does not post them again. FAILED entries are safe to retry with /pr-comment ${review.id} --publish; existing comments are skipped by their markers. UNVERIFIED entries were created but not found when read back; a re-run checks them again and never posts them twice. UNCERTAIN entries may still appear from an earlier attempt and are retried only after their marker check settles.`;
242
242
  }
package/src/azure.mjs CHANGED
@@ -220,6 +220,21 @@ export function markersInThreads(threads) {
220
220
  return found;
221
221
  }
222
222
 
223
+ /** The text of the live comment that carries each marker, found as markersInThreads finds its thread. */
224
+ export function markerTexts(threads) {
225
+ const found = new Map();
226
+ for (const thread of threads) {
227
+ if (thread?.isDeleted === true) continue;
228
+ for (const comment of Array.isArray(thread?.comments) ? thread.comments : []) {
229
+ if (comment?.isDeleted === true || typeof comment?.content !== 'string') continue;
230
+ for (const match of comment.content.matchAll(MARKER_PATTERN)) {
231
+ if (!found.has(match[0])) found.set(match[0], comment.content);
232
+ }
233
+ }
234
+ }
235
+ return found;
236
+ }
237
+
223
238
  /**
224
239
  * IDs of threads whose first comment, the one AZPR posts when it creates a
225
240
  * thread, was deleted on the PR. Azure DevOps keeps listing such a thread
@@ -1,7 +1,7 @@
1
1
  // Comment planning (model pages) and deterministic, idempotent publication.
2
- import { publishableFindings, publicationItems, evaluatePlanPage, planRepairPrompt, assemblePlan, parseLocation, reviewVerification } from './comments.mjs';
2
+ import { commentFindings, adjustmentInput, publicationItems, evaluatePlanPage, planRepairPrompt, assemblePlan, parseLocation, reviewVerification } from './comments.mjs';
3
3
  import { observationIndex, anchorObservations, compactDispositions, textPages, itemPages, PAGE_CHARACTERS } from './comment-data.mjs';
4
- import { markersInThreads, deletedThreads } from './azure.mjs';
4
+ import { markersInThreads, markerTexts, deletedThreads } from './azure.mjs';
5
5
  import { parseModelJSON, syntaxProblem } from './output.mjs';
6
6
 
7
7
  const text = value => typeof value === 'string' && value.trim().length > 0;
@@ -131,6 +131,8 @@ async function planningInput(review, store, findings, report, work, continuation
131
131
  description: await store.pack(description ?? '', 3000) },
132
132
  outputLanguage: review.outputLanguage,
133
133
  findings,
134
+ // Only when a person adjusted the findings after a preview; the input is otherwise unchanged.
135
+ ...(extras.adjustments ? { adjustments: extras.adjustments } : {}),
134
136
  // Runtime-read HEAD source around each finding; anchors can come straight from here.
135
137
  sourceExcerpts: await store.pack(sources, INLINE_BUDGET),
136
138
  // Every live thread on the PR, read by the runtime when planning started.
@@ -165,7 +167,9 @@ async function planningInput(review, store, findings, report, work, continuation
165
167
  * @param {(payload: object, handler: object) => Promise<object>} invoke
166
168
  */
167
169
  export async function prepareComments(review, store, invoke, { progress, fetchSource, discussions = null, parallel = PLANNING_PARALLEL_PAGES } = {}) {
168
- const all = publishableFindings(review);
170
+ // Adjusted by a person after a preview, if they did; otherwise the publishable findings unchanged.
171
+ const all = commentFindings(review);
172
+ const adjustments = adjustmentInput(review);
169
173
  // Only a quick review, which has no verifier, offers candidate duplicates to the planner.
170
174
  const { pages: groups, offered } = candidatePages(all, reviewVerification(review) === 'none' ? mergeCandidates(all) : []);
171
175
  const reports = textPages(review.final.report ?? '');
@@ -217,7 +221,7 @@ export async function prepareComments(review, store, invoke, { progress, fetchSo
217
221
  const payload = await planningInput(review, store, assigned, report,
218
222
  { kind: 'plan', page: index + 1, pages: count, allowSummary,
219
223
  ...(reports[index] ? { reportRange: { start: reports[index].start, end: reports[index].end } } : {}) },
220
- continuation, { sourceExcerpts, discussions, reportSegments: reports.length, mergeCandidates: candidates, evidence: evidence() });
224
+ continuation, { sourceExcerpts, discussions, reportSegments: reports.length, mergeCandidates: candidates, evidence: evidence(), adjustments });
221
225
  // Another page failed while this input was prepared: start no model work.
222
226
  if (failure) return parts;
223
227
  const scoped = async answer => {
@@ -310,8 +314,12 @@ export const UNCERTAIN_SETTLE_MS = 15 * 60 * 1000;
310
314
  * comment was deleted on the PR is DELETED: settled, and never sent again.
311
315
  * - With `only` (a set of markers), handles just those items; the others stay
312
316
  * in the saved plan for a later publication.
317
+ * - With `compare` (a review a person adjusted), an item already on the PR
318
+ * with other text is still skipped, marked `earlierText`: the PR keeps that
319
+ * earlier version, since nothing posted is ever changed. The result then
320
+ * counts the other AZPR comments on the PR (`otherComments`).
313
321
  */
314
- export async function publishPlan({ run, review, azure, attempts, progress, persist, now = () => Date.now(), settleMs = UNCERTAIN_SETTLE_MS, only }) {
322
+ export async function publishPlan({ run, review, azure, attempts, progress, persist, now = () => Date.now(), settleMs = UNCERTAIN_SETTLE_MS, only, compare = false }) {
315
323
  const items = publicationItems(review.plan).filter(item => !only || only.has(item.marker));
316
324
  const ledger = review.publication ??= new Map();
317
325
  const current = await azure.versions(run, review.snapshot);
@@ -319,7 +327,9 @@ export async function publishPlan({ run, review, azure, attempts, progress, pers
319
327
  if (current.head !== review.snapshot.head) {
320
328
  return { status: 'STALE', reason: `The PR source commit changed after the review (reviewed ${review.snapshot.head.slice(0, 12)}, current ${current.head.slice(0, 12)}). Run a new review before commenting.` };
321
329
  }
322
- const present = markersInThreads(await azure.threads(run, review.snapshot));
330
+ const listed = await azure.threads(run, review.snapshot);
331
+ const present = markersInThreads(listed);
332
+ const texts = compare ? markerTexts(listed) : null;
323
333
  const at = () => new Date(now()).toISOString();
324
334
  const record = (item, entry) => ledger.set(item.marker, {
325
335
  ...(item.kind === 'summary' ? { kind: 'summary' } : { kind: 'inline', findingId: item.findingId, ...(item.findingIds ? { findingIds: item.findingIds } : {}), path: item.path, startLine: item.startLine }),
@@ -334,7 +344,10 @@ export async function publishPlan({ run, review, azure, attempts, progress, pers
334
344
  let written = 0, halted = '';
335
345
  for (const [index, item] of items.entries()) {
336
346
  if (!run.active) throw new Error(run.reason || 'Publication stopped.');
337
- if (present.has(item.marker)) { record(item, { state: 'ALREADY_PRESENT', threadId: present.get(item.marker) }); continue; }
347
+ if (present.has(item.marker)) {
348
+ record(item, { state: 'ALREADY_PRESENT', threadId: present.get(item.marker), ...(texts && texts.get(item.marker) !== item.content ? { earlierText: true } : {}) });
349
+ continue;
350
+ }
338
351
  if (halted) { record(item, { state: 'FAILED', error: halted }); continue; }
339
352
  const earlier = attempts.get(item.marker);
340
353
  if (earlier?.state === 'CREATED') {
@@ -377,10 +390,16 @@ export async function publishPlan({ run, review, azure, attempts, progress, pers
377
390
  try {
378
391
  const listedAfter = await azure.threads(run, review.snapshot);
379
392
  const after = markersInThreads(listedAfter), removedAfter = deletedThreads(listedAfter);
393
+ const textsAfter = compare ? markerTexts(listedAfter) : null;
380
394
  for (const item of items) {
381
395
  const entry = ledger.get(item.marker);
382
396
  if (!['POSTED', 'UNCERTAIN', 'FAILED'].includes(entry.state)) continue;
383
- if (after.has(item.marker)) Object.assign(entry, { state: 'VERIFIED', threadId: after.get(item.marker) });
397
+ if (after.has(item.marker)) {
398
+ // A comment this run did not create (an earlier attempt's, or one the first list did not show yet,
399
+ // also after a refused write) keeps its own text.
400
+ const earlierText = textsAfter && (entry.state !== 'POSTED' || entry.earlierAttempt) && textsAfter.get(item.marker) !== item.content;
401
+ Object.assign(entry, { state: 'VERIFIED', threadId: after.get(item.marker), ...(earlierText ? { earlierText: true } : {}) });
402
+ }
384
403
  else if (entry.state === 'POSTED') entry.state = removedAfter.has(entry.threadId) ? 'DELETED' : 'UNVERIFIED';
385
404
  }
386
405
  } catch (error) {
@@ -393,5 +412,7 @@ export async function publishPlan({ run, review, azure, attempts, progress, pers
393
412
  const status = succeeded === items.length ? 'POSTED' : succeeded ? 'PARTIALLY_POSTED' : 'FAILED';
394
413
  const uncertain = states.filter(state => state === 'UNCERTAIN').length;
395
414
  const reason = halted || (uncertain ? `${uncertain} item(s) may still be created by an earlier attempt whose outcome is unknown; they are not posted again until their marker appears or ${Math.round(settleMs / 60000)} minutes have passed since that attempt. Run the same command again later.` : undefined);
396
- return { status, readBack, ...(reason ? { reason } : {}), counts: Object.fromEntries([...new Set(states)].map(state => [state, states.filter(s => s === state).length])) };
415
+ const planned = new Set(items.map(item => item.marker));
416
+ return { status, readBack, ...(reason ? { reason } : {}), counts: Object.fromEntries([...new Set(states)].map(state => [state, states.filter(s => s === state).length])),
417
+ ...(compare ? { otherComments: [...present.keys()].filter(marker => !planned.has(marker)).length } : {}) };
397
418
  }