@in-the-loop-labs/pair-review 5.1.0 → 5.2.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.
Files changed (39) hide show
  1. package/README.md +14 -4
  2. package/package.json +3 -2
  3. package/plugin/.claude-plugin/plugin.json +1 -1
  4. package/plugin-code-critic/.claude-plugin/plugin.json +1 -1
  5. package/plugin-pair-loop/.claude-plugin/plugin.json +1 -1
  6. package/plugin-pair-loop/skills/loop/SKILL.md +21 -6
  7. package/public/css/pr.css +2 -2
  8. package/public/index.html +5 -2
  9. package/public/js/index.js +106 -9
  10. package/src/ai/analyzer.js +191 -27
  11. package/src/ai/index.js +1 -0
  12. package/src/ai/omp/review-config.yml +13 -0
  13. package/src/ai/omp-provider.js +279 -0
  14. package/src/ai/pi-format.js +535 -0
  15. package/src/ai/pi-provider.js +38 -963
  16. package/src/ai/pi-style-provider.js +526 -0
  17. package/src/ai/provider.js +2 -0
  18. package/src/chat/chat-providers.js +34 -11
  19. package/src/chat/omp-bridge.js +111 -0
  20. package/src/chat/pi-bridge.js +42 -34
  21. package/src/chat/session-manager.js +30 -4
  22. package/src/config.js +32 -3
  23. package/src/links/host-names.js +200 -0
  24. package/src/local-review.js +7 -3
  25. package/src/main.js +21 -1
  26. package/src/review-config.js +81 -5
  27. package/src/routes/analyses.js +6 -2
  28. package/src/routes/config.js +16 -0
  29. package/src/routes/local.js +7 -6
  30. package/src/routes/mcp.js +5 -2
  31. package/src/routes/pr.js +8 -5
  32. package/src/routes/setup.js +1 -1
  33. package/src/routes/shared.js +27 -0
  34. package/src/routes/stack-analysis.js +4 -1
  35. package/src/settings/registry.js +1 -1
  36. package/src/setup/local-setup.js +5 -3
  37. package/src/single-port.js +1 -1
  38. package/src/utils/json-extractor.js +162 -41
  39. package/src/utils/local-path-input.js +64 -8
@@ -385,6 +385,20 @@ A suggestion is a duplicate if it targets the same file and overlapping lines an
385
385
  return sections.join('\n\n');
386
386
  }
387
387
 
