codex-review-mcp 2.0.0 → 2.0.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.
@@ -6,6 +6,10 @@ import { z } from 'zod';
6
6
  export async function invokeAgent({ prompt, maxTokens, workspaceDir }) {
7
7
  const model = process.env.CODEX_MODEL || 'gpt-5-codex';
8
8
  const cwd = workspaceDir || process.cwd();
9
+ // Allow configuring max turns via env var (default: 100)
10
+ // Each tool call (read_file) counts as 1 turn
11
+ // 100 allows agent to read many files if needed for thorough review
12
+ const maxTurns = parseInt(process.env.CODEX_MAX_TURNS || '100', 10);
9
13
  // Tool: Read file from the codebase
10
14
  const readFileTool = tool({
11
15
  name: 'read_file',
@@ -44,13 +48,21 @@ export async function invokeAgent({ prompt, maxTokens, workspaceDir }) {
44
48
  tools: [readFileTool],
45
49
  });
46
50
  try {
47
- const result = await run(agent, prompt);
51
+ const result = await run(agent, prompt, {
52
+ maxTurns, // Configurable via CODEX_MAX_TURNS env var (default: 100)
53
+ });
48
54
  const out = result.finalOutput ?? '';
49
- await debugLog(`Agent model=${model} outputLen=${out.length}`);
55
+ await debugLog(`Agent model=${model} maxTurns=${maxTurns} outputLen=${out.length}`);
50
56
  return out;
51
57
  }
52
58
  catch (error) {
53
59
  await debugLog(`Agent error: ${error?.message || String(error)}`);
60
+ // If max turns exceeded, provide helpful error message
61
+ if (error?.message?.includes('Max turns')) {
62
+ throw new Error(`OpenAI API error: ${error.message}. ` +
63
+ `The agent made too many tool calls (read_file). ` +
64
+ `Current limit: ${maxTurns}. Increase with CODEX_MAX_TURNS env var.`);
65
+ }
54
66
  throw new Error(`OpenAI API error: ${error?.message || 'Unknown error occurred'}`);
55
67
  }
56
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-review-mcp",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",