@contextrail/code-review-agent 0.1.2-alpha.5 → 0.1.2-alpha.7

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.
@@ -51,7 +51,7 @@ export declare const getDefaultCriticModel: (reviewerModel: string | undefined)
51
51
  */
52
52
  export declare const DEFAULT_SURROUNDING_CONTEXT_CONFIG: {
53
53
  readonly enabled: true;
54
- readonly maxTokensPerFile: 20000;
54
+ readonly maxTokensPerFile: 10000;
55
55
  readonly contextLines: 10;
56
56
  };
57
57
  /**
@@ -65,7 +65,7 @@ export const getDefaultCriticModel = (reviewerModel) => {
65
65
  */
66
66
  export const DEFAULT_SURROUNDING_CONTEXT_CONFIG = {
67
67
  enabled: true,
68
- maxTokensPerFile: 20_000,
68
+ maxTokensPerFile: 10_000,
69
69
  contextLines: 10,
70
70
  };
71
71
  /**
@@ -218,6 +218,7 @@ export const runReviewerLoop = async (reviewer, inputs, understanding, outputDir
218
218
  const chunkToolCalls = [];
219
219
  const chunkContextIds = [];
220
220
  const chunkUsages = [];
221
+ let iterationChunkError = null;
221
222
  for (let chunkIdx = 0; chunkIdx < chunks.length; chunkIdx++) {
222
223
  const chunk = chunks[chunkIdx];
223
224
  if (!chunk) {
@@ -246,10 +247,26 @@ export const runReviewerLoop = async (reviewer, inputs, understanding, outputDir
246
247
  ? error.message
247
248
  : `[REVIEWER] Failed to run reviewer iteration for chunk ${chunkIdx + 1}`;
248
249
  const details = buildFailureDetails(error, `Chunk ${chunkIdx + 1} of ${chunks.length} failed`);
249
- await recordFailureAndBlock(errorMsg, details);
250
- throw error;
250
+ iterationChunkError = { msg: errorMsg, details, err: error };
251
+ break;
251
252
  }
252
253
  }
254
+ if (iterationChunkError !== null) {
255
+ if (iteration < maxIterations) {
256
+ await appendFailure(reviewersDir, reviewer, {
257
+ gate: 'validation',
258
+ message: iterationChunkError.msg,
259
+ details: iterationChunkError.details,
260
+ });
261
+ logger?.debug(`[${reviewer}] Chunk error at iteration ${iteration}; retrying (${iteration + 1}/${maxIterations})`);
262
+ await logContinuation(reviewersDir, reviewer, iteration + 1);
263
+ continue;
264
+ }
265
+ await recordFailureAndBlock(iterationChunkError.msg, iterationChunkError.details);
266
+ throw iterationChunkError.err instanceof Error
267
+ ? iterationChunkError.err
268
+ : new Error(iterationChunkError.msg);
269
+ }
253
270
  // Merge findings from all chunks
254
271
  const mergedFindings = mergeChunkFindings(chunkFindings);
255
272
  findings = mergedFindings;
@@ -287,6 +304,12 @@ export const runReviewerLoop = async (reviewer, inputs, understanding, outputDir
287
304
  catch (error) {
288
305
  const errorMsg = error instanceof Error ? error.message : '[REVIEWER] Failed to run reviewer iteration';
289
306
  const details = buildFailureDetails(error, 'generateText returned no object output');
307
+ if (iteration < maxIterations) {
308
+ await appendFailure(reviewersDir, reviewer, { gate: 'validation', message: errorMsg, details });
309
+ logger?.debug(`[${reviewer}] Iteration ${iteration} threw an error; retrying (${iteration + 1}/${maxIterations})`);
310
+ await logContinuation(reviewersDir, reviewer, iteration + 1);
311
+ continue;
312
+ }
290
313
  await recordFailureAndBlock(errorMsg, details);
291
314
  throw error;
292
315
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contextrail/code-review-agent",
3
- "version": "0.1.2-alpha.5",
3
+ "version": "0.1.2-alpha.7",
4
4
  "description": "CLI tool for orchestrating ContextRail-powered code reviews",
5
5
  "homepage": "https://contextrail.app",
6
6
  "repository": {