opencode-azure-devops-pr-review 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,178 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.2 — 2026-11-17
4
+
5
+ A panel in OpenCode's terminal UI shows the report and the comment preview
6
+ rendered instead of as Markdown source, and lists the sessions of the review
7
+ so that you can open one. A PR that was completed or abandoned takes comments
8
+ like an active one, and a new version writes the settings it brings into your
9
+ settings file. The reviewer, verifier and comment-planning instructions are
10
+ those of 0.4.1. One setting is new: `terminalPanel`.
11
+
12
+ Terminal panel (OpenCode's terminal UI only):
13
+
14
+ - OpenCode shows what a plugin tells a conversation as plain text, so a report
15
+ or a comment preview appeared as Markdown source. A panel beside the
16
+ conversation now shows the newest one rendered: headings, emphasis, lists,
17
+ code and tables. A check's table is shown there too.
18
+ - The panel lists the sessions of the review with their state while they run,
19
+ and afterwards those that still exist, first the one that holds the report.
20
+ A click opens the session in a tab. Until now a reviewer session had to be
21
+ picked from OpenCode's session list.
22
+ - It opens by itself when a review or a comment run starts and when a report
23
+ or preview arrives, in the conversation on screen, and leaves the keyboard
24
+ with the prompt. `/pr-panel`, its only command, shows and hides it.
25
+ - New setting `terminalPanel`: `auto` (the default) as above; `manual` opens
26
+ the panel only with `/pr-panel`. The panel reads no settings file, so the
27
+ runtime sends this setting along with its notices, as metadata no model
28
+ sees; with the default nothing is added to them.
29
+ - A click inside the panel gives it the keyboard: the arrow keys or `j` and
30
+ `k`, Page Up and Page Down, Home and End scroll, and Escape or `q` closes it.
31
+ - In a terminal with fewer than 108 columns, where OpenCode shows a panel in
32
+ place of the conversation, it does not open by itself and says that
33
+ something is ready; `/pr-panel` shows it full screen.
34
+ - The panel only reads: AZPR's notices in the conversation, the report queued
35
+ to the review's session, and which sessions belong to the run. It sends no
36
+ prompt, starts nothing and posts nothing.
37
+ - A report or preview that a notice encloses is shown exactly as it was
38
+ written, also when it quotes the tag that ends the notice's block. For
39
+ that, text which already holds the escaped form of that tag
40
+ (`</azpr_report_data>`, `</azpr_comment_data>`) is now enclosed
41
+ with one more `&`; the tag itself is written as before.
42
+ - Other OpenCode clients, such as the desktop app, do not load the panel and
43
+ show AZPR's notices as before.
44
+
45
+ Comments on a PR that is no longer active:
46
+
47
+ - `/pr-comment --publish` refused a PR that was completed or abandoned
48
+ (`INCOMPLETE`, "The PR is completed; nothing was posted"), so a PR merged
49
+ before its review was commented on could be reviewed but not commented on.
50
+ The PR's status no longer stops a publication, typed or automatic: such a
51
+ PR takes the comments like an active one, and the receipt names the status
52
+ (`Publication (VERIFIED=3); the PR is completed:`). A changed source commit
53
+ is still refused (`STALE`), and nothing is posted twice.
54
+ - `/pr-check` no longer reports `NOT_READY` for such a PR: its `PR metadata`
55
+ row is a WARNING that names the status.
56
+
57
+ Settings:
58
+
59
+ - A version that brings a new setting now writes it into your settings file,
60
+ at its default, when OpenCode first loads that version. Until now only a
61
+ source installation added new settings; a settings file of the native
62
+ package kept what `/pr-setup` once wrote, and a new setting had to be
63
+ looked up and typed in. The defaults written are the ones that applied
64
+ anyway, so nothing changes in how AZPR behaves. Your values and their
65
+ order stay, the file is written with two-space indentation and readable by
66
+ its owner only (mode 600), and `/pr-check` lists what was added (a
67
+ `Settings` row).
68
+ - The file is replaced as `/pr-setup` replaces it: atomically, owner-only and
69
+ only when it is a regular file of your own in a directory no one else can
70
+ write to. What you save in an editor at that moment is kept. A settings
71
+ file that is a symbolic link, invalid or switched off (`enabled: false`) is
72
+ left as it is; where settings are missing and could not be added, the
73
+ `Settings` row of `/pr-check` is a WARNING that names them and the reason.
74
+ - A setup lock that a process left behind is now named: the message says
75
+ which file to delete when no setup is running.
76
+ - `/pr-setup` writes every setting from the start, those it does not ask for
77
+ at their defaults.
78
+ - Going back to an earlier version after 0.4.2 completed the file needs one
79
+ edit: remove `terminalPanel`, which earlier versions refuse as an unknown
80
+ setting.
81
+
82
+ Package:
83
+
84
+ - The package has a second entry, `./tui`, which OpenCode's terminal UI loads
85
+ by itself when the plugin is active. Installing and upgrading are as before;
86
+ the package still has no dependency and runs nothing at installation.
87
+ - OpenCode 2.3.0 does not compile the JSX of a package it installed (restored
88
+ in OpenTUI 0.9.0, which OpenCode has not shipped yet), so the package
89
+ carries the compiled view next to its source. Building it needs a
90
+ development dependency in the repository only.
91
+ - A source installation copies two more files, `tui-model.mjs` and `tui.js`;
92
+ the manual-copy list in the README has 34 files.
93
+
94
+ Documentation:
95
+
96
+ - The README's 15-second recording is a real review on OpenCode 2.3.0 with
97
+ the panel beside the conversation; the
98
+ [demonstration page](docs/DEMO.md#the-terminal-panel) says how it was made.
99
+ The recording of adjusting findings before publishing stays on that page.
100
+ - The recording tools write a GIF with Pillow alone where no FFmpeg is
101
+ installed, and the recording guide says what to look for in a cast before
102
+ publishing frames of the panel.
103
+
104
+ ## 0.4.1 — 2026-11-16
105
+
106
+ AZPR is tested with OpenCode 2.3.0 instead of 2.2.4, and two things that went
107
+ wrong on 2.3.0 are fixed. The same release also passed its host fixtures on
108
+ OpenCode 2.2.4, where `/pr-check` shows the OpenCode WARNING row. The
109
+ reviewer and verifier instructions are those of 0.4.0, and no setting is new.
110
+
111
+ OpenCode 2.3.0:
112
+
113
+ - A review no longer wakes your conversation's own model. OpenCode 2.3.0
114
+ hands every answer of a child session to its parent and lets the parent's
115
+ model respond to it. AZPR's private sessions were children of the
116
+ conversation, so on 2.3.0 that model, with its edit and shell tools,
117
+ received the reviewers' raw output and AZPR's notices and answered each
118
+ one: 7 of the 12 model requests of a 2-file review in the test fixture.
119
+ Private sessions are now sessions of their own, created where the
120
+ conversation is. What the reviewers, the verifier and the comment planner
121
+ are sent did not change.
122
+ - A model stream that breaks off mid-answer no longer fails the stage.
123
+ OpenCode 2.3.0 retries the interrupted step by itself instead of asking the
124
+ model to continue. AZPR did not recognise that and ran the stage again in a
125
+ new session, and a second interruption failed it. It now takes the retried
126
+ step's answer; the receipt counts such steps as `step-retries`.
127
+ - The inactivity watchdog, the retry of a provider 503, the refused background
128
+ summary and the context-overflow split work on 2.3.0 as before.
129
+
130
+ Private sessions in the session list:
131
+
132
+ - OpenCode lists a session without a parent like a conversation, so AZPR's
133
+ private sessions now appear next to your conversations, titled
134
+ `[AZPR <id>] …`; a plugin cannot archive them. When a review ends, AZPR
135
+ therefore deletes its sessions at once, except the one that holds the report
136
+ or draft, which the receipt names. A comment run keeps none: its receipt
137
+ carries the preview or the publication result. Until now a completed review
138
+ kept all of its sessions until it was evicted. The kept session is deleted
139
+ with its review, as before (the newest 20 are kept).
140
+ - A review's receipt says how many sessions were deleted (`Session notice`).
141
+ - While `debug.enabled` is on, every session is still kept until the review
142
+ is evicted, so each review adds all of its sessions to the list. Turn debug
143
+ off for everyday use; `deletePrivateSessions: false` keeps everything too.
144
+ - A review that an OpenCode restart interrupts leaves its sessions in the
145
+ list: AZPR had not recorded them yet. Delete those yourself.
146
+ - A session whose deletion failed or timed out stays on record: it is
147
+ deleted with its review, or, when no review keeps it, tried again after
148
+ every later run and closed to AZPR commands meanwhile. Such a session used
149
+ to be forgotten. A command typed in a session that is being deleted is
150
+ refused. A session OpenCode creates only after its stage was cancelled is
151
+ deleted when it arrives.
152
+ - A new review cannot be started from a saved review's own session, also after
153
+ an OpenCode restart; until now only the running process refused that.
154
+ - Each private session carries `metadata.azpr` with its run, role and
155
+ conversation (and, for a comment run, the review), so tools that list
156
+ sessions can tell AZPR's sessions from conversations without reading titles.
157
+
158
+ Tools:
159
+
160
+ - A reviewer's tool call that OpenCode stops ends at once instead of when its
161
+ Azure DevOps request returns. The request only that call waits for (a folder
162
+ listing of one level, the PR's threads) is aborted; a file, a recursive
163
+ listing or the repository archive, which the run's other sessions may be
164
+ waiting for too, is still read to the end and kept for them.
165
+
166
+ Documentation:
167
+
168
+ - A model entry that lets the provider choose the model for each session,
169
+ such as GitHub Copilot's Auto in OpenCode 2.2.7 and later, cannot be an AZPR
170
+ model: AZPR refuses a request on another model than the configured one, and
171
+ `/pr-check` does not detect such an entry.
172
+ - While a provider's host cannot be reached, OpenCode 2.3.0 retries the
173
+ request for up to an hour. AZPR allows those retries, so a review waits
174
+ instead of failing; `/pr-stop` ends it.
175
+
3
176
  ## 0.4.0 — 2026-11-14
4
177
 
5
178
  Two defaults change. They apply where a settings file does not name the
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![CI](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/actions/workflows/ci.yml?query=branch%3Amain)
4
4
  [![npm](https://img.shields.io/npm/v/opencode-azure-devops-pr-review)](https://www.npmjs.com/package/opencode-azure-devops-pr-review)
5
5
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
6
- [![Tested with OpenCode 2.2.4](https://img.shields.io/badge/OpenCode-2.2.4%20tested-blue)](docs/VALIDATION.md)
6
+ [![Tested with OpenCode 2.3.0](https://img.shields.io/badge/OpenCode-2.3.0%20tested-blue)](docs/VALIDATION.md)
7
7
 
8
8
  **Review Azure DevOps pull requests from a URL. No checkout required.**
9
9
 
@@ -52,7 +52,7 @@ is an actual capture excerpt with identifying UI removed and its text unchanged.
52
52
  [company networks](docs/ENTERPRISE.md#company-networks) first):
53
53
 
54
54
  ```sh
55
- opencode plugin add opencode-azure-devops-pr-review@0.4.0
55
+ opencode plugin add opencode-azure-devops-pr-review@0.4.2
56
56
  ```
57
57
 
58
58
  2. Follow the [quickstart](docs/QUICKSTART.md) to save your PAT in a private
@@ -247,11 +247,12 @@ runs and their limits are under
247
247
 
248
248
  ## Watch the workflow
249
249
 
250
- [![Real OpenCode run: exclude one finding, lower another to low, inspect the new preview, then publish and read the comments back from Azure DevOps.](docs/assets/adjust-findings-teaser.gif)](docs/DEMO.md#adjust-findings-before-publishing)
250
+ [![Real OpenCode run: a review starts, a panel beside the conversation lists its sessions, then shows the report and the comment preview rendered.](docs/assets/terminal-panel-teaser.gif)](docs/DEMO.md#the-terminal-panel)
251
251
 
252
- *A 15-second edit of a real OpenCode 2.1.4 session on a dedicated test PR.
252
+ *A 15-second edit of a real OpenCode 2.3.0 session on a dedicated test PR.
253
253
  Waiting time is shortened, so the length is not the review duration.
254
- [Recording details and longer walkthrough](docs/DEMO.md).*
254
+ [Recording details and other walkthroughs](docs/DEMO.md), among them
255
+ [adjusting findings before publishing](docs/DEMO.md#adjust-findings-before-publishing).*
255
256
 
256
257
  ## Choose a review
257
258
 
@@ -301,11 +302,12 @@ models and runs.
301
302
 
302
303
  | Component | Tested target |
303
304
  | --- | --- |
304
- | OpenCode | **OpenCode CLI 2.2.4** (`@opencode/cli`; V2 plugin API). On another OpenCode 2.x, `/pr-check` shows an OpenCode WARNING row and reviews still run. OpenCode 1.x is not supported. |
305
+ | OpenCode | **OpenCode CLI 2.3.0** (`@opencode/cli`; V2 plugin API). On another OpenCode 2.x, `/pr-check` shows an OpenCode WARNING row and reviews still run. OpenCode 1.x is not supported. |
305
306
  | Operating system | **Ubuntu 22.04** (validation environment: WSL2). Other operating systems are not yet validated. |
306
307
  | Azure | **Azure DevOps Services**, REST API **7.1**. Azure DevOps Server is not supported by the current URL handling. |
307
308
  | Installation | OpenCode's plugin manager with the npm package or the versioned Git package, or the source installer with POSIX `sh` and Python 3; no plugin build step or npm dependencies. |
308
- | Models | Your OpenCode provider/model IDs with tool support. Each mode checks the models it uses. |
309
+ | Terminal panel | OpenCode's terminal UI (see [terminal panel](#terminal-panel)). Other clients, such as the desktop app, show AZPR's notices as before. |
310
+ | Models | Your OpenCode provider/model IDs with tool support. Each mode checks the models it uses. Name a concrete model, not one that routes each session to another model (see [configuration](#configuration)). |
309
311
 
310
312
  The npm package, the Git package and the release source archive contain the
311
313
  same runtime. A fresh installation exposes `/pr-setup` before
@@ -400,17 +402,17 @@ Azure DevOps REST API with the runtime's built-in `fetch`.
400
402
  Install the npm package with OpenCode's plugin manager:
401
403
 
402
404
  ```sh
403
- opencode plugin add opencode-azure-devops-pr-review@0.4.0
405
+ opencode plugin add opencode-azure-devops-pr-review@0.4.2
404
406
  ```
405
407
 
406
408
  The same release is also a versioned Git package, which needs Git but not the
407
409
  npm registry:
408
410
 
409
411
  ```sh
410
- opencode plugin add 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.4.0'
412
+ opencode plugin add 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.4.2'
411
413
  ```
412
414
 
413
- Add only one of them. OpenCode 2.2.4 loads the plugin into a running OpenCode
415
+ Add only one of them. OpenCode 2.3.0 loads the plugin into a running OpenCode
414
416
  service within a few seconds; if `/pr-setup` does not appear in a new
415
417
  conversation, run `opencode service restart`. Then run `/pr-setup` for setup
416
418
  instructions. Native packages
@@ -421,7 +423,7 @@ To select another configuration file, use an absolute path in the host config:
421
423
  ```json
422
424
  {
423
425
  "plugins": [{
424
- "package": "opencode-azure-devops-pr-review@0.4.0",
426
+ "package": "opencode-azure-devops-pr-review@0.4.2",
425
427
  "options": { "settingsFile": "/absolute/path/to/azpr/settings.json" }
426
428
  }]
427
429
  }
@@ -440,13 +442,13 @@ with a new version adds a second entry**: OpenCode keeps running the version
440
442
  listed first and reports the new one as `Duplicate plugin ID: azpr` (from
441
443
  0.3.1, `/pr-check` also warns about it). Upgrade when no AZPR command is
442
444
  running, since
443
- OpenCode 2.2.4 replaces the running plugin as soon as its entry changes.
445
+ OpenCode 2.3.0 replaces the running plugin as soon as its entry changes.
444
446
 
445
447
  For an entry that `opencode plugin add` created, add the new version and,
446
448
  only when that succeeds, remove the previous one:
447
449
 
448
450
  ```sh
449
- opencode plugin add opencode-azure-devops-pr-review@0.4.0 &&
451
+ opencode plugin add opencode-azure-devops-pr-review@0.4.2 &&
450
452
  opencode plugin remove opencode-azure-devops-pr-review@PREVIOUS_VERSION
451
453
  ```
452
454
 
@@ -465,11 +467,21 @@ AZPR's commands disappear until the package is available and the service
465
467
  restarts.
466
468
 
467
469
  External settings, the PAT file and review records stay in place; a working
468
- configuration needs no new `/pr-setup`. `opencode plugin list` should then
470
+ configuration needs no new `/pr-setup`. Settings that a new version brings
471
+ are written into your settings file, at their defaults, when OpenCode first
472
+ loads that version: AZPR behaves as it did, and each new setting is in the
473
+ file for you to change. `/pr-check` then lists what was added. Your values
474
+ and their order stay, and the file is written with two-space indentation and
475
+ readable by its owner only (mode 600). A settings file that is a symbolic
476
+ link, or in a directory other users can write to, is left as it is, and
477
+ `/pr-check` names the settings it leaves out. To go back to an earlier
478
+ version afterwards, remove the settings that version does not know: it names
479
+ the first one (`Unknown setting settings.terminalPanel`) instead of starting. `opencode plugin list` should then
469
480
  show a single `azpr` row with the new version (from 0.3.1, `/pr-check` names
470
481
  it too); if it still shows the previous one, run `opencode service restart`.
471
482
  Exact versions stay pinned, so `opencode plugin update` leaves them unchanged.
472
- See the [0.4.0 release notes](docs/releases/v0.4.0.md) for what changed and the
483
+ See the [0.4.2 release notes](docs/releases/v0.4.2.md) for what changed, the
484
+ [0.4.0 release notes](docs/releases/v0.4.0.md) for commands without review IDs and the
473
485
  [0.2.0 release notes](docs/releases/v0.2.0.md) for automatic comments. A
474
486
  preview follows each COMPLETE review unless `afterReview` says otherwise;
475
487
  automatic publication stays off unless you configure it or request it with a
@@ -480,8 +492,8 @@ review command flag.
480
492
  <details>
481
493
  <summary>Source installation and replacement</summary>
482
494
 
483
- Download the [v0.4.0 source archive](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/archive/refs/tags/v0.4.0.tar.gz)
484
- and extract it, or check out tag `v0.4.0`. The installer needs POSIX `sh` and
495
+ Download the [v0.4.2 source archive](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/archive/refs/tags/v0.4.2.tar.gz)
496
+ and extract it, or check out tag `v0.4.2`. The installer needs POSIX `sh` and
485
497
  Python 3's standard library. From that source directory:
486
498
 
487
499
  ```sh
@@ -507,7 +519,7 @@ sh install.sh --config-dir /absolute/path/to/v2-opencode-config --replace
507
519
  ### Manual copying without Git
508
520
 
509
521
  Keep these relative paths under one source directory, then run its installer.
510
- These **32 files** include the runtime and its license:
522
+ These **34 files** include the runtime and its license:
511
523
 
512
524
  <details>
513
525
  <summary>Show the required files</summary>
@@ -536,6 +548,8 @@ src/search.mjs
536
548
  src/review-tools.mjs
537
549
  src/review-work.mjs
538
550
  src/store.mjs
551
+ src/tui-model.mjs
552
+ src/tui.js
539
553
  src/prompts/common.md
540
554
  src/prompts/functional.md
541
555
  src/prompts/risk.md
@@ -556,7 +570,9 @@ Keep `LICENSE` with copied or redistributed packages.
556
570
 
557
571
  Run `/pr-setup` to see the active settings path. Native packages use the
558
572
  external configuration described above; source installations retain their
559
- installed `plugins/azpr-v2/settings.json`. Edit that file and restart the
573
+ installed `plugins/azpr-v2/settings.json`. The file names every setting, each
574
+ at its default until you change it (see
575
+ [all settings](#all-settings-and-defaults)). Edit that file and restart the
560
576
  OpenCode service (`opencode service restart`, or your own `opencode serve`
561
577
  process). A changed file blocks new commands until the restart; running
562
578
  commands keep the settings they started with.
@@ -610,6 +626,13 @@ never blocks `/pr-review`. Comment planning uses the review's risk model
610
626
  turns on the severity rating. Left out or empty, no rating runs and the
611
627
  verifier's severity is final.
612
628
 
629
+ Name the model that should do the work. AZPR binds every private session to
630
+ the exact model in its settings and refuses a request that OpenCode sends on
631
+ another one, so an entry that lets the provider pick the model for each
632
+ session, such as GitHub Copilot's **Auto** (OpenCode 2.2.7 and later), cannot
633
+ be an AZPR model: its sessions fail with `Model mismatch`. `/pr-check` finds
634
+ such an entry in the model catalog and does not detect this.
635
+
613
636
  | Role | Focus and useful model capabilities |
614
637
  | --- | --- |
615
638
  | `functional` | Requirements, boundaries, state changes, API compatibility and regressions. Strong code comprehension in the project's language. |
@@ -675,7 +698,8 @@ copies that different reviewers get can each produce a finding.
675
698
  | `runTimeoutSeconds` | `null` (no whole-command timer); an integer 10–7200 enables one. |
676
699
  | `shell` | `deny`: private reviewers cannot run shell commands (the tool is hidden). `ask`: each command needs your approval in OpenCode. `inherit`: host permissions decide. |
677
700
  | `progressNotices` | `true`: short PROGRESS notices in the invoking conversation. |
678
- | `deletePrivateSessions` | `true`: AZPR deletes its private reviewer sessions once they are no longer needed (see [retention](#retention-and-privacy)); `false` keeps every session. |
701
+ | `deletePrivateSessions` | `true`: when a command ends, AZPR deletes its private reviewer sessions except the one that holds the review's report (see [retention](#retention-and-privacy)); `false` keeps every session. |
702
+ | `terminalPanel` | `auto`: the [terminal panel](#terminal-panel) opens by itself when a review or comment run starts and when a report or preview arrives.<br>`manual`: it opens only with `/pr-panel`. |
679
703
  | `afterReview.quick` / `.review` / `.deep` | What follows a COMPLETE review of that mode; `preview` each.<br>`preview`: plan a comment preview (a model runs; nothing is posted).<br>`none`: nothing follows; run `/pr-comment` yourself.<br>`publish`: plan the comments and post them as the PAT owner; a comment that a safeguard holds back waits for a person.<br>A flag after the PR URL (`--preview`, `--publish`, `--no-comment`) overrides it for one run. See [automatic comments](#automatic-comments). |
680
704
  | `azure.organization` | Required. The `<org>` of `https://dev.azure.com/<org>`; PR URLs of other organizations are refused. |
681
705
  | `azure.pat` | A personal access token for that organization with **Code (Read)** and **Pull Request Threads (Read & write)**, or `""` when `azure.patFile` is set. Sent only to `https://dev.azure.com/<org>` and never logged. |
@@ -690,7 +714,7 @@ copies that different reviewers get can each produce a finding.
690
714
  | `workflow.shardFindings` | At most `15` findings per verification session; one file's findings stay in the same session (a file is split only when it alone has more). |
691
715
  | `workflow.parallelSessions` | `8` (1–16) reviewer sessions at once within a command; it matters only for a PR of more than one shard. Lower it, to `4` for example, when the provider limits your request rate, or with OpenCode's claude-agent provider on a machine with little memory: each of its sessions keeps a process of about 200 MB for minutes after it ends. Comment planning runs at most two pages at once (one when this is `1`). |
692
716
  | `workflow.repairAttempts` | `2` correction turns when an answer breaks the output contract. A quick review's one follow-up turn for unfinished work uses the same budget. |
693
- | `workflow.stageRetries` | `1` new-session retry after a transient failure (provider 429/5xx, interrupted stream) or an inactivity stop. A used-up usage or spend limit (provider quota, ChatGPT or OpenCode Go usage limit, OpenCode free-model or spend limit) is named and not retried, whatever its status, and AZPR refuses OpenCode's own retries of it. |
717
+ | `workflow.stageRetries` | `1` new-session retry after a transient failure (provider 429/5xx, an interrupted stream that OpenCode did not recover by itself) or an inactivity stop. While the provider's host cannot be reached (no DNS answer, no route), OpenCode 2.3.0 retries the request by itself for up to an hour; AZPR allows that, so the review waits instead of failing, and `/pr-stop` ends it. A used-up usage or spend limit (provider quota, ChatGPT or OpenCode Go usage limit, OpenCode free-model or spend limit) is named and not retried, whatever its status, and AZPR refuses OpenCode's own retries of it. |
694
718
  | `workflow.stageIdleSeconds` | `600` (`0` turns it off, otherwise 60–7200): a reviewer stage that shows no activity this long while it waits on OpenCode (the model stream, a tool or the host stopped responding) is stopped with `failure=idle` and an error naming its last activity, then retried in a new session. Every model request, streamed chunk of output, tool start or end and announced host retry restarts the window, so a stage that keeps working, including a long answer that keeps streaming, is never cut. With shell allowed, an approval or a command that takes longer counts as inactivity. |
695
719
  | `debug.enabled` / `debug.directory` / `debug.keepRuns` | `false` / `""` / `20` run directories kept (`0` keeps all); see [debugging](docs/DEBUGGING.md). |
696
720
 
@@ -802,8 +826,55 @@ publication follows (see [automatic comments](#automatic-comments)).
802
826
 
803
827
  A failed final version recheck adds a warning; it does not by itself prevent
804
828
  COMPLETE in any review mode. Read the receipt warnings. Publication separately
805
- rechecks that the PR is active and its source commit is unchanged before
806
- posting.
829
+ rechecks that the PR's source commit is unchanged before posting.
830
+
831
+ In OpenCode's terminal UI, `/pr-panel` shows or hides the
832
+ [terminal panel](#terminal-panel); it runs no model and makes no Azure DevOps
833
+ request.
834
+
835
+ ## Terminal panel
836
+
837
+ OpenCode shows what a plugin tells a conversation as plain text, so a report
838
+ or a comment preview appears there as Markdown source. In OpenCode's terminal
839
+ UI, AZPR therefore adds a panel beside the conversation: it shows the newest
840
+ report or preview rendered, and lists the sessions of the review so that you
841
+ can open one. The [recording of a real review](docs/DEMO.md#the-terminal-panel)
842
+ shows both side by side.
843
+
844
+ - **It opens by itself** when a review or a comment run starts and when a
845
+ report or preview arrives, in the conversation that is on screen. The
846
+ keyboard stays with the prompt, so the next command can be typed while the
847
+ report is in view. To have it open only when you ask, set `terminalPanel`
848
+ in the [settings](#all-settings-and-defaults):
849
+
850
+ ```json
851
+ "terminalPanel": "manual"
852
+ ```
853
+
854
+ - **Sessions.** While a review runs, each of its sessions is a row with its
855
+ state. Click a row to open that session; OpenCode opens it in a tab, and the
856
+ panel is there again when you return to the conversation. After the review
857
+ the rows are the sessions that still exist (see
858
+ [retention](#retention-and-privacy)), first the one that holds the report.
859
+ OpenCode's own session list has them too.
860
+ - **Report or preview.** Below the sessions: the report of the review, then
861
+ the comment preview once one is planned, and the saved preview again after
862
+ `/pr-comment --show`. A check (`/pr-check`) shows its table there too.
863
+ - **Keys.** `/pr-panel` shows and hides the panel; it is the panel's only
864
+ command. A click inside it gives it the keyboard: the arrow keys or `j` and
865
+ `k`, Page Up and Page Down, Home and End scroll, and Escape or `q` closes
866
+ it.
867
+ - **A narrow terminal** (fewer than 108 columns) has no room for two panes,
868
+ and OpenCode would show the panel in place of the conversation. There the
869
+ panel does not open by itself; it says that something is ready, and
870
+ `/pr-panel` shows it full screen.
871
+
872
+ The panel only reads what AZPR already put into your conversation and into the
873
+ session that holds a report. It sends no prompt, starts no review and posts
874
+ nothing; `/pr-comment --publish` is still a command you type. It comes with
875
+ the package and needs no setup; `terminalPanel` is its one setting. Other
876
+ OpenCode clients, such as the desktop app, do not load it and show AZPR's
877
+ notices as before.
807
878
 
808
879
  ## Comments
809
880
 
@@ -919,15 +990,18 @@ When every finding is already discussed on the PR, typically by AZPR's own
919
990
  comment from an earlier run, there is nothing new to post: the receipt says
920
991
  `NOTHING_TO_POST` and the plan is saved (the summary's marker follows the
921
992
  inline comments, so re-reviewing an unchanged PR would otherwise add a summary
922
- each time). Publication itself still rechecks that the PR is active and
993
+ each time). Publication itself still rechecks that the PR's source commit is
923
994
  unchanged. A command you type, such as `/pr-comment --publish`, posts
924
995
  every item of the saved preview, held ones included.
925
996
 
926
997
  ### Publication
927
998
 
928
- Publication is runtime code: it refuses an inactive PR or a changed source
929
- commit, lists every existing thread, skips items whose hidden marker already
930
- exists, creates the rest with the exact saved text, and reads the markers back.
999
+ Publication is runtime code: it refuses a changed source commit, lists every
1000
+ existing thread, skips items whose hidden marker already exists, creates the
1001
+ rest with the exact saved text, and reads the markers back. The PR's status
1002
+ stops nothing: a PR that was completed or abandoned, such as one merged before
1003
+ its review was commented on, is reviewed and takes comments like an active
1004
+ one, and the receipt names that status.
931
1005
  Markers are stable fingerprints of PR, file and anchored lines, so a later
932
1006
  review of unchanged code does not post duplicates. A failed or uncertain item can
933
1007
  simply be published again; a comment someone deleted on the PR is reported as
@@ -942,12 +1016,25 @@ are removed automatically. A receipt that cannot reach the conversation is saved
942
1016
  under `receipts/` there. `/pr-comment` only accepts reviews started in the same
943
1017
  conversation (or from one of that review's sessions).
944
1018
 
945
- OpenCode does not delete sessions by itself, so AZPR removes its private
946
- reviewer sessions (`deletePrivateSessions`, on by default): a completed review's
947
- sessions go when the review is evicted, since `/pr-comment` needs them until
948
- then. A review that did not complete keeps only the session holding its report
949
- or draft (every session while debug is enabled), and these kept sessions follow
950
- the same limit of 20 runs. Your own conversations are never deleted.
1019
+ AZPR's private reviewer sessions are sessions of their own, not children of
1020
+ your conversation: OpenCode 2.3.0 hands every answer of a child session to its
1021
+ parent and lets the parent's model respond to it. OpenCode therefore lists them
1022
+ next to your conversations, titled `[AZPR <id>] …`, and does not delete
1023
+ sessions by itself, so AZPR removes them (`deletePrivateSessions`, on by
1024
+ default). When a review ends, only the session that holds its report or draft
1025
+ stays, which is the one the receipt names, and the other sessions are deleted
1026
+ at once; a comment run keeps none, since its receipt carries the preview or
1027
+ the publication result. That one session goes when its review is evicted (a
1028
+ review that did not complete follows the same limit of 20 runs). A session
1029
+ OpenCode did not delete when asked stays on record: it goes with its review,
1030
+ or, when no review keeps it, takes no AZPR commands and is tried again after
1031
+ every later run. While debug is enabled every session is kept until its
1032
+ review is evicted, so turn `debug.enabled` off for everyday use if the list
1033
+ gets long. A review that an OpenCode restart interrupts leaves its sessions in
1034
+ the list; delete those yourself. Your own conversations are never deleted.
1035
+ In the terminal UI you need not look for these sessions in the list: the
1036
+ [terminal panel](#terminal-panel) names those of the latest review and opens
1037
+ the one you click.
951
1038
 
952
1039
  ## Development and removal
953
1040
 
@@ -956,6 +1043,7 @@ See [Contributing](CONTRIBUTING.md) for bug reports and development checks,
956
1043
  [code of conduct](CODE_OF_CONDUCT.md) for community conduct.
957
1044
 
958
1045
  ```sh
1046
+ npm ci
959
1047
  npm run check
960
1048
  npm test
961
1049
  node tests/host-v2-smoke.mjs /absolute/path/to/opencode
@@ -963,18 +1051,29 @@ node tests/host-v2-smoke.mjs /absolute/path/to/opencode --replace
963
1051
  node tests/host-v2-smoke.mjs /absolute/path/to/opencode --native
964
1052
  node tests/host-v2-comment-scale.mjs /absolute/path/to/opencode
965
1053
  node tests/host-v2-background-compaction.mjs /absolute/path/to/opencode
1054
+ node tests/host-v2-comment-scale.mjs /absolute/path/to/opencode --cleanup
1055
+ node tests/host-v2-background-compaction.mjs /absolute/path/to/opencode --cleanup
1056
+ node tests/host-v2-tui-panel.mjs /absolute/path/to/opencode
1057
+ node tests/host-v2-tui-panel.mjs /absolute/path/to/opencode --native
966
1058
  sh uninstall.sh --config-dir /absolute/path/to/v2-opencode-config
967
1059
  sh uninstall.sh --config-dir /absolute/path/to/v2-opencode-config --apply
968
1060
  ```
969
1061
 
970
1062
  The host fixtures run a real OpenCode binary with a loopback fake model provider
971
1063
  and a loopback fake Azure DevOps REST service in disposable directories under
972
- `.local/`.
1064
+ `.local/`. They keep debug on to read its records, and debug keeps every
1065
+ private session; the two `--cleanup` runs turn it off, so that each run deletes
1066
+ its sessions as an installation with default settings does. The two
1067
+ `host-v2-tui-panel` runs drive the real terminal UI in `tmux`, which they need,
1068
+ once installed from source and once as OpenCode's plugin manager installs the
1069
+ package. `npm ci` installs the compiler of the terminal panel's JSX, which only
1070
+ `npm run check` and `npm run build:tui` use; the installed plugin has no
1071
+ dependency and is not built on your machine.
973
1072
  Uninstall without `--apply` previews; `--apply` archives only this package under
974
1073
  `azpr-v2-backups` and leaves the private state directory for you to delete.
975
1074
  For a native installation, remove the entry you added, for example
976
- `opencode plugin remove opencode-azure-devops-pr-review@0.4.0` or
977
- `opencode plugin remove 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.4.0'`;
1075
+ `opencode plugin remove opencode-azure-devops-pr-review@0.4.2` or
1076
+ `opencode plugin remove 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.4.2'`;
978
1077
  the external settings, PAT file and private review state remain available.
979
1078
 
980
1079
  [Architecture](docs/ARCHITECTURE.md), [commenting](docs/COMMENTING.md),
@@ -987,7 +1086,7 @@ or personal model selections.
987
1086
  ## License and releases
988
1087
 
989
1088
  [MIT](LICENSE), copyright 2026 WTLAIB. See the [changelog](CHANGELOG.md) for the
990
- release scope, [v0.4.0](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/releases/tag/v0.4.0)
1089
+ release scope, [v0.4.2](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/releases/tag/v0.4.2)
991
1090
  for downloads, the [npm package](https://www.npmjs.com/package/opencode-azure-devops-pr-review),
992
1091
  [v0.2.0](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/releases/tag/v0.2.0)
993
1092
  for the recorded demonstration, and [releasing](docs/RELEASING.md) for the
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "opencode-azure-devops-pr-review",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
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
- "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"
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 src/tui-model.mjs && node --check src/tui.js && node --check server.js && node --check scripts/build-tui.mjs && node scripts/build-tui.mjs --check && sh -n install.sh && sh -n uninstall.sh",
9
+ "build:tui": "node scripts/build-tui.mjs"
9
10
  },
10
11
  "engines": {
11
12
  "node": ">=22.12.0"
@@ -30,7 +31,10 @@
30
31
  "ai-code-review"
31
32
  ],
32
33
  "license": "MIT",
33
- "exports": "./server.js",
34
+ "exports": {
35
+ ".": "./server.js",
36
+ "./tui": "./src/tui.js"
37
+ },
34
38
  "files": [
35
39
  "server.js",
36
40
  "src/",
@@ -40,5 +44,9 @@
40
44
  ],
41
45
  "publishConfig": {
42
46
  "access": "public"
47
+ },
48
+ "devDependencies": {
49
+ "@babel/core": "7.29.7",
50
+ "babel-preset-solid": "1.9.16"
43
51
  }
44
52
  }
@@ -251,12 +251,26 @@ export function renderCheckReport(snapshot, checks, readiness) {
251
251
  return `## Source readiness\n\n${snapshot ? `${snapshot.organization}/${snapshot.project}/${snapshot.repository} · PR #${snapshot.prId} · ${snapshot.status}${snapshot.title ? ` · "${snapshot.title}"` : ''}\n\n- head: \`${snapshot.head}\`\n- base: \`${snapshot.base}\`${snapshot.baseKind === 'target' ? ' (target branch tip; no merge base reported)' : ' (merge base)'}\n- changed files: ${snapshot.files.length} (${snapshot.filesComplete ? 'complete list' : 'partial list; reviewers will look for the rest'})\n\n` : ''}| Check | Result | Detail |\n| --- | --- | --- |\n${rows}${models}\n\nREADY means AZPR can read this PR through the Azure DevOps REST API with the configured PAT; it is not a review or an approval.`;
252
252
  }
253
253
 
254
+ /**
255
+ * Text for the `<azpr_NAME_data>` block of a notice (`report` or `comment`). The block ends at its closing
256
+ * tag, so that tag must not occur in the text: it is written as `&lt;/azpr_NAME_data&gt;`. Text that already
257
+ * holds that entity form, or one escaped further, gets one more level of `&amp;`, so that nothing is
258
+ * ambiguous: a reader takes exactly one level off again and has the text as it was (the terminal panel does,
259
+ * see `disclose` in tui-model.mjs). Everything else is left as it is.
260
+ */
261
+ export function enclose(name, text) {
262
+ const tag = `/azpr_${name}_data`;
263
+ return String(text ?? '').replace(new RegExp(`<${tag}>|&((?:amp;)*)lt;${tag}&((?:amp;)*)gt;`, 'g'),
264
+ (found, left, right) => (left === undefined ? `&lt;${tag}&gt;` : `&amp;${left}lt;${tag}&amp;${right}gt;`));
265
+ }
266
+
254
267
  /** Publication ledger rows for receipts. */
255
268
  export function renderPublication(review, result) {
256
269
  const rows = [...(review.publication ?? new Map()).values()].map(entry =>
257
270
  `- ${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');
258
271
  const counts = result?.counts ? Object.entries(result.counts).map(([state, count]) => `${state}=${count}`).join(', ') : '';
259
- 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.`;
272
+ // A PR that is not active takes comments all the same; its status is named, so a wrong PR shows.
273
+ return `Publication${counts ? ` (${counts})` : ''}${result?.readBack && result.readBack !== 'complete' ? `; read-back ${result.readBack}` : ''}${result?.prStatus ? `; the PR is ${result.prStatus}` : ''}:\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.`;
260
274
  }
261
275
 
262
276
  function renderStageReceipt(stage) {
@@ -266,6 +280,7 @@ function renderStageReceipt(stage) {
266
280
  ['repair-turns', stage.repairs?.length],
267
281
  ['stream-continuations', stage.hostContinuations],
268
282
  ['continuation-restarts', stage.continuationRestarts],
283
+ ['step-retries', stage.hostStepRetries],
269
284
  ['blocked-native-tools', stage.blockedNativeToolCalls],
270
285
  ['observed-tool-errors', stage.toolFailures],
271
286
  ['tool-timeouts', stage.toolTimeouts],
@@ -290,6 +305,7 @@ export function renderReceipt(run, report, status, error, settings) {
290
305
  if (run.draft) body += run.mode === 'quick'
291
306
  ? '\nIncomplete draft notice: the quick review did not complete; its observations are unconfirmed and not input for PR comments.\n'
292
307
  : '\nIncomplete draft notice: initial observations are unconfirmed because verification did not complete; they are not input for PR comments.\n';
308
+ if (run.sessionsRemoved) body += `\nSession notice: ${run.sessionsRemoved} reviewer session(s) of this run were deleted when it ended; only a session that holds the report or draft is kept (deletePrivateSessions). debug.enabled keeps them all.\n`;
293
309
  body += renderDiagnosticNotices(run, settings);
294
310
  body += run.mode === 'check'
295
311
  ? '\nStatus: READY means AZPR can read the PR through the Azure DevOps REST API; it does not review or approve the PR.\n'
@@ -311,7 +327,7 @@ export function renderReceipt(run, report, status, error, settings) {
311
327
  if (last?.reportQueued) body += `\nReport delivery: report queued to session=${last.sessionID}.\n`;
312
328
  else if (run.stages.length) body += '\nReport delivery: the report could not be queued to a review session; it is enclosed below.\n';
313
329
  if (settings.returnReport === 'full' || run.draft || ['PARTIAL', 'INCOMPLETE', 'STALE'].includes(status) || !last?.reportQueued) {
314
- body += `\nReport data:\n<azpr_report_data>\n${report.replaceAll('</azpr_report_data>', '&lt;/azpr_report_data&gt;')}\n</azpr_report_data>\n`;
330
+ body += `\nReport data:\n<azpr_report_data>\n${enclose('report', report)}\n</azpr_report_data>\n`;
315
331
  }
316
332
  }
317
333
  if (['review', 'deep', 'quick'].includes(run.mode) && status === 'COMPLETE' && settings.returnReport !== 'full') body += '\n' + renderCommentActions(run.id, settings.outputLanguage, run.afterReview) + '\n';