388
+ /**
389
+ * A response object is "ours" if it carries any key from our response schema.
390
+ * A string `summary` alone is a valid zero-finding result (e.g. "all findings
391
+ * duplicated existing comments"), so it counts. Shared by both acceptance
392
+ * branches in parseResponseWithMeta so they cannot drift (issue #560).
393
+ * @param {Object} obj - Candidate response object
394
+ * @returns {boolean} True if the object carries any schema key
395
+ */
396
+ function hasSchemaKeys(obj) {
397
+ return Array.isArray(obj.suggestions) ||
398
+ Array.isArray(obj.fileLevelSuggestions) ||
399
+ typeof obj.summary === 'string';
400
+ }
401
+
388
402
  class Analyzer {
389
403
  /**
390
404
  * @param {Object} database - Database instance
@@ -643,9 +657,15 @@ class Analyzer {
643
657
 
644
658
  const orchestrationResult = await this.orchestrateWithAI(allSuggestions, prMetadata, mergedInstructions, worktreePath, { analysisId, tier, progressCallback, timeout: executionTimeout, logPrefix, reviewerNum, excludePrevious, dedupContext, githubClient });
645
659
 
646
- // Report orchestration step as completed
660
+ // orchestrateWithAI degrades to the raw union of level suggestions when
661
+ // consolidation fails internally — report that honestly instead of 'success'
662
+ const consolidationOutcome = orchestrationResult.consolidationFailed ? 'failed' : 'success';
663
+
664
+ // Report orchestration step outcome
647
665
  if (progressCallback) {
648
- progressCallback({ level: 'orchestration', status: 'completed', progress: 'Cross-level consolidation complete' });
666
+ progressCallback(orchestrationResult.consolidationFailed
667
+ ? { level: 'orchestration', status: 'failed', progress: 'Cross-level consolidation failed' }
668
+ : { level: 'orchestration', status: 'completed', progress: 'Cross-level consolidation complete' });
649
669
  }
650
670
 
651
671
  // Validate and finalize suggestions
@@ -670,7 +690,7 @@ class Analyzer {
670
690
  level1: levelResults.level1.status,
671
691
  level2: levelResults.level2.status,
672
692
  level3: levelResults.level3.status,
673
- consolidation: 'success'
693
+ consolidation: consolidationOutcome
674
694
  };
675
695
 
676
696
  // Update analysis_run record with completion data
@@ -694,7 +714,8 @@ class Analyzer {
694
714
  suggestions: finalSuggestions,
695
715
  levelResults,
696
716
  levelOutcomes,
697
- summary: orchestrationResult.summary
717
+ summary: orchestrationResult.summary,
718
+ ...(orchestrationResult.consolidationFailed ? { orchestrationFailed: true } : {})
698
719
  };
699
720
 
700
721
  } catch (orchestrationError) {
@@ -1192,6 +1213,8 @@ Or simply ignore any changes to files matching these patterns in your analysis.
1192
1213
  });
1193
1214
 
1194
1215
  // Parse and validate the response
1216
+ // A parse failure here still reports Level 1 success with zero suggestions;
1217
+ // honest per-level parse-failure reporting is a known follow-up to issue #560.
1195
1218
  updateProgress('Processing AI results');
1196
1219
  const parsedSuggestions = this.parseResponse(response, 1);
1197
1220
  logger.success(`${lp}Parsed ${parsedSuggestions.length} valid Level 1 suggestions`);
@@ -1623,30 +1646,64 @@ If you are unsure, use "NEW" - it is correct for the vast majority of suggestion
1623
1646
  * @param {Array} previousSuggestions - Previous suggestions to check for duplicates
1624
1647
  */
1625
1648
  parseResponse(response, level, previousSuggestions = []) {
1649
+ return this.parseResponseWithMeta(response, level, previousSuggestions).suggestions;
1650
+ }
1651
+
1652
+ /**
1653
+ * Parse a response into suggestions, also reporting whether the response was
1654
+ * recognizable as our response schema. `parseFailed: true` means no parseable
1655
+ * suggestions were found — nothing in the response carried any of our schema
1656
+ * keys (suggestions / fileLevelSuggestions / summary). That is distinct from
1657
+ * a legitimately empty `suggestions: []` or a summary-only zero-finding
1658
+ * response — consolidation callers use the distinction to fall back instead
1659
+ * of silently reporting success with zero suggestions (issue #560).
1660
+ *
1661
+ * @param {Object} response - Provider response
1662
+ * @param {number|string} level - Analysis level (for logging)
1663
+ * @param {Array} previousSuggestions - Previous suggestions to check for duplicates
1664
+ * @returns {{ suggestions: Array, parseFailed: boolean }}
1665
+ */
1666
+ parseResponseWithMeta(response, level, previousSuggestions = []) {
1626
1667
  const levelPrefix = `[Level ${level}]`;
1627
1668
 
1628
1669
  // Separate previous suggestions into line-level and file-level for deduplication
1629
1670
  const previousLineSuggestions = previousSuggestions.filter(s => !s.is_file_level);
1630
1671
  const previousFileLevelSuggestions = previousSuggestions.filter(s => s.is_file_level);
1631
1672
 
1632
- // If response is already parsed JSON
1633
- if (response.suggestions && Array.isArray(response.suggestions)) {
1634
- const lineSuggestions = this.validateSuggestions(response.suggestions, previousLineSuggestions);
1635
- const fileLevelSuggestions = response.fileLevelSuggestions
1636
- ? this.validateFileLevelSuggestions(response.fileLevelSuggestions, previousFileLevelSuggestions)
1637
- : [];
1638
- return [...lineSuggestions, ...fileLevelSuggestions];
1673
+ // Already-parsed branch — the common path: providers resolve parsed schema
1674
+ // objects directly and only fall back to `{ raw, parsed: false }` (which
1675
+ // never carries a string summary) when their own parsing fails. Suggestion
1676
+ // arrays are authoritative regardless of any `raw` payload; a summary alone
1677
+ // is accepted here only when there is no `raw` payload to try first, so a
1678
+ // hypothetical `{ summary, raw }` shape with extractable suggestions in
1679
+ // `raw` does not lose them (final summary-only acceptance is below).
1680
+ // validateSuggestions requires real arrays, so default the missing ones —
1681
+ // a summary-only object has neither.
1682
+ if (Array.isArray(response.suggestions) || Array.isArray(response.fileLevelSuggestions) ||
1683
+ (hasSchemaKeys(response) && !response.raw)) {
1684
+ const lineSuggestions = this.validateSuggestions(response.suggestions || [], previousLineSuggestions);
1685
+ const fileLevelSuggestions = this.validateFileLevelSuggestions(
1686
+ response.fileLevelSuggestions || [], previousFileLevelSuggestions
1687
+ );
1688
+ return { suggestions: [...lineSuggestions, ...fileLevelSuggestions], parseFailed: false };
1639
1689
  }
1640
1690
 
1641
- // If response is raw text, try multiple extraction strategies
1691
+ // If response is raw text, try multiple extraction strategies. Extraction can
1692
+ // latch onto unrelated JSON fragments in prose, so only JSON carrying one of
1693
+ // our schema keys counts as parsed — a summary-only object is a legitimate
1694
+ // zero-finding response (e.g. "all findings duplicated existing comments").
1642
1695
  if (response.raw) {
1643
1696
  const extracted = extractJSON(response.raw, level);
1644
- if (extracted.success && extracted.data.suggestions && Array.isArray(extracted.data.suggestions)) {
1645
- const lineSuggestions = this.validateSuggestions(extracted.data.suggestions, previousLineSuggestions);
1697
+ if (extracted.success && hasSchemaKeys(extracted.data)) {
1698
+ const lineSuggestions = this.validateSuggestions(extracted.data.suggestions || [], previousLineSuggestions);
1646
1699
  const fileLevelSuggestions = extracted.data.fileLevelSuggestions
1647
1700
  ? this.validateFileLevelSuggestions(extracted.data.fileLevelSuggestions, previousFileLevelSuggestions)
1648
1701
  : [];
1649
- return [...lineSuggestions, ...fileLevelSuggestions];
1702
+ return { suggestions: [...lineSuggestions, ...fileLevelSuggestions], parseFailed: false };
1703
+ } else if (extracted.success) {
1704
+ logger.warn(`${levelPrefix} Extracted JSON carried none of the expected schema keys (suggestions/fileLevelSuggestions/summary)`);
1705
+ logger.info(`${levelPrefix} Raw response length: ${response.raw.length} characters`);
1706
+ logger.info(`${levelPrefix} Raw response preview: ${response.raw.substring(0, 500)}...`);
1650
1707
  } else {
1651
1708
  logger.warn(`${levelPrefix} JSON extraction failed: ${extracted.error}`);
1652
1709
  logger.info(`${levelPrefix} Raw response length: ${response.raw.length} characters`);
@@ -1654,9 +1711,17 @@ If you are unsure, use "NEW" - it is correct for the vast majority of suggestion
1654
1711
  }
1655
1712
  }
1656
1713
 
1714
+ // A string `summary` alone is a valid zero-finding result — reached only
1715
+ // for a `{ summary, raw }` response whose raw extraction yielded nothing
1716
+ // better (arrays would have been accepted above).
1717
+ if (hasSchemaKeys(response)) {
1718
+ logger.info(`${levelPrefix} Accepting summary-only response as a zero-finding result`);
1719
+ return { suggestions: [], parseFailed: false };
1720
+ }
1721
+
1657
1722
  // Fallback to empty array
1658
1723
  logger.warn(`${levelPrefix} No valid suggestions found in response`);
1659
- return [];
1724
+ return { suggestions: [], parseFailed: true };
1660
1725
  }
1661
1726
 
1662
1727
  /**
@@ -2161,6 +2226,8 @@ If you are unsure, use "NEW" - it is correct for the vast majority of suggestion
2161
2226
  });
2162
2227
 
2163
2228
  // Parse and validate the response
2229
+ // A parse failure here still reports Level 2 success with zero suggestions;
2230
+ // honest per-level parse-failure reporting is a known follow-up to issue #560.
2164
2231
  updateProgress('Processing AI results');
2165
2232
  let suggestions = this.parseResponse(response, 2);
2166
2233
  logger.success(`${lp}Parsed ${suggestions.length} valid Level 2 suggestions`);
@@ -2275,6 +2342,8 @@ If you are unsure, use "NEW" - it is correct for the vast majority of suggestion
2275
2342
  });
2276
2343
 
2277
2344
  // Parse and validate the response
2345
+ // A parse failure here still reports Level 3 success with zero suggestions;
2346
+ // honest per-level parse-failure reporting is a known follow-up to issue #560.
2278
2347
  updateProgress('Processing codebase context results');
2279
2348
  let suggestions = this.parseResponse(response, 3);
2280
2349
  logger.success(`${lp}Parsed ${suggestions.length} valid Level 3 suggestions`);
@@ -2782,7 +2851,9 @@ File-level suggestions should NOT have a line number. They apply to the entire f
2782
2851
  * @param {Object} [options.excludePrevious] - { github: bool, feedback: bool } for dedup
2783
2852
  * @param {Object} [options.dedupContext] - { owner, repo, pullNumber, reviewId, serverPort }
2784
2853
  * @param {Object} [options.githubClient] - GitHubClient used to pre-fetch existing PR review comments for dedup
2785
- * @returns {Promise<Array>} Curated suggestions array
2854
+ * @returns {Promise<{suggestions: Array, summary: string, consolidationFailed?: boolean}>}
2855
+ * Consolidation result. `consolidationFailed: true` means the suggestions
2856
+ * array is the raw union of all levels rather than a curated set.
2786
2857
  */
2787
2858
  async orchestrateWithAI(allSuggestions, prMetadata, customInstructions = null, worktreePath = null, options = {}) {
2788
2859
  const { analysisId, tier = 'balanced', progressCallback, providerOverride, modelOverride, timeout = 600000, logPrefix: lp = '', reviewerNum, excludePrevious, dedupContext, githubClient } = options;
@@ -2842,7 +2913,7 @@ File-level suggestions should NOT have a line number. They apply to the entire f
2842
2913
  });
2843
2914
 
2844
2915
  // Parse the orchestrated response
2845
- const orchestratedSuggestions = this.parseResponse(response, 'orchestration');
2916
+ const { suggestions: orchestratedSuggestions, parseFailed } = this.parseResponseWithMeta(response, 'orchestration');
2846
2917
 
2847
2918
  // Debug: If consolidation returned 0 suggestions but there was input, log for investigation
2848
2919
  const inputLevel1Count = allSuggestions.level1?.length || 0;
@@ -2866,6 +2937,17 @@ File-level suggestions should NOT have a line number. They apply to the entire f
2866
2937
  }
2867
2938
  }
