opencode-azure-devops-pr-review 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +6 -3
- package/CHANGELOG.md +37 -0
- package/CONTRIBUTING.md +4 -3
- package/README.md +130 -45
- package/docs/ARCHITECTURE.md +11 -5
- package/docs/AZURE_DEVOPS.md +7 -2
- package/docs/DEBUGGING.md +7 -6
- package/docs/ENTERPRISE.md +1 -1
- package/docs/QUICKSTART.md +50 -46
- package/docs/RELEASING.md +2 -2
- package/docs/ROADMAP.md +5 -3
- package/docs/VALIDATION.md +148 -6
- package/docs/releases/v0.2.2.md +76 -0
- package/docs/releases/v0.2.3.md +93 -0
- package/install.sh +1 -1
- package/package.json +3 -2
- package/src/azure.mjs +15 -6
- package/src/host.mjs +9 -8
- package/src/runtime.mjs +7 -6
- package/src/session.mjs +10 -3
package/src/host.mjs
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* constant and response normalization lives here so an upgrade has one place
|
|
7
7
|
* to adjust.
|
|
8
8
|
*/
|
|
9
|
-
export const TESTED_HOST_VERSION = '2.1.
|
|
9
|
+
export const TESTED_HOST_VERSION = '2.1.4';
|
|
10
10
|
|
|
11
|
-
// Text OpenCode (2.0.32 through 2.1.
|
|
11
|
+
// Text OpenCode (2.0.32 through 2.1.4) queues after resuming an interrupted text stream.
|
|
12
12
|
export const HOST_CONTINUATION_TEXT = 'The previous response was interrupted. Continue from where you left off without repeating completed content.';
|
|
13
13
|
|
|
14
14
|
// Context message types that mean someone other than the admitted prompt
|
|
@@ -49,9 +49,9 @@ export function hostCapabilities(context) {
|
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* Session events that show a turn progressing while no hook runs. OpenCode
|
|
52
|
-
* 2.1.2
|
|
53
|
-
* or tool-call input; the projected session context shows the text
|
|
54
|
-
* the step ends.
|
|
52
|
+
* 2.1.2 and 2.1.4 emit one delta event per streamed chunk of answer text,
|
|
53
|
+
* reasoning or tool-call input; the projected session context shows the text
|
|
54
|
+
* only once the step ends.
|
|
55
55
|
*/
|
|
56
56
|
const PROGRESS_EVENTS = new Map([
|
|
57
57
|
...['started', 'delta', 'ended'].map(phase => [`session.text.${phase}`, 'model output was streamed']),
|
|
@@ -71,9 +71,10 @@ export function sessionProgress(event) {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
* OpenCode runs plugins on Bun (1.4.2 in 2.0.32 and 2.1.2
|
|
75
|
-
* per-request `proxy` and `tls` options. Node's fetch
|
|
76
|
-
* a configured proxy would be bypassed; callers
|
|
74
|
+
* OpenCode runs plugins on Bun (1.4.2 in 2.0.32 and 2.1.2, 1.4.4 in 2.1.4),
|
|
75
|
+
* whose fetch accepts per-request `proxy` and `tls` options. Node's fetch
|
|
76
|
+
* silently ignores both, so a configured proxy would be bypassed; callers
|
|
77
|
+
* refuse instead.
|
|
77
78
|
*/
|
|
78
79
|
export const fetchTransportSupported = () => typeof process.versions?.bun === 'string';
|
|
79
80
|
|
package/src/runtime.mjs
CHANGED
|
@@ -501,7 +501,7 @@ export async function setupAzurePrReview(context, baseDirectory = DEFAULT_DIR, o
|
|
|
501
501
|
requestKinds: { primary: 0, compaction: 0, generate: 0, title: 0, unknown: 0 }, rejectedRequests: 0, retryEvents: [],
|
|
502
502
|
toolCalls: new Map(), completedTools: new Set(), terminalTools: new Map(), failedTools: new Set(),
|
|
503
503
|
returnedTools: new Set(), reportedToolErrors: new Set(), truncatedTools: new Set(), blockedNativeCalls: new Map(),
|
|
504
|
-
toolArgumentCharacters: new Map(), toolTimeouts: 0,
|
|
504
|
+
toolArgumentCharacters: new Map(), toolTimeouts: 0,
|
|
505
505
|
visibleCharacters: input.length, checkpointRequested: false,
|
|
506
506
|
// The planning page whose sessions this grant serves; its tool evidence is that page's.
|
|
507
507
|
commentPage: payload.commentWork?.page ?? null,
|
|
@@ -531,7 +531,7 @@ export async function setupAzurePrReview(context, baseDirectory = DEFAULT_DIR, o
|
|
|
531
531
|
catch (error) {
|
|
532
532
|
// A follow-up is optional: when it or a later turn fails, the answer it
|
|
533
533
|
// followed stands. Cancellation and context overflow keep their rules.
|
|
534
|
-
const failureClass = runSignal.aborted ? 'cancelled' : watch.error ? 'idle' : classifyFailure(error
|
|
534
|
+
const failureClass = runSignal.aborted ? 'cancelled' : watch.error ? 'idle' : classifyFailure(error);
|
|
535
535
|
if (!followUp || ['cancelled', 'overflow'].includes(failureClass)) throw error;
|
|
536
536
|
Object.assign(followUp, { outcome: 'failed', failureClass, error: errorText(watch.error ?? error).slice(0, 300) });
|
|
537
537
|
if (error?.response && settings.debug.enabled) await run.debug.write(`${stem}.response-${followUp.turn === turn ? 'follow-up' : 'repair'}${turn}.json`, diagnosticResponse(error.response));
|
|
@@ -594,7 +594,7 @@ export async function setupAzurePrReview(context, baseDirectory = DEFAULT_DIR, o
|
|
|
594
594
|
record.error = errorText(error);
|
|
595
595
|
if (error?.execution) record.execution = { ...error.execution, authorizedPrimaryRequests: g.calls };
|
|
596
596
|
if (idle) record.idleStop = watch.idleStop;
|
|
597
|
-
const failureClass = runSignal.aborted ? 'cancelled' : idle ? 'idle' : classifyFailure(error
|
|
597
|
+
const failureClass = runSignal.aborted ? 'cancelled' : idle ? 'idle' : classifyFailure(error);
|
|
598
598
|
record.failureClass = failureClass;
|
|
599
599
|
if (error instanceof Error) error.failureClass = failureClass;
|
|
600
600
|
grants.delete(made.id);
|
|
@@ -1119,10 +1119,11 @@ export async function setupAzurePrReview(context, baseDirectory = DEFAULT_DIR, o
|
|
|
1119
1119
|
if (observed) observed.requestKinds[kind]++;
|
|
1120
1120
|
try {
|
|
1121
1121
|
const g = authorize(event.sessionID, event.agent, event.model);
|
|
1122
|
+
// Refused before anything is sent. Whether the stage overflowed is read from its failed turn: a
|
|
1123
|
+
// compaction OpenCode attempts there ends it, a background summary (OpenCode 2.1.4) does not.
|
|
1122
1124
|
if (event.kind !== 'primary') {
|
|
1123
|
-
if (event.kind === 'compaction') g.compactionRequested = true;
|
|
1124
1125
|
throw new Error(event.kind === 'compaction'
|
|
1125
|
-
? '[AZPR] Private review compaction is not authorized;
|
|
1126
|
+
? '[AZPR] Private review compaction is not authorized; a reviewer whose context fills is split into smaller sessions instead.'
|
|
1126
1127
|
: '[AZPR] Auxiliary model requests are not authorized for private reviewers.');
|
|
1127
1128
|
}
|
|
1128
1129
|
if (!g.admitted || !g.primaryPrepared) throw new Error('[AZPR] Model request has no authorized primary context.');
|
|
@@ -1152,7 +1153,7 @@ export async function setupAzurePrReview(context, baseDirectory = DEFAULT_DIR, o
|
|
|
1152
1153
|
// Enforce the shell setting and the project boundary, regardless of
|
|
1153
1154
|
// permission rules the host appends after this plugin. Outside the
|
|
1154
1155
|
// project only AZPR's own private data is readable; the host's default
|
|
1155
|
-
// for other paths is not trusted (OpenCode 2.0.22 asked; 2.0.31 through 2.1.
|
|
1156
|
+
// for other paths is not trusted (OpenCode 2.0.22 asked; 2.0.31 through 2.1.4 allow).
|
|
1156
1157
|
// Private reviewers run unattended: a request that would wait for
|
|
1157
1158
|
// approval is refused at once. Only shell keeps host approvals, and only
|
|
1158
1159
|
// when the user allowed it (shell: "ask" or "inherit").
|
package/src/session.mjs
CHANGED
|
@@ -165,15 +165,18 @@ export function restartIndex(texts) {
|
|
|
165
165
|
|
|
166
166
|
/**
|
|
167
167
|
* Classify a failed stage for the runtime's retry policy.
|
|
168
|
-
* - overflow: the host
|
|
168
|
+
* - overflow: the host attempted compaction in the failed turn (context full) or
|
|
169
|
+
* the provider rejected size. A refused background summary
|
|
170
|
+
* (`experimental.background_compaction`) is not evidence: the turn went on, so
|
|
171
|
+
* its own failure decides.
|
|
169
172
|
* - transient: interrupted streams, provider 408/409/425/429/5xx, missing idle,
|
|
170
173
|
* unexpected host messages.
|
|
171
174
|
* - permanent: everything else (authentication, bad request, a used-up quota or
|
|
172
175
|
* free-model limit, whatever its HTTP status, cancellation).
|
|
173
176
|
*/
|
|
174
|
-
export function classifyFailure(error
|
|
175
|
-
if (compactionRequested) return 'overflow';
|
|
177
|
+
export function classifyFailure(error) {
|
|
176
178
|
const execution = error?.execution;
|
|
179
|
+
if (execution?.compaction) return 'overflow';
|
|
177
180
|
if (execution?.interrupted || execution?.provider?.exhausted) return 'permanent';
|
|
178
181
|
const status = execution?.provider?.status;
|
|
179
182
|
if (status === 413) return 'overflow';
|
|
@@ -231,6 +234,10 @@ export async function requestReview(context, { sessionID, text, role, model, met
|
|
|
231
234
|
terminalOutcome: terminal?.type === 'idle' ? outcome(terminal.outcome) : 'missing-idle',
|
|
232
235
|
assistantResponses: assistants.length, lastFinish: finish,
|
|
233
236
|
interrupted: session.outcome === 'interrupted' || terminal?.outcome === 'interrupted' || final?.error?.type === 'aborted' };
|
|
237
|
+
// OpenCode opens a compaction's message before it asks for the summary, so a compaction it attempted in this
|
|
238
|
+
// turn, which AZPR refuses, shows here. A background summary (OpenCode 2.1.4) publishes nothing.
|
|
239
|
+
const compaction = turn.filter(message => message?.type === 'compaction').at(-1);
|
|
240
|
+
if (compaction) execution.compaction = ['running', 'completed', 'failed'].includes(compaction.status) ? compaction.status : 'unknown';
|
|
234
241
|
const provider = !execution.interrupted && providerFailure(final, assistants);
|
|
235
242
|
if (provider) execution.provider = provider;
|
|
236
243
|
const hint = provider?.exhausted
|