opencode-azure-devops-pr-review 0.4.5 → 0.4.6

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/src/runtime.mjs CHANGED
@@ -23,7 +23,7 @@ import { prepareComments, publishPlan, discussionDigest, PLANNING_PARALLEL_PAGES
23
23
  import { automaticPublicationProblems, automaticPublicationRepeats, publicationItems, publishableFindings, reviewVerification,
24
24
  everAdjusted, hasAdjustments, resolveAdjustments, everyFindingExcluded, publicationStarted, describeAdjustments, describeEarlierText, excludedReferences, previewNextSteps, previewActions, commentToken } from './comments.mjs';
25
25
  import { createToolQueue } from './tool-queue.mjs';
26
- import { API_VERSION, createAzureClient, fetchTransport, pemCertificates, proxyLabel, restBaseUrl, targetKey } from './azure.mjs';
26
+ import { API_VERSION, createAzureClient, fetchTransport, markersInThreads, pemCertificates, proxyLabel, restBaseUrl, targetKey } from './azure.mjs';
27
27
  import { REVIEW_TOOL_NAMES, reviewToolDefinitions, runReviewTool } from './review-tools.mjs';
28
28
  import { runReview } from './review-work.mjs';
29
29
  import { createReviewStore, createReviewWrites, stateRoot, REVIEW_LIMIT } from './store.mjs';
@@ -832,6 +832,8 @@ export async function setupAzurePrReview(context, baseDirectory = DEFAULT_DIR, o
832
832
  visibleCharacters: input.length, checkpointRequested: false,
833
833
  // The planning page whose sessions this grant serves; its tool evidence is that page's.
834
834
  commentPage: payload.commentWork?.page ?? null,
835
+ // The grouping pass has an answer of its own: no page, no comments, no continuation.
836
+ grouping: payload.commentWork?.kind === 'group',
835
837
  // "commit\npath" of the file contents this session's own tool calls showed;
836
838
  // never the run's shared cache or another session's reads.
837
839
  reads: new Set(),
@@ -1619,16 +1621,24 @@ export async function setupAzurePrReview(context, baseDirectory = DEFAULT_DIR, o
1619
1621
  const data = await dataFor(run);
1620
1622
  // Read live discussions once for the planner's duplicate checks; the
1621
1623
  // planner can still read threads itself if this read fails.
1622
- try { discussions = discussionDigest(await azure.threads(run, review.snapshot)); }
1624
+ // The markers among them, each with its thread: a comment for several places does not stand on
1625
+ // lines that already carry a comment of AZPR's.
1626
+ let posted = null;
1627
+ try {
1628
+ const threads = await azure.threads(run, review.snapshot);
1629
+ discussions = discussionDigest(threads);
1630
+ posted = markersInThreads(threads);
1631
+ }
1623
1632
  catch (error) {
1624
1633
  if (!run.active) throw error;
1625
1634
  run.debug.warnings.push(`Existing discussions could not be read before planning: ${errorText(error)}`);
1626
1635
  }
1627
1636
  // Planning pages run side by side, never more than the configured sessions.
1628
1637
  const parallelPages = Math.min(PLANNING_PARALLEL_PAGES, settings.workflow.parallelSessions);
1638
+ // The grouping pass, which looks for one defect at several places before the pages are made, is a stage like a page.
1629
1639
  review.plan = await prepareComments(review, data, (payload, handler) => runStage(run, roleFor(run.profile, 'comment-plan'), payload, handler,
1630
- { label: `page ${payload.commentWork.page}/${payload.commentWork.pages}` }),
1631
- { progress: message => progress(run, message), discussions, parallel: parallelPages,
1640
+ { label: payload.commentWork.kind === 'group' ? 'grouping' : `page ${payload.commentWork.page}/${payload.commentWork.pages}` }),
1641
+ { progress: message => progress(run, message), discussions, posted, parallel: parallelPages, active: () => run.active,
1632
1642
  fetchSource: path => azure.fileContent(run, review.snapshot, path, review.snapshot.head) });
1633
1643
  review.planCreatedAt = new Date().toISOString();
1634
1644
  planning = false;
@@ -1916,7 +1926,9 @@ export async function setupAzurePrReview(context, baseDirectory = DEFAULT_DIR, o
1916
1926
  if (tools) for (const name of Object.keys(tools)) if (!allowed.has(name)) delete tools[name];
1917
1927
  if (ROLES[g.role].stage === 'comment-plan' && (g.checkpointRequested || g.calls >= 12)) {
1918
1928
  event.tools = {};
1919
- event.system?.push?.({ type: 'text', text: 'Finish this work page now; tools are unavailable for this response. Return exactly one JSON object. If all assigned findings are handled, return READY. Otherwise return CONTINUE with completed comments/skips and a "continuation" note naming exact data references, completed checks and remaining work.' });
1929
+ event.system?.push?.({ type: 'text', text: g.grouping
1930
+ ? 'Finish the grouping now; tools are unavailable for this response. Return exactly one JSON object: {"status": "READY", "groups": [...]} with the groups you are sure of from the findings in your input, and [] when there is none. This pass has no continuation.'
1931
+ : 'Finish this work page now; tools are unavailable for this response. Return exactly one JSON object. If all assigned findings are handled, return READY. Otherwise return CONTINUE with completed comments/skips and a "continuation" note naming exact data references, completed checks and remaining work.' });
1920
1932
  }
1921
1933
  g.primaryPrepared = true;
1922
1934
  }));