2868
2939
 
2940
+ // A response with no parseable suggestions (nothing recognizable as our
2941
+ // response schema), when the levels produced suggestions, means every
2942
+ // input suggestion would be silently dropped. Route that through the
2943
+ // fallback below instead of reporting success with zero suggestions
2944
+ // (issue #560). A parseable-but-empty `suggestions: []` is left alone —
2945
+ // the consolidator may legitimately curate everything away (e.g. dedup
2946
+ // against previously posted comments).
2947
+ if (parseFailed && hadInputSuggestions) {
2948
+ throw new Error('Consolidation response could not be parsed; falling back to unconsolidated suggestions');
2949
+ }
2950
+
2869
2951
  // Extract summary from the orchestration response
2870
2952
  let summary = `Analyzed PR with ${orchestratedSuggestions.length} curated suggestions`;
2871
2953
  if (response.summary) {
@@ -2883,8 +2965,11 @@ File-level suggestions should NOT have a line number. They apply to the entire f
2883
2965
  suggestions: orchestratedSuggestions,
2884
2966
  summary: summary
2885
2967
  };
2886
-
2968
+
2887
2969
  } catch (error) {
2970
+ // Cancellation is not a consolidation failure — propagate so the run is
2971
+ // recorded as cancelled instead of consolidation 'failed'
2972
+ if (error.isCancellation) throw error;
2888
2973
  logger.warn(`${lp}[Consolidation] Cross-level consolidation failed: ${error.message}`);
2889
2974
  logger.warn(`${lp}[Consolidation] Falling back to storing all original suggestions`);
2890
2975
 
@@ -2911,7 +2996,8 @@ File-level suggestions should NOT have a line number. They apply to the entire f
2911
2996
 
2912
2997
  return {
2913
2998
  suggestions: fallbackSuggestions,
2914
- summary: `Analysis complete (consolidation failed): ${fallbackSuggestions.length} suggestions from all analysis levels`
2999
+ summary: `Analysis complete (consolidation failed): ${fallbackSuggestions.length} suggestions from all analysis levels`,
3000
+ consolidationFailed: true
2915
3001
  };
2916
3002
  }
