pi-pr-review 1.17.1 → 1.17.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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.17.2](https://github.com/10ego/pi-pr-review/compare/v1.17.1...v1.17.2) (2026-08-31)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **review:** keep degraded comments concise ([#126](https://github.com/10ego/pi-pr-review/issues/126)) ([912e474](https://github.com/10ego/pi-pr-review/commit/912e474d04be9db504d2ea83bcd9a7c86db2ca5b))
9
+
3
10
  ## [1.17.1](https://github.com/10ego/pi-pr-review/compare/v1.17.0...v1.17.1) (2026-08-31)
4
11
 
5
12
 
package/README.md CHANGED
@@ -195,7 +195,7 @@ Every invocation has a host-owned monotonic 15-minute hard cap, including the tw
195
195
 
196
196
  A timed-out or retryable quota/rate-limit/capacity lane may start at most one configured fallback attempt. It starts only when at least `minimumFallbackMs` plus cleanup reserve remains; the host never changes the configured model, thinking level, or tool policy to save time. If a tier is unset, its existing nearest-configured-tier/Pi-default behavior is unchanged.
197
197
 
198
- On an attempt deadline the host records timeout separately from user cancellation, sends TERM to the original child, waits only `terminationGraceMs`, then sends KILL if no exit was observed and stops draining after the cleanup reserve. Partial assistant text and telemetry survive this lifecycle. The synthesis cap arms only once review work goes quiet: any turn that starts or any review tool that runs again while the cap is armed defers it, and it re-arms from the next turn end, so early review-tool turns (for example verification discovery) cannot starve later heavy lanes. Batch/total expiry stops queued work and waiting lanes; completed and partial artifacts proceed to Markdown synthesis or deterministic lane assembly, identify every incomplete reviewer, and remain eligible for the safe body-only `COMMENT` publication path. A timed-out lane is never reported as `NO FINDINGS` or full coverage, and a lane ended by the host total or synthesis deadline is disclosed with that kind (`deadline_expired`) instead of being mistaken for its own attempt deadline expiring. Host lane artifacts are authoritative for completeness in both directions: a false assistant completion claim cannot upgrade incomplete lanes, and a paraphrased or omitted `Lane completeness` line cannot downgrade a host-complete batch away from the concise renderer.
198
+ On an attempt deadline the host records timeout separately from user cancellation, sends TERM to the original child, waits only `terminationGraceMs`, then sends KILL if no exit was observed and stops draining after the cleanup reserve. Partial assistant text and telemetry survive this lifecycle. The synthesis cap arms only once review work goes quiet: any turn that starts or any review tool that runs again while the cap is armed defers it, and it re-arms from the next turn end, so early review-tool turns (for example verification discovery) cannot starve later heavy lanes. Batch/total expiry stops queued work and waiting lanes; completed and partial artifacts proceed to Markdown synthesis or deterministic lane assembly, identify every incomplete reviewer, and remain eligible for the concise body-only `COMMENT` publication path. A timed-out lane is never reported as `NO FINDINGS` or full coverage, and a lane ended by the host total or synthesis deadline is disclosed with that kind (`deadline_expired`) instead of being mistaken for its own attempt deadline expiring. Host lane artifacts are authoritative for completeness in both directions: a false assistant completion claim cannot upgrade incomplete lanes, and a paraphrased or omitted `Lane completeness` line cannot downgrade a host-complete batch away from the concise renderer.
199
199
 
200
200
  Initial operating targets are ordinary-review p50 ≤ 6 minutes and p95 ≤ 12 minutes, and large-review p50 ≤ 10 minutes and p95 ≤ 14 minutes, with the 15-minute hard cap authoritative. Invocation telemetry starts before GitHub preflight and records configured deadline source/caps, termination grace, cleanup reserve, and active wall time; batch details record invocation time consumed before each attempt, batch/total time remaining at dispatch, first event/output timing, lifecycle counts, configured and effective batch-truncated attempt deadlines, fallback starts/budget rejections, external total/synthesis deadline expiries per lane, and termination grace/escalation data. These are initial production targets, not a promise that every provider completes before its host deadline.
201
201
 
@@ -227,11 +227,11 @@ Publishing is off by default.
227
227
 
228
228
  The extension owns normal publishing. Before review execution it captures repository, hostname, PR number/title, reviewed head, lifecycle state, posting/stale authority, and invocation identity independently of assistant text. After synthesis, it caches one validated completed review (the host-owned canonical artifact) per repository and PR in the current Pi session. `autoPostReviews` and `--comment` publish that cached review after completion; `--no-comment` suppresses publication for the run.
229
229
 
230
- Review semantics are Markdown-first. A deterministic tolerant parser normalizes line endings, extracts complete findings when possible, and ignores heading-like text inside CommonMark fenced-code and HTML-block contexts. Every degraded synthesis — ambiguous, partially parsed, incomplete lane coverage, or absent terminal synthesis — publishes one deterministic host-rendered `COMMENT` body with generic code-review labels: a `Coverage` section with the exact lane lifecycle disclosure, a `Findings` section with host-formatted parsed findings (never a clean-review claim when nothing parsed), and the complete original synthesis plus every retained lane artifact preserved verbatim under `Retained synthesis` / `Retained lane output` with heading levels shifted so they nest. A contradictory completion claim inside retained text is reconciled to the host verdict. Reserved markers are sanitized, size limits are enforced, and the canonical marker is appended only by host code. Optional formatting repair is never required and can never suppress the degraded fallback.
230
+ Review semantics are Markdown-first. A deterministic tolerant parser normalizes line endings, extracts complete findings when possible, and ignores heading-like text inside CommonMark fenced-code and HTML-block contexts. Every degraded synthesis — ambiguous, partially parsed, incomplete lane coverage, or absent terminal synthesis — is retained internally as one deterministic host-rendered artifact with generic code-review labels: a `Coverage` section with the exact lane lifecycle disclosure, a `Findings` section with host-formatted parsed findings (never a clean-review claim when nothing parsed), and the complete original synthesis plus every retained lane artifact preserved under `Retained synthesis` / `Retained lane output`. GitHub publication never dumps that artifact: it emits a concise `COMMENT` with a short incomplete-coverage or unstructured-output warning, validated inline findings, and summary-only `Other Notes`. Reserved markers are sanitized, size limits are enforced, and the canonical marker is appended only by host code. Optional formatting repair is never required and can never suppress the degraded fallback.
231
231
 
232
232
  You can publish the cache later with `/pr-review-publish 123`, or directly ask the agent to “post the inline review,” “post it as an inline review,” or “publish the review for PR #123.” The extension handles that request directly before an agent turn. `/pr-review-publish` and a matching direct request publish only the cache; they never start or rerun review agents. Unnumbered direct requests select the latest cached review for the current repository. Only fresh interactive/RPC input can use the direct path.
233
233
 
234
- Every authorized publish path builds one GitHub review payload and sends at most one review `POST`; it never submits `REQUEST_CHANGES` or retries a rejected write with a fallback POST. Fully parsed Markdown with one complete retained artifact for every host-registered dispatch may emit a gated `APPROVE` through the same host binding, priority, lifecycle, self-author, and stale checks as strict JSON. Host lane evidence is authoritative for completeness: a paraphrased or omitted `All requested lanes completed.` disclosure cannot downgrade a host-complete batch, and a false disclosure cannot upgrade incomplete or missing lane coverage; the assistant's canonical line is consulted only when no batch evidence exists. Verdict fields outside the document preamble, hidden in CommonMark code/HTML blocks, or inside lazy container continuations, severity-tagged headings outside `Findings`, incomplete or missing host lane coverage, malformed or unsafe output, and lane-fallback artifacts remain `COMMENT` reviews; their safely parsed findings keep inline placement, while unparsable output publishes body-only. Cache restore reclassifies persisted lane output and requires the exact host-recorded artifact key set, with every complete artifact matching the frozen invocation generation, tier, and minor-hygiene contract, and re-synthesizes the retained raw text under that frozen binding before retaining approval eligibility. For a current, open PR, the first 50 eligible P0–P3 findings with valid, unique diff anchors are inline. The concise top-level body starts with the verdict, points readers to inline findings, and places nits, off-diff findings, unavailable diff metadata, duplicate anchors, and overflow under `Other Notes`; overview, verification, strengths, and transport diagnostics stay out of the public summary. The complete original Markdown remains retained internally and is never substituted for a fully parsed concise review. If the concise body plus its canonical marker exceeds GitHub's limit, publication fails closed rather than dumping the full report. Stale or authorized non-open reviews are body-only. A stale approval additionally requires `allowStaleApprovals: true`.
234
+ Every authorized publish path builds one GitHub review payload and sends at most one review `POST`; it never submits `REQUEST_CHANGES` or retries a rejected write with a fallback POST. Fully parsed Markdown with one complete retained artifact for every host-registered dispatch may emit a gated `APPROVE` through the same host binding, priority, lifecycle, self-author, and stale checks as strict JSON. Host lane evidence is authoritative for completeness: a paraphrased or omitted `All requested lanes completed.` disclosure cannot downgrade a host-complete batch, and a false disclosure cannot upgrade incomplete or missing lane coverage; the assistant's canonical line is consulted only when no batch evidence exists. Verdict fields outside the document preamble, hidden in CommonMark code/HTML blocks, or inside lazy container continuations, severity-tagged headings outside `Findings`, incomplete or missing host lane coverage, malformed or unsafe output, and lane-fallback artifacts remain `COMMENT` reviews; their safely parsed findings keep inline placement, while unparsable output publishes body-only. Cache restore reclassifies persisted lane output and requires the exact host-recorded artifact key set, with every complete artifact matching the frozen invocation generation, tier, and minor-hygiene contract, and re-synthesizes the retained raw text under that frozen binding before retaining approval eligibility. For a current, open PR, the first 50 eligible P0–P3 findings with valid, unique diff anchors are inline. The concise top-level body starts with the verdict, points readers to inline findings, and places nits, off-diff findings, unavailable diff metadata, duplicate anchors, and overflow under `Other Notes`; overview, verification, strengths, and transport diagnostics stay out of the public summary. The complete original Markdown and retained lane evidence remain internal and are never substituted for a concise GitHub review, including degraded, incomplete, cached, direct, and stale `COMMENT` publication. If the concise body plus its canonical marker exceeds GitHub's limit, publication fails closed rather than dumping the full report. Stale or authorized non-open reviews are body-only. A stale approval additionally requires `allowStaleApprovals: true`.
235
235
 
236
236
  All publication paths apply host-enforced safety gates: captured posting authority, repository and requested-PR binding, reviewed/current-head and stale policy, bounded bodies and payloads, draft and lifecycle checks, non-open authorization, authenticated-identity same-head duplicate detection, and a final head check. Fully or partially parsed review paths additionally enforce safe inline locations, including degraded incomplete-lane reviews whose findings still parse. Raw and lane-assembled fallbacks without parsed findings are body-only; every degraded path is `COMMENT`-only, and assistant text cannot select event, commit, repository, hostname, API path, or inline anchors. Unknown or invalid host states fail closed before a write.
237
237
 
@@ -432,6 +432,16 @@ type ReviewPublicationOrigin =
432
432
  | { readonly kind: "publish-command"; readonly stalePolicy: "frozen" | "allow-stale" }
433
433
  | { readonly kind: "direct-request" };
434
434
 
435
+ function conciseDegradedPublicationNotice(record: CompletedReviewRecord): string | undefined {
436
+ if (record.completeness === "incomplete") {
437
+ return "> [!WARNING]\n> Review coverage was incomplete. This COMMENT is not evidence of a clean review.";
438
+ }
439
+ if (record.synthesisQuality !== undefined && record.synthesisQuality !== "fully_parsed") {
440
+ return "> [!WARNING]\n> The review output was not fully structured. This COMMENT is not evidence of a clean review.";
441
+ }
442
+ return undefined;
443
+ }
444
+
435
445
  async function publishCompletedReview(
436
446
  record: CompletedReviewRecord,
437
447
  origin: ReviewPublicationOrigin,
@@ -459,8 +469,9 @@ async function publishCompletedReview(
459
469
  ctx.ui.notify("PR review was not posted: cached review artifact is missing pr.head_sha", "error");
460
470
  return undefined;
461
471
  }
462
- const useDegradedPublicationBody = typeof record.publicationBody === "string" &&
463
- (record.synthesisQuality !== "fully_parsed" || record.completeness === "incomplete");
472
+ const degradedPublication = record.completeness === "incomplete" ||
473
+ (record.synthesisQuality !== undefined && record.synthesisQuality !== "fully_parsed");
474
+ const publicationNotice = conciseDegradedPublicationNotice(record);
464
475
  const result = await publishPullReview({
465
476
  cwd: ctx.cwd,
466
477
  prNumber: record.invocation.prNumber,
@@ -471,21 +482,18 @@ async function publishCompletedReview(
471
482
  approveMaxPriorityLevel: record.invocation.approveMaxPriorityLevel,
472
483
  expectedRepository: record.repository,
473
484
  review: record.review,
474
- ...(useDegradedPublicationBody ? { publicationBody: record.publicationBody } : {}),
475
- // Fully parsed reviews publish only the concise host-rendered body plus
476
- // inline findings. If that payload cannot fit, publication fails closed;
477
- // retained raw synthesis is never substituted as a public report dump.
478
- // A degraded synthesis stays COMMENT-only, but its safely parsed findings
479
- // still earn inline placement; only unparsable output is forced body-only.
485
+ ...(publicationNotice ? { publicationNotice } : {}),
486
+ // Every review publishes only the concise host-rendered body plus validated
487
+ // inline findings. Retained raw synthesis and lane evidence remain private
488
+ // completion diagnostics, including for degraded/incomplete COMMENT runs.
489
+ // If the concise payload cannot fit, publication fails closed.
480
490
  forceBodyOnly: record.synthesisQuality !== undefined &&
481
491
  record.synthesisQuality !== "fully_parsed" &&
482
492
  !(Array.isArray(record.review.findings) && record.review.findings.length > 0),
483
493
  // A publication body identifies Markdown-derived or degraded synthesis.
484
494
  // Enforce COMMENT again at the final publication boundary so restored
485
495
  // canonical artifacts created by an older parser cannot inherit APPROVE.
486
- forceComment: record.mergeApprovalEligible === false || useDegradedPublicationBody ||
487
- (record.synthesisQuality !== undefined &&
488
- (record.synthesisQuality !== "fully_parsed" || record.completeness === "incomplete")),
496
+ forceComment: record.mergeApprovalEligible === false || degradedPublication,
489
497
  });
490
498
  notifyPublishResult(result, source, ctx);
491
499
  return result;
@@ -840,9 +840,9 @@ export function synthesizeReviewArtifact(input: {
840
840
  }
841
841
  return reasons.length > 0 ? reasons : ["terminal synthesis was not structurally parseable; preserved as body-only Markdown"];
842
842
  })();
843
- // Markdown is the durable semantic product. A fully parsed complete synthesis
844
- // publishes verbatim; every degraded synthesis publishes the deterministic
845
- // host-rendered body so labels stay readable while all content is retained.
843
+ // Markdown is the durable semantic product. Keep the complete deterministic
844
+ // body for local rendering, cache diagnostics, and extraction. GitHub
845
+ // publication independently renders a concise host summary for every quality.
846
846
  const body = quality === "fully_parsed"
847
847
  ? safeReviewBody(raw)
848
848
  : buildDegradedReviewBody({
@@ -1257,7 +1257,11 @@ function findingAnchor(finding: ReviewFindingLike): string | undefined {
1257
1257
  return `${path}:${side}:${start}:${end}`;
1258
1258
  }
1259
1259
 
1260
- export function buildReviewSummary(review: ReviewLike, inlineComments: PublishComment[] = []): string {
1260
+ export function buildReviewSummary(
1261
+ review: ReviewLike,
1262
+ inlineComments: PublishComment[] = [],
1263
+ publicationNotice?: string,
1264
+ ): string {
1261
1265
  const findings = Array.isArray(review.findings) ? review.findings : [];
1262
1266
  const inlineAnchors = new Map<string, number>();
1263
1267
  for (const comment of inlineComments) {
@@ -1281,6 +1285,7 @@ export function buildReviewSummary(review: ReviewLike, inlineComments: PublishCo
1281
1285
  ? "Approve"
1282
1286
  : "Comment";
1283
1287
  const lines = [`**Verdict:** ${verdict}`];
1288
+ if (publicationNotice?.trim()) lines.push("", publicationNotice.trim());
1284
1289
  if (inlineComments.length > 0) {
1285
1290
  lines.push("", "See the inline review comments for the primary findings.");
1286
1291
  }
@@ -1503,6 +1508,7 @@ function buildLosslessReviewPayload(input: {
1503
1508
  changedFiles?: readonly ChangedFileLike[];
1504
1509
  bodyPreamble?: string;
1505
1510
  bodyOverride?: string;
1511
+ publicationNotice?: string;
1506
1512
  diagnostics?: readonly string[];
1507
1513
  event?: ReviewEventType;
1508
1514
  }): { payload?: PullReviewPayload; diagnostics: string[]; errors: string[] } {
@@ -1520,6 +1526,9 @@ function buildLosslessReviewPayload(input: {
1520
1526
  if (input.bodyPreamble && containsReservedReviewMarker(input.bodyPreamble)) {
1521
1527
  return { diagnostics, errors: ["publication preamble contains a reserved pi-pr-review marker"] };
1522
1528
  }
1529
+ if (input.publicationNotice && containsReservedReviewMarker(input.publicationNotice)) {
1530
+ return { diagnostics, errors: ["publication notice contains a reserved pi-pr-review marker"] };
1531
+ }
1523
1532
  const selected = input.allowInlineComments
1524
1533
  ? selectInlineComments(input.review, input.changedFiles ?? [])
1525
1534
  : { comments: [], diagnostics: [], errors: [] };
@@ -1529,7 +1538,10 @@ function buildLosslessReviewPayload(input: {
1529
1538
  // Inline-placement diagnostics remain available to the host notification,
1530
1539
  // while every affected finding is retained under Other Notes. Do not expose
1531
1540
  // transport diagnostics as if they were review findings.
1532
- let content = input.bodyOverride?.trim() || buildReviewSummary(input.review, selected.comments);
1541
+ let content = input.bodyOverride?.trim() || buildReviewSummary(input.review, selected.comments, input.publicationNotice);
1542
+ if (input.bodyOverride?.trim() && input.publicationNotice?.trim()) {
1543
+ content = `${content}\n\n${input.publicationNotice.trim()}`;
1544
+ }
1533
1545
  if (input.bodyPreamble?.trim()) content = `${input.bodyPreamble.trim()}\n\n${content}`;
1534
1546
  const marker = canonicalReviewMarker(markerHeadSha);
1535
1547
  const bodyError = validateReviewBody(content);
@@ -2148,8 +2160,10 @@ export async function publishPullReview(input: {
2148
2160
  approveMaxPriorityLevel?: ApproveMaxPriorityLevel;
2149
2161
  expectedRepository?: RepositoryBinding;
2150
2162
  review: ReviewLike;
2151
- /** Host-sanitized original synthesis retained when structured extraction is partial or absent. */
2163
+ /** Compatibility-only body override. The extension lifecycle keeps retained synthesis private. */
2152
2164
  publicationBody?: string;
2165
+ /** Short host-owned warning included in the concise summary. */
2166
+ publicationNotice?: string;
2153
2167
  /** Prevent uncertain/raw synthesis from selecting APPROVE or inline anchors. */
2154
2168
  forceBodyOnly?: boolean;
2155
2169
  /** Prevent partially trusted synthesis from selecting a merge-relevant event. */
@@ -2166,6 +2180,7 @@ export async function publishPullReview(input: {
2166
2180
  expectedRepository,
2167
2181
  review,
2168
2182
  publicationBody,
2183
+ publicationNotice,
2169
2184
  forceBodyOnly = false,
2170
2185
  forceComment = false,
2171
2186
  } = input;
@@ -2266,6 +2281,7 @@ export async function publishPullReview(input: {
2266
2281
  allowInlineComments,
2267
2282
  changedFiles,
2268
2283
  ...(publicationBody ? { bodyOverride: publicationBody } : {}),
2284
+ ...(publicationNotice ? { publicationNotice } : {}),
2269
2285
  ...(isApprove ? { event: APPROVE_EVENT } : {}),
2270
2286
  ...(changedFileLookupFailed ? { diagnostics: [CHANGED_FILE_LOOKUP_DIAGNOSTIC] } : {}),
2271
2287
  ...(headPlan.stale
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-pr-review",
3
- "version": "1.17.1",
3
+ "version": "1.17.2",
4
4
  "description": "Parallel AI code review for GitHub pull requests in the Pi coding agent, with model-agnostic tiered subagents, structured findings, optional verification, and host-gated COMMENT or qualified APPROVE publishing.",
5
5
  "keywords": [
6
6
  "pi-package",