opencode-azure-devops-pr-review 0.2.2 → 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.
- package/AGENTS.md +18 -3
- package/CHANGELOG.md +49 -0
- package/CODE_OF_CONDUCT.md +83 -0
- package/CONTRIBUTING.md +4 -3
- package/README.md +79 -31
- package/docs/ARCHITECTURE.md +37 -6
- package/docs/AZURE_DEVOPS.md +3 -0
- package/docs/COMMENTING.md +79 -0
- package/docs/DEBUGGING.md +7 -6
- package/docs/DEMO.md +45 -1
- package/docs/ENTERPRISE.md +1 -1
- package/docs/QUICKSTART.md +35 -9
- package/docs/RELEASING.md +2 -2
- package/docs/ROADMAP.md +13 -3
- package/docs/VALIDATION.md +313 -42
- package/docs/VALIDATION_HISTORY.md +40 -0
- package/docs/assets/RECORDING.md +9 -2
- 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/render-terminal-demo.py +1 -1
- package/docs/releases/v0.2.3.md +93 -0
- package/docs/releases/v0.3.0.md +125 -0
- package/install.sh +1 -1
- package/package.json +3 -2
- package/src/attribution.mjs +1 -1
- package/src/azure.mjs +30 -6
- package/src/comment-work.mjs +30 -9
- package/src/comments.mjs +184 -4
- package/src/host.mjs +9 -8
- package/src/output.mjs +71 -0
- package/src/runtime.mjs +108 -26
- package/src/session.mjs +10 -3
|
@@ -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.
|
package/docs/assets/RECORDING.md
CHANGED
|
@@ -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
|
|
78
|
-
|
|
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
|
|
Binary file
|
|
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 =
|
|
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,93 @@
|
|
|
1
|
+
# Azure DevOps PR Review for OpenCode — 0.2.3
|
|
2
|
+
|
|
3
|
+
This release moves the tested host to OpenCode CLI 2.1.4 and fixes three
|
|
4
|
+
behaviors that OpenCode 2.1.3 and later expose: how a refused proxy tunnel is
|
|
5
|
+
reported, how long a silent Azure DevOps call may wait, and how a refused
|
|
6
|
+
background summary affects a failed stage. Prompts, settings and installation
|
|
7
|
+
are unchanged.
|
|
8
|
+
|
|
9
|
+
## What changed
|
|
10
|
+
|
|
11
|
+
- **Proxy refusals are explained again.** OpenCode 2.1.3 and later embed Bun
|
|
12
|
+
1.4.4, which rejects a request with `ERR_PROXY_TUNNEL` when a proxy refuses
|
|
13
|
+
the CONNECT tunnel, where Bun 1.4.2 returned the proxy's answer. AZPR treated
|
|
14
|
+
the rejection as a network error and retried it. It now gives the earlier
|
|
15
|
+
messages and retry rules: a missing proxy password is explained as HTTP 407
|
|
16
|
+
without retries, a blocked destination names the proxy, and a refused tunnel
|
|
17
|
+
never leaves a comment write uncertain.
|
|
18
|
+
- **Azure DevOps calls keep their configured timeout.** The runtime's fetch
|
|
19
|
+
ended a request that received nothing for about six minutes by itself, while
|
|
20
|
+
`azure.callTimeoutSeconds` accepts up to 1,800 seconds. AZPR now switches that
|
|
21
|
+
limit off for its requests, so the configured timeout decides.
|
|
22
|
+
- **Background compaction no longer splits a failed stage.** With OpenCode's
|
|
23
|
+
opt-in `experimental.background_compaction`, the host asks for a summary
|
|
24
|
+
before a reviewer's context is full. AZPR refuses it as before, but the
|
|
25
|
+
refusal also marked the stage as overflowing: a later permanent failure,
|
|
26
|
+
such as an expired provider key, split the shard into new sessions that
|
|
27
|
+
failed the same way, and a failed follow-up discarded the answer it
|
|
28
|
+
followed. Overflow is now read from the failed turn itself.
|
|
29
|
+
- The README states that AZPR is an independent community project, not built
|
|
30
|
+
by or affiliated with the OpenCode team.
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
opencode plugin add opencode-azure-devops-pr-review@0.2.3
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Alternatively, install the same release from Git:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
opencode plugin add 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.2.3'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Add only one of them. Follow the
|
|
45
|
+
[quickstart](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/blob/v0.2.3/docs/QUICKSTART.md)
|
|
46
|
+
for a private PAT file, `/pr-setup`, a service restart and the first review.
|
|
47
|
+
|
|
48
|
+
## Upgrading
|
|
49
|
+
|
|
50
|
+
Upgrade OpenCode to 2.1.4 first if you can: the receipts of other versions add
|
|
51
|
+
a host notice, and those versions are not validated. Stop the OpenCode service
|
|
52
|
+
and copy its database before upgrading OpenCode, so that you can go back.
|
|
53
|
+
|
|
54
|
+
To update a native installation, edit its existing entry in the OpenCode
|
|
55
|
+
configuration's `plugins` list:
|
|
56
|
+
|
|
57
|
+
- For npm, change the package specification to
|
|
58
|
+
`opencode-azure-devops-pr-review@0.2.3`.
|
|
59
|
+
- For Git, change the tag suffix to `#v0.2.3`.
|
|
60
|
+
|
|
61
|
+
If the entry is an object, change only `package`; preserve `options.settingsFile`
|
|
62
|
+
and any other options. Keep one AZPR entry and restart the OpenCode service.
|
|
63
|
+
External settings, the PAT file and review records remain in place; a working
|
|
64
|
+
configuration needs no new `/pr-setup`. Exact version pins are not advanced by
|
|
65
|
+
`opencode plugin update`.
|
|
66
|
+
|
|
67
|
+
For a source installation, extract the new archive and run its installer with
|
|
68
|
+
`--replace` to retain settings:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
sh install.sh --config-dir /absolute/path/to/v2-opencode-config --replace
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Coming from 0.1.0, see the
|
|
75
|
+
[0.2.0 upgrade notes](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/blob/v0.2.0/docs/releases/v0.2.0.md#upgrading-from-010)
|
|
76
|
+
for automatic comments, which remain disabled unless configured or requested.
|
|
77
|
+
|
|
78
|
+
## Compatibility and release assets
|
|
79
|
+
|
|
80
|
+
The tested target is OpenCode CLI **2.1.4** (V2 plugin API), Node.js
|
|
81
|
+
**22.23.3**, Ubuntu **22.04.5** under WSL2, and Azure DevOps Services REST API
|
|
82
|
+
**7.1**. OpenCode 1.x and Azure DevOps Server are not supported; other operating
|
|
83
|
+
systems remain unvalidated. See the
|
|
84
|
+
[validation record](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/blob/v0.2.3/docs/VALIDATION.md),
|
|
85
|
+
including live reviews on OpenCode 2.1.4.
|
|
86
|
+
|
|
87
|
+
The npm package comes from this tag and has no dependencies or install scripts.
|
|
88
|
+
Release assets are `opencode-azure-devops-pr-review-v2-0.2.3.tar.gz` and
|
|
89
|
+
`SHA256SUMS`; verify the source archive with `sha256sum -c SHA256SUMS`. The
|
|
90
|
+
existing demonstration remains attached to
|
|
91
|
+
[v0.2.0](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/releases/tag/v0.2.0),
|
|
92
|
+
with its original recording context documented in the
|
|
93
|
+
[demo guide](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/blob/v0.2.3/docs/DEMO.md).
|
|
@@ -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/install.sh
CHANGED
|
@@ -159,7 +159,7 @@ mv -- "$stage/new/$target" "$root/$target"
|
|
|
159
159
|
success=1
|
|
160
160
|
# Informational output only; an unwritable output must not fail a completed install.
|
|
161
161
|
{
|
|
162
|
-
printf '\nAzure PR Review installed (target host: @opencode/cli 2.1.
|
|
162
|
+
printf '\nAzure PR Review installed (target host: @opencode/cli 2.1.4; Ubuntu 22.04).\nSettings: %s\n' "$root/plugins/azpr-v2/settings.json"
|
|
163
163
|
printf 'No installation backup is retained after success. Existing older backups are untouched.\n'
|
|
164
164
|
cat <<'TXT'
|
|
165
165
|
1. Configure models.review.functional/risk/verifier. Configure all three models.deep roles to enable /pr-deep, the same review with models stronger than models.review for the PRs that need them, and models.quick.reviewer to enable /pr-quick.
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-azure-devops-pr-review",
|
|
3
|
-
"version": "0.
|
|
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": {
|
package/src/attribution.mjs
CHANGED
|
@@ -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
|
|
@@ -249,8 +264,10 @@ function retryAfterMs(header) {
|
|
|
249
264
|
return Number.isFinite(ms) && ms > 0 ? Math.min(ms, MAX_RETRY_AFTER_MS) : undefined;
|
|
250
265
|
}
|
|
251
266
|
|
|
252
|
-
// Fetch error codes: Bun (OpenCode's runtime) reports e.g. ConnectionRefused where Node
|
|
253
|
-
|
|
267
|
+
// Fetch error codes: Bun 1.4.2 (OpenCode's runtime through 2.1.2) reports e.g. ConnectionRefused where Node and
|
|
268
|
+
// Bun 1.4.4 report ECONNREFUSED.
|
|
269
|
+
// ERR_PROXY_TUNNEL: the proxy refused the CONNECT tunnel, so nothing reached Azure DevOps.
|
|
270
|
+
const NOT_SENT_CODES = /^(?:ECONNREFUSED|ConnectionRefused|FailedToOpenSocket|ENOTFOUND|EAI_AGAIN|ERR_PROXY_TUNNEL)$/;
|
|
254
271
|
const UNREACHABLE_CODES = /^(?:ECONNREFUSED|ConnectionRefused|FailedToOpenSocket|ENOTFOUND|EAI_AGAIN|ETIMEDOUT|ENETUNREACH|EHOSTUNREACH)$/;
|
|
255
272
|
const CERTIFICATE_CODES = /^(?:UNABLE_TO_GET_ISSUER_CERT(?:_LOCALLY)?|UNABLE_TO_VERIFY_LEAF_SIGNATURE|SELF_SIGNED_CERT_IN_CHAIN|DEPTH_ZERO_SELF_SIGNED_CERT|CERT_[A-Z_]+|ERR_TLS_CERT_ALTNAME_INVALID)$/;
|
|
256
273
|
// Azure DevOps marks every response it serves; a proxy's own answer does not carry this header.
|
|
@@ -296,15 +313,15 @@ export function createAzureClient({ organization, pat, baseUrl = DEFAULT_BASE_UR
|
|
|
296
313
|
signal.addEventListener('abort', stop, { once: true });
|
|
297
314
|
});
|
|
298
315
|
|
|
299
|
-
/** An answer from a proxy or gateway instead of Azure DevOps. */
|
|
300
|
-
function intermediaryFailure(status, label, method) {
|
|
316
|
+
/** An answer from a proxy or gateway instead of Azure DevOps; `forwarded` is false when it refused the tunnel. */
|
|
317
|
+
function intermediaryFailure(status, label, method, forwarded = true) {
|
|
301
318
|
if (status === 407) {
|
|
302
319
|
return new AzureError(`A proxy refused ${label}: it requires authentication (HTTP 407).`, { kind: 'proxy', status,
|
|
303
320
|
hint: 'Put the proxy user name and password in azure.proxy (http://user:password@host:port, percent-encoded) and restart OpenCode.' });
|
|
304
321
|
}
|
|
305
322
|
// A gateway that already forwarded a write may have delivered it.
|
|
306
323
|
return new AzureError(`A proxy or gateway answered ${label} with HTTP ${status} instead of Azure DevOps (no Azure DevOps response headers).`, {
|
|
307
|
-
kind: 'proxy', status, transient: status === 429 || status >= 500, uncertain: method !== 'GET' && status >= 500,
|
|
324
|
+
kind: 'proxy', status, transient: status === 429 || status >= 500, uncertain: forwarded && method !== 'GET' && status >= 500,
|
|
308
325
|
hint: proxyName ? `Check that the proxy ${proxyName} (azure.proxy) allows dev.azure.com.`
|
|
309
326
|
: 'Check the proxy or firewall between OpenCode and dev.azure.com; set azure.proxy if this network requires one.' });
|
|
310
327
|
}
|
|
@@ -330,7 +347,10 @@ export function createAzureClient({ organization, pat, baseUrl = DEFAULT_BASE_UR
|
|
|
330
347
|
let response;
|
|
331
348
|
try {
|
|
332
349
|
response = await fetchImpl(url, {
|
|
333
|
-
|
|
350
|
+
// Bun's fetch gives up on its own after five to six minutes without data (370 s in Bun 1.4.2 and
|
|
351
|
+
// 1.4.4); the queue's per-call timeout (azure.callTimeoutSeconds, up to 30 minutes) aborts through
|
|
352
|
+
// `signal` instead. Node's fetch ignores the option.
|
|
353
|
+
method, redirect: 'manual', signal, timeout: false,
|
|
334
354
|
headers: { authorization, accept: accept === 'json' ? 'application/json' : 'application/octet-stream',
|
|
335
355
|
...(body === undefined ? {} : { 'content-type': 'application/json' }) },
|
|
336
356
|
...(body === undefined ? {} : { body: JSON.stringify(body) }),
|
|
@@ -340,6 +360,10 @@ export function createAzureClient({ organization, pat, baseUrl = DEFAULT_BASE_UR
|
|
|
340
360
|
if (signal?.aborted) throw signal.reason instanceof Error ? signal.reason : error;
|
|
341
361
|
const code = error?.cause?.code ?? error?.code;
|
|
342
362
|
const known = typeof code === 'string' ? code : '';
|
|
363
|
+
// Bun 1.4.4 (OpenCode 2.1.3 and later) rejects with the proxy's status when it refuses the
|
|
364
|
+
// CONNECT tunnel; Bun 1.4.2 returned that answer as a response.
|
|
365
|
+
const tunnelStatus = known === 'ERR_PROXY_TUNNEL' ? error?.status ?? error?.cause?.status : undefined;
|
|
366
|
+
if (Number.isInteger(tunnelStatus) && tunnelStatus >= 400) throw intermediaryFailure(tunnelStatus, label, method, false);
|
|
343
367
|
// A rejected certificate fails the handshake before anything is sent; retrying cannot help.
|
|
344
368
|
if (CERTIFICATE_CODES.test(known)) {
|
|
345
369
|
throw new AzureError(`Azure DevOps ${label} failed: the server's TLS certificate was not accepted (${clean(known)}).`, { kind: 'tls', code: known, cause: error,
|
package/src/comment-work.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Comment planning (model pages) and deterministic, idempotent publication.
|
|
2
|
-
import {
|
|
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
|
-
|
|
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
|
|
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)) {
|
|
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))
|
|
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
|
-
|
|
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
|
}
|