2917
3003
  }
@@ -3372,6 +3458,10 @@ File-level suggestions should NOT have a line number. They apply to the entire f
3372
3458
  logger.info('[ReviewerCouncil] Single reviewer result — skipping consolidation');
3373
3459
  const singleResult = successfulVoices[0].result;
3374
3460
 
3461
+ // Preserve the surviving reviewer's own outcomes (e.g. a failed intra-run
3462
+ // consolidation) — only cross-voice consolidation was skipped here
3463
+ const singleLevelOutcomes = singleResult.levelOutcomes || { consolidation: 'skipped' };
3464
+
3375
3465
  const finalSuggestions = this.validateAndFinalizeSuggestions(
3376
3466
  singleResult.suggestions, fileLineCountMap, validFiles
3377
3467
  );
@@ -3383,7 +3473,7 @@ File-level suggestions should NOT have a line number. They apply to the entire f
3383
3473
  summary: singleResult.summary,
3384
3474
  totalSuggestions: finalSuggestions.length,
3385
3475
  filesAnalyzed: validFiles.length,
3386
- levelOutcomes: { consolidation: 'skipped' }
3476
+ levelOutcomes: singleLevelOutcomes
3387
3477
  });
3388
3478
  } catch (err) {
3389
3479
  logger.warn(`[ReviewerCouncil] Failed to update parent run: ${err.message}`);
@@ -3393,7 +3483,7 @@ File-level suggestions should NOT have a line number. They apply to the entire f
3393
3483
  runId: parentRunId,
3394
3484
  suggestions: finalSuggestions,
3395
3485
  summary: singleResult.summary || `Review council complete: ${finalSuggestions.length} suggestions`,
3396
- levelOutcomes: { consolidation: 'skipped' }
3486
+ levelOutcomes: singleLevelOutcomes
3397
3487
  };
