@in-the-loop-labs/pair-review 5.0.2 → 5.1.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.
- package/README.md +44 -3
- package/package.json +5 -3
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin-code-critic/.claude-plugin/plugin.json +1 -1
- package/plugin-pair-loop/.claude-plugin/plugin.json +1 -1
- package/public/js/utils/markdown.js +202 -65
- package/public/js/vendor/pierre-diffs-worker.js +3446 -5992
- package/public/js/vendor/pierre-diffs.js +731 -1047
- package/public/local.html +2 -0
- package/public/pr.html +2 -0
- package/src/ai/abort-signal-wiring.js +91 -46
- package/src/ai/analyzer.js +64 -11
- package/src/ai/antigravity-provider.js +31 -5
- package/src/ai/claude-cli.js +8 -2
- package/src/ai/claude-provider.js +34 -5
- package/src/ai/codex-provider.js +31 -5
- package/src/ai/copilot-provider.js +28 -4
- package/src/ai/cursor-agent-provider.js +32 -5
- package/src/ai/executable-provider.js +8 -2
- package/src/ai/index.js +1 -0
- package/src/ai/muse-provider.js +1224 -0
- package/src/ai/opencode-provider.js +31 -5
- package/src/ai/pi-provider.js +29 -4
- package/src/ai/provider.js +111 -28
- package/src/ai/stream-parser.js +71 -0
- package/src/config.js +35 -2
- package/src/database.js +96 -16
- package/src/git/fetch-helpers.js +48 -0
- package/src/git/pack-cleanup.js +120 -0
- package/src/git/worktree.js +65 -43
- package/src/main.js +243 -47
- package/src/routes/pr.js +2 -3
|
@@ -21,7 +21,7 @@ const logger = require('../utils/logger');
|
|
|
21
21
|
const { extractJSON } = require('../utils/json-extractor');
|
|
22
22
|
const { CancellationError, isAnalysisCancelled } = require('../routes/shared');
|
|
23
23
|
const { StreamParser, parseCursorAgentLine } = require('./stream-parser');
|
|
24
|
-
const { wireAbortToChild, makeAbortError } = require('./abort-signal-wiring');
|
|
24
|
+
const { wireAbortToChild, makeAbortError, killChildSafely } = require('./abort-signal-wiring');
|
|
25
25
|
|
|
26
26
|
// Directory containing bin scripts (git-diff-lines, etc.)
|
|
27
27
|
const BIN_DIR = path.join(__dirname, '..', '..', 'bin');
|
|
@@ -316,7 +316,7 @@ class CursorAgentProvider extends AIProvider {
|
|
|
316
316
|
if (timeout) {
|
|
317
317
|
timeoutId = setTimeout(() => {
|
|
318
318
|
logger.error(`${levelPrefix} Process ${pid} timed out after ${timeout}ms`);
|
|
319
|
-
agent.
|
|
319
|
+
killChildSafely(agent, { logPrefix: levelPrefix, shell: this.useShell });
|
|
320
320
|
settle(reject, new Error(`${levelPrefix} Cursor Agent CLI timed out after ${timeout}ms`));
|
|
321
321
|
}, timeout);
|
|
322
322
|
}
|
|
@@ -420,6 +420,15 @@ class CursorAgentProvider extends AIProvider {
|
|
|
420
420
|
logger.info(`${levelPrefix} LLM fallback input length: ${llmFallbackInput.length} characters (${parsed.textContent ? 'text content' : 'raw stdout'})`);
|
|
421
421
|
logger.info(`${levelPrefix} Attempting LLM-based JSON extraction fallback...`);
|
|
422
422
|
|
|
423
|
+
// The agent child has already exited, so a cancel arriving now only
|
|
424
|
+
// makes the abort wiring kill something already dead. The `settled`
|
|
425
|
+
// guard below only covers a cancel that landed BEFORE the await, so
|
|
426
|
+
// without the checks below one landing during extraction would settle
|
|
427
|
+
// as a normal result. The signal is read alongside the wiring flag as
|
|
428
|
+
// the source of truth.
|
|
429
|
+
const cancelledDuringExtraction = () =>
|
|
430
|
+
abortWiring.cancelled() || abortSignal?.aborted === true;
|
|
431
|
+
|
|
423
432
|
// Use async IIFE to handle the async LLM extraction
|
|
424
433
|
(async () => {
|
|
425
434
|
try {
|
|
@@ -427,7 +436,14 @@ class CursorAgentProvider extends AIProvider {
|
|
|
427
436
|
// orphan processes if timeout fired between close-handler entry
|
|
428
437
|
// and reaching this point.
|
|
429
438
|
if (settled) return;
|
|
430
|
-
|
|
439
|
+
// `abortSignal` lets the extraction spawn be killed rather than
|
|
440
|
+
// merely abandoned until its own 60s timeout.
|
|
441
|
+
const llmExtracted = await this.extractJSONWithLLM(llmFallbackInput, { level, analysisId, registerProcess, logPrefix: levelPrefix, abortSignal });
|
|
442
|
+
if (cancelledDuringExtraction()) {
|
|
443
|
+
logger.info(`${levelPrefix} Cancelled by user during LLM extraction fallback`);
|
|
444
|
+
settle(reject, makeAbortError(`${levelPrefix} Cancelled by user`));
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
431
447
|
if (llmExtracted.success) {
|
|
432
448
|
logger.success(`${levelPrefix} LLM extraction fallback succeeded`);
|
|
433
449
|
settle(resolve, llmExtracted.data);
|
|
@@ -437,6 +453,13 @@ class CursorAgentProvider extends AIProvider {
|
|
|
437
453
|
settle(resolve, { raw: llmFallbackInput, parsed: false });
|
|
438
454
|
}
|
|
439
455
|
} catch (llmError) {
|
|
456
|
+
// An abort that kills the extraction spawn surfaces here as a
|
|
457
|
+
// thrown error; it is a cancellation, not a parse failure.
|
|
458
|
+
if (cancelledDuringExtraction()) {
|
|
459
|
+
logger.info(`${levelPrefix} Cancelled by user during LLM extraction fallback`);
|
|
460
|
+
settle(reject, makeAbortError(`${levelPrefix} Cancelled by user`));
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
440
463
|
logger.warn(`${levelPrefix} LLM extraction fallback error: ${llmError.message}`);
|
|
441
464
|
settle(resolve, { raw: llmFallbackInput, parsed: false });
|
|
442
465
|
}
|
|
@@ -465,7 +488,9 @@ class CursorAgentProvider extends AIProvider {
|
|
|
465
488
|
agent.stdin.write(prompt, (err) => {
|
|
466
489
|
if (err) {
|
|
467
490
|
logger.error(`${levelPrefix} Failed to write prompt to stdin: ${err}`);
|
|
468
|
-
|
|
491
|
+
// A failed spawn (ENOENT) EPIPEs stdin and lands here with a pidless
|
|
492
|
+
// child; killChildSafely skips the self-directed kill(0).
|
|
493
|
+
killChildSafely(agent, { logPrefix: levelPrefix, shell: this.useShell });
|
|
469
494
|
settle(reject, new Error(`${levelPrefix} Failed to write prompt to stdin: ${err}`));
|
|
470
495
|
}
|
|
471
496
|
});
|
|
@@ -815,7 +840,9 @@ class CursorAgentProvider extends AIProvider {
|
|
|
815
840
|
if (settled) return;
|
|
816
841
|
settled = true;
|
|
817
842
|
logger.warn(`Cursor Agent CLI availability check timed out after ${Math.round(timeoutMs / 1000)}s`);
|
|
818
|
-
|
|
843
|
+
// Not `shell: useShell`: the probe spawn is not `detached`, so
|
|
844
|
+
// group-kill would ESRCH and leave the child running.
|
|
845
|
+
killChildSafely(agent, { logPrefix: '[availability]' });
|
|
819
846
|
resolve(false);
|
|
820
847
|
}, timeoutMs);
|
|
821
848
|
|
|
@@ -18,6 +18,7 @@ const { glob } = require('glob');
|
|
|
18
18
|
const fs = require('fs').promises;
|
|
19
19
|
const path = require('path');
|
|
20
20
|
const logger = require('../utils/logger');
|
|
21
|
+
const { killChildSafely } = require('./abort-signal-wiring');
|
|
21
22
|
const jsonExtractor = require('../utils/json-extractor');
|
|
22
23
|
const configModule = require('../config');
|
|
23
24
|
|
|
@@ -266,7 +267,10 @@ function createExecutableProviderClass(id, config) {
|
|
|
266
267
|
if (stderr.trim()) {
|
|
267
268
|
logger.warn(`[${id}] stderr before timeout: ${stderr.trim().slice(0, 2000)}`);
|
|
268
269
|
}
|
|
269
|
-
|
|
270
|
+
// Not `shell: this.useShell`: this spawn is not `detached`, so
|
|
271
|
+
// group-kill would ESRCH and leave the child running — and it
|
|
272
|
+
// would bypass the kill wrapper above that records `cancelled`.
|
|
273
|
+
killChildSafely(child, { logPrefix: `[${id}]` });
|
|
270
274
|
}, timeout);
|
|
271
275
|
}
|
|
272
276
|
|
|
@@ -480,7 +484,9 @@ function createExecutableProviderClass(id, config) {
|
|
|
480
484
|
if (settled) return;
|
|
481
485
|
settled = true;
|
|
482
486
|
logger.warn(`${id} availability check timed out after ${Math.round(timeoutMs / 1000)}s`);
|
|
483
|
-
|
|
487
|
+
// Not `shell: true` (as spawned): the probe is not `detached`, so
|
|
488
|
+
// group-kill would ESRCH and leave the child running.
|
|
489
|
+
killChildSafely(child, { logPrefix: `[${id}]` });
|
|
484
490
|
resolve(false);
|
|
485
491
|
}, timeoutMs);
|
|
486
492
|
|