3398
3488
  }
3399
3489
 
@@ -3471,6 +3561,17 @@ File-level suggestions should NOT have a line number. They apply to the entire f
3471
3561
 
3472
3562
  logger.success(`[ReviewerCouncil] Analysis complete: ${finalSuggestions.length} consolidated suggestions`);
3473
3563
 
3564
+ // Terminal orchestration event must be voiceId-less: events with a
3565
+ // voiceId only update levels[4].voices, never the aggregate status
3566
+ if (progressCallback) {
3567
+ progressCallback({
3568
+ status: 'completed',
3569
+ progress: 'Cross-reviewer consolidation complete',
3570
+ level: 'orchestration',
3571
+ voiceCentric: true
3572
+ });
3573
+ }
3574
+
3474
3575
  return {
3475
3576
  runId: parentRunId,
3476
3577
  suggestions: finalSuggestions,
@@ -3478,8 +3579,23 @@ File-level suggestions should NOT have a line number. They apply to the entire f
3478
3579
  levelOutcomes: { consolidation: 'success' }
3479
3580
  };
3480
3581
  } catch (error) {
3582
+ // Cancellation is not a consolidation failure — propagate so the run is
3583
+ // recorded as cancelled instead of consolidation 'failed'
3584
+ if (error.isCancellation) throw error;
3481
3585
  logger.error(`[ReviewerCouncil] Cross-reviewer consolidation failed: ${error.message}`);
3482
3586
 
3587
+ // Surface the failure live — without a terminal voiceId-less event,
3588
+ // levels[4] stays 'running' and the completion handler would show
3589
+ // consolidation as completed while the run records it as failed
3590
+ if (progressCallback) {
3591
+ progressCallback({
3592
+ status: 'failed',
3593
+ progress: 'Consolidation failed — showing unconsolidated results',
3594
+ level: 'orchestration',
3595
+ voiceCentric: true
3596
+ });
3597
+ }
3598
+
3483
3599
  // Fallback: use all voice suggestions combined
3484
3600
  const fallbackSuggestions = this.validateAndFinalizeSuggestions(
3485
3601
  [...allVoiceSuggestions, ...allVoiceFileLevelSuggestions], fileLineCountMap, validFiles
@@ -3728,6 +3844,10 @@ File-level suggestions should NOT have a line number. They apply to the entire f
3728
3844
  }
3729
3845
 
3730
3846
  // Pass 1: Intra-level consolidation (for levels with >1 reviewer)
3847
+ // Track Pass 1 fallbacks so the final outcome reports them as a failed
3848
+ // consolidation even when Pass 2 succeeds (the final set then contains
3849
+ // raw, unconsolidated suggestions for the affected level)
3850
+ let intraLevelConsolidationFailed = false;
3731
3851
  const consolidatedPerLevel = {};
3732
3852
  for (const [levelStr, suggestions] of Object.entries(levelSuggestions)) {
3733
3853
  const level = parseInt(levelStr);
@@ -3764,7 +3884,11 @@ File-level suggestions should NOT have a line number. They apply to the entire f
3764
3884
  progressCallback({ level: `consolidation-L${level}`, status: 'completed', progress: `Level ${level} consolidation complete` });
3765
3885
  }
3766
3886
  } catch (error) {
3887
+ // Cancellation is not a consolidation failure — propagate so the run
3888
+ // is recorded as cancelled instead of consolidation 'failed'
3889
+ if (error.isCancellation) throw error;
3767
3890
  logger.warn(`[Council] Intra-level consolidation failed for Level ${level}: ${error.message}`);
3891
+ intraLevelConsolidationFailed = true;
3768
3892
  consolidatedPerLevel[level] = suggestions; // Fallback to raw
3769
3893
  // Report intra-level consolidation step as failed
3770
3894
  if (progressCallback) {
@@ -3791,9 +3915,18 @@ File-level suggestions should NOT have a line number. They apply to the entire f
3791
3915
  { analysisId, tier: orchTier, progressCallback, providerOverride: orchProvider, modelOverride: orchModel, timeout: orchConfig.timeout || 600000, excludePrevious, dedupContext, githubClient }
3792
3916
  );
3793
3917
 
3794
- // Report cross-level orchestration step as completed
3918
+ // orchestrateWithAI degrades to the raw union of level suggestions when
3919
+ // consolidation fails internally, and a Pass 1 fallback means raw
3920
+ // suggestions leaked into the final set — report either honestly
3921
+ // instead of 'success'
3922
+ const consolidationOutcome = (intraLevelConsolidationFailed || orchestrationResult.consolidationFailed)
3923
+ ? 'failed' : 'success';
3924
+
3925
+ // Report cross-level orchestration step outcome
3795
3926
  if (progressCallback) {
3796
- progressCallback({ level: 'orchestration', status: 'completed', progress: 'Cross-level consolidation complete' });
3927
+ progressCallback(orchestrationResult.consolidationFailed
3928
+ ? { level: 'orchestration', status: 'failed', progress: 'Cross-level consolidation failed' }
3929
+ : { level: 'orchestration', status: 'completed', progress: 'Cross-level consolidation complete' });
3797
3930
  }
3798
3931
 
3799
3932
  const finalSuggestions = this.validateAndFinalizeSuggestions(
@@ -3809,9 +3942,13 @@ File-level suggestions should NOT have a line number. They apply to the entire f
3809
3942
  runId,
3810
3943
  suggestions: finalSuggestions,
3811
3944
  summary: orchestrationResult.summary,
3812
- levelOutcomes: { consolidation: 'success' }
3945
+ ...(consolidationOutcome === 'failed' ? { orchestrationFailed: true } : {}),
3946
+ levelOutcomes: { consolidation: consolidationOutcome }
3813
3947
  };
3814
3948
  } catch (error) {
3949
+ // Cancellation is not a consolidation failure — propagate so the run is
3950
+ // recorded as cancelled instead of consolidation 'failed'
3951
+ if (error.isCancellation) throw error;
3815
3952
  logger.error(`[Council] Cross-level consolidation failed: ${error.message}`);
3816
3953
 
3817
3954
  // Report cross-level orchestration step as failed
@@ -3883,6 +4020,8 @@ File-level suggestions should NOT have a line number. They apply to the entire f
3883
4020
  });
3884
4021
 
3885
4022
  // Parse response
4023
+ // A parse failure here still reports the voice as completed with zero
4024
+ // suggestions; honest per-voice reporting is a known follow-up to issue #560.
3886
4025
  const suggestions = this.parseResponse(response, level);
3887
4026
  logger.success(`[Council] ${displayLabel}: parsed ${suggestions.length} suggestions`);
3888
4027
 
@@ -3974,7 +4113,19 @@ File-level suggestions should NOT have a line number. They apply to the entire f
3974
4113
  } : undefined
3975
4114
  });
3976
4115
 
3977
- return this.parseResponse(response, level);
4116
+ // Use the disambiguated identifier so parse logs don't read as the
4117
+ // Level N reviewer itself (matches the provider call's level above)
4118
+ const { suggestions: consolidated, parseFailed } = this.parseResponseWithMeta(response, `consolidation-L${level}`);
4119
+
4120
+ // A consolidation response with no parseable suggestions (nothing
4121
+ // recognizable as our response schema) would silently drop every reviewer
4122
+ // suggestion for this level (issue #560). Throw so the caller falls back
4123
+ // to the raw per-reviewer suggestions instead.
4124
+ if (parseFailed && suggestionCount > 0) {
4125
+ throw new Error(`Level ${level} consolidation response could not be parsed (${suggestionCount} reviewer suggestions at risk); falling back to raw suggestions`);
4126
+ }
4127
+
4128
+ return consolidated;
3978
4129
  }
3979
4130
 
3980
4131
  /**
@@ -4161,7 +4312,20 @@ File-level suggestions should NOT have a line number. They apply to the entire f
4161
4312
  } : undefined
4162
4313
  });
4163
4314
 
4164
- const suggestions = this.parseResponse(response, 'consolidation');
4315
+ const { suggestions, parseFailed } = this.parseResponseWithMeta(response, 'consolidation');
4316
+
4317
+ // If the consolidation response carried no parseable suggestions (nothing
4318
+ // recognizable as our response schema) while the voices produced
4319
+ // suggestions, every voice suggestion would be silently dropped and the
4320
+ // run would still report success (issue #560). Throw so
4321
+ // the caller's fallback path stores the raw voice suggestions and records
4322
+ // the consolidation outcome as 'failed'. A parseable-but-empty
4323
+ // `suggestions: []` is a legitimate outcome (e.g. dedup curated everything
4324
+ // away) and is not treated as a failure.
4325
+ const inputSuggestionCount = voiceReviews.reduce((sum, v) => sum + (v.suggestionCount || 0), 0);
4326
+ if (parseFailed && inputSuggestionCount > 0) {
4327
+ throw new Error(`Cross-voice consolidation response could not be parsed (${inputSuggestionCount} voice suggestions at risk); falling back to unconsolidated suggestions`);
4328
+ }
4165
4329
 
4166
4330
  // Extract summary from response, falling back to raw JSON extraction (same pattern as orchestrateWithAI)
4167
4331
  let summary;
package/src/ai/index.js CHANGED
@@ -55,6 +55,7 @@ require('./copilot-provider');
55
55
  require('./opencode-provider');
56
56
  require('./cursor-agent-provider');
57
57
  require('./pi-provider');
58
+ require('./omp-provider');
58
59
  require('./muse-provider');
59
60
 
60
61
  // Export the unified API
@@ -0,0 +1,13 @@
1
+ # Copyright 2026 Tim Perkins (tjwp) | SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # OMP config overlay loaded via `omp --config` for every pair-review analysis
4
+ # run. Review runs must not depend on the user's global ~/.omp/agent/config.yml
5
+ # for these settings.
6
+ #
7
+ # advisor.enabled: the advisor runtime passively reviews each turn and injects
8
+ # notes into the conversation. That adds cost and nondeterminism to analysis
9
+ # runs, so it is disabled by default. Set `"advisor": true` in
10
+ # config.json providers.omp to opt back in (pair-review then passes --advisor
11
+ # instead of this overlay).
12
+ advisor:
13
+ enabled: false