evalbuff 0.0.1

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 (86) hide show
  1. package/README.md +79 -0
  2. package/dist/carve-features.d.ts +42 -0
  3. package/dist/carve-features.d.ts.map +1 -0
  4. package/dist/carve-features.js +305 -0
  5. package/dist/carve-features.js.map +1 -0
  6. package/dist/cli.d.ts +3 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +42 -0
  9. package/dist/cli.js.map +1 -0
  10. package/dist/docs-refactor.d.ts +4 -0
  11. package/dist/docs-refactor.d.ts.map +1 -0
  12. package/dist/docs-refactor.js +122 -0
  13. package/dist/docs-refactor.js.map +1 -0
  14. package/dist/docs-writer.d.ts +4 -0
  15. package/dist/docs-writer.d.ts.map +1 -0
  16. package/dist/docs-writer.js +122 -0
  17. package/dist/docs-writer.js.map +1 -0
  18. package/dist/eval-helpers.d.ts +19 -0
  19. package/dist/eval-helpers.d.ts.map +1 -0
  20. package/dist/eval-helpers.js +327 -0
  21. package/dist/eval-helpers.js.map +1 -0
  22. package/dist/eval-runner.d.ts +42 -0
  23. package/dist/eval-runner.d.ts.map +1 -0
  24. package/dist/eval-runner.js +193 -0
  25. package/dist/eval-runner.js.map +1 -0
  26. package/dist/judge.d.ts +22 -0
  27. package/dist/judge.d.ts.map +1 -0
  28. package/dist/judge.js +284 -0
  29. package/dist/judge.js.map +1 -0
  30. package/dist/perfect-feature.d.ts +2 -0
  31. package/dist/perfect-feature.d.ts.map +1 -0
  32. package/dist/perfect-feature.js +666 -0
  33. package/dist/perfect-feature.js.map +1 -0
  34. package/dist/report.d.ts +31 -0
  35. package/dist/report.d.ts.map +1 -0
  36. package/dist/report.js +249 -0
  37. package/dist/report.js.map +1 -0
  38. package/dist/run-evalbuff.d.ts +12 -0
  39. package/dist/run-evalbuff.d.ts.map +1 -0
  40. package/dist/run-evalbuff.js +383 -0
  41. package/dist/run-evalbuff.js.map +1 -0
  42. package/dist/runners/claude.d.ts +10 -0
  43. package/dist/runners/claude.d.ts.map +1 -0
  44. package/dist/runners/claude.js +80 -0
  45. package/dist/runners/claude.js.map +1 -0
  46. package/dist/runners/codebuff.d.ts +24 -0
  47. package/dist/runners/codebuff.d.ts.map +1 -0
  48. package/dist/runners/codebuff.js +88 -0
  49. package/dist/runners/codebuff.js.map +1 -0
  50. package/dist/runners/codex.d.ts +8 -0
  51. package/dist/runners/codex.d.ts.map +1 -0
  52. package/dist/runners/codex.js +131 -0
  53. package/dist/runners/codex.js.map +1 -0
  54. package/dist/runners/index.d.ts +5 -0
  55. package/dist/runners/index.d.ts.map +1 -0
  56. package/dist/runners/index.js +4 -0
  57. package/dist/runners/index.js.map +1 -0
  58. package/dist/runners/runner.d.ts +11 -0
  59. package/dist/runners/runner.d.ts.map +1 -0
  60. package/dist/runners/runner.js +2 -0
  61. package/dist/runners/runner.js.map +1 -0
  62. package/dist/test-repo-utils.d.ts +21 -0
  63. package/dist/test-repo-utils.d.ts.map +1 -0
  64. package/dist/test-repo-utils.js +109 -0
  65. package/dist/test-repo-utils.js.map +1 -0
  66. package/dist/trace-compressor.d.ts +130 -0
  67. package/dist/trace-compressor.d.ts.map +1 -0
  68. package/dist/trace-compressor.js +680 -0
  69. package/dist/trace-compressor.js.map +1 -0
  70. package/dist/tui/data.d.ts +84 -0
  71. package/dist/tui/data.d.ts.map +1 -0
  72. package/dist/tui/data.js +80 -0
  73. package/dist/tui/data.js.map +1 -0
  74. package/dist/tui/events.d.ts +86 -0
  75. package/dist/tui/events.d.ts.map +1 -0
  76. package/dist/tui/events.js +52 -0
  77. package/dist/tui/events.js.map +1 -0
  78. package/dist/vendor/error.d.ts +18 -0
  79. package/dist/vendor/error.d.ts.map +1 -0
  80. package/dist/vendor/error.js +64 -0
  81. package/dist/vendor/error.js.map +1 -0
  82. package/dist/vendor/print-mode.d.ts +75 -0
  83. package/dist/vendor/print-mode.d.ts.map +1 -0
  84. package/dist/vendor/print-mode.js +2 -0
  85. package/dist/vendor/print-mode.js.map +1 -0
  86. package/package.json +46 -0
@@ -0,0 +1,193 @@
1
+ import { execSync } from 'child_process';
2
+ import fs from 'fs';
3
+ import os from 'os';
4
+ import path from 'path';
5
+ import { ClaudeRunner } from './runners/claude';
6
+ import { judgeTaskResult } from './judge';
7
+ import { applyCarveOperations, copyDocsIntoRepo, ensureGitIdentity, extractDocsRead } from './eval-helpers';
8
+ import { execFileSync } from 'child_process';
9
+ export async function runAgentOnCarve(opts) {
10
+ const { idx, total, repoPath, feature, initCommand, model, groundTruthDiff, docsSourcePath } = opts;
11
+ const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'evalbuff-eval-'));
12
+ const repoDir = path.join(tempDir, 'repo');
13
+ try {
14
+ try {
15
+ // Clone the repo
16
+ execSync(`git clone --no-checkout "${repoPath}" "${repoDir}"`, { stdio: 'ignore' });
17
+ const headSha = execSync('git rev-parse HEAD', { cwd: repoPath, encoding: 'utf-8' }).trim();
18
+ execSync(`git checkout ${headSha}`, { cwd: repoDir, stdio: 'ignore' });
19
+ ensureGitIdentity(repoDir);
20
+ // Apply carve (remove the feature)
21
+ applyCarveOperations(repoDir, feature.operations);
22
+ // Commit carved state
23
+ execSync('git add -A', { cwd: repoDir, stdio: 'ignore' });
24
+ execSync(`git commit -m "carve: remove ${feature.id}" --allow-empty`, { cwd: repoDir, stdio: 'ignore' });
25
+ // Copy docs into the carved repo
26
+ copyDocsIntoRepo(docsSourcePath, repoDir);
27
+ // Run init command
28
+ if (initCommand) {
29
+ try {
30
+ execSync(initCommand, { cwd: repoDir, stdio: 'ignore', timeout: 120000 });
31
+ }
32
+ catch (e) {
33
+ console.warn(` [Run ${idx + 1}/${total}] Init command failed: ${e}`);
34
+ }
35
+ }
36
+ // Run coding agent
37
+ console.log(` [Run ${idx + 1}/${total}] Running claude (${model}) for ${feature.id}...`);
38
+ const runner = new ClaudeRunner(repoDir, {}, model, 'medium');
39
+ let result;
40
+ try {
41
+ result = await runner.run(feature.prompt);
42
+ }
43
+ catch (runError) {
44
+ return createInfrastructureFailureResult(feature, runError);
45
+ }
46
+ // Raw JSONL trace — compression happens later when the trace is saved
47
+ // to disk by saveRoundResults() in report.ts via compressAndSave().
48
+ const agentTrace = result.steps.map((step) => JSON.stringify(step)).join('\n');
49
+ // Judge with Codex reviewer (hard 35-minute timeout to prevent hangs)
50
+ const JUDGE_TIMEOUT_MS = 35 * 60 * 1000;
51
+ console.log(` [Run ${idx + 1}/${total}] Judging ${feature.id} with Codex reviewer...`);
52
+ let judging;
53
+ try {
54
+ judging = await Promise.race([
55
+ judgeTaskResult({
56
+ taskPrompt: feature.prompt,
57
+ agentDiff: result.diff,
58
+ groundTruthDiff,
59
+ repoDir: repoDir,
60
+ }),
61
+ new Promise((_, reject) => setTimeout(() => reject(new Error(`Judge timed out after ${JUDGE_TIMEOUT_MS / 1000}s`)), JUDGE_TIMEOUT_MS)),
62
+ ]);
63
+ }
64
+ catch (judgeError) {
65
+ const errMsg = judgeError instanceof Error ? judgeError.message : String(judgeError);
66
+ console.warn(` [Run ${idx + 1}/${total}] Judge failed: ${errMsg.slice(0, 200)}`);
67
+ judging = {
68
+ analysis: `Judge failed: ${errMsg.slice(0, 500)}`,
69
+ strengths: [],
70
+ weaknesses: ['Judge failed'],
71
+ e2eTestsPerformed: [],
72
+ completionScore: 0,
73
+ codeQualityScore: 0,
74
+ e2eScore: 0,
75
+ overallScore: 0,
76
+ };
77
+ }
78
+ return {
79
+ featureId: feature.id,
80
+ prompt: feature.prompt,
81
+ score: judging.overallScore,
82
+ diff: result.diff,
83
+ trace: agentTrace,
84
+ judging,
85
+ costEstimate: result.totalCostUsd,
86
+ docsRead: extractDocsRead(result.steps),
87
+ };
88
+ }
89
+ catch (error) {
90
+ return createInfrastructureFailureResult(feature, error);
91
+ }
92
+ }
93
+ finally {
94
+ try {
95
+ fs.rmSync(tempDir, { recursive: true, force: true });
96
+ }
97
+ catch { /* ignore */ }
98
+ }
99
+ }
100
+ /**
101
+ * Re-judge a baseline task using the current docs in docsSourcePath.
102
+ *
103
+ * Recreates the exact repo state the original judge saw (carved repo + agent's
104
+ * baseline diff applied), but with whatever docs currently live in
105
+ * docsSourcePath instead of the baseline-era docs. This isolates whether the
106
+ * judge itself scores differently once given better docs, independent of any
107
+ * agent behavior change.
108
+ */
109
+ export async function rejudgeBaselineWithCurrentDocs(opts) {
110
+ const { idx, total, repoPath, feature, baselineDiff, groundTruthDiff, initCommand, docsSourcePath } = opts;
111
+ const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'evalbuff-rejudge-'));
112
+ const repoDir = path.join(tempDir, 'repo');
113
+ try {
114
+ // Clone and check out the same base SHA
115
+ execSync(`git clone --no-checkout "${repoPath}" "${repoDir}"`, { stdio: 'ignore' });
116
+ const headSha = execSync('git rev-parse HEAD', { cwd: repoPath, encoding: 'utf-8' }).trim();
117
+ execSync(`git checkout ${headSha}`, { cwd: repoDir, stdio: 'ignore' });
118
+ ensureGitIdentity(repoDir);
119
+ // Apply carve, matching the original eval setup
120
+ applyCarveOperations(repoDir, feature.operations);
121
+ execSync('git add -A', { cwd: repoDir, stdio: 'ignore' });
122
+ execSync(`git commit -m "carve: remove ${feature.id}" --allow-empty`, { cwd: repoDir, stdio: 'ignore' });
123
+ // Copy CURRENT docs (which have been refactored by loop N) into the repo
124
+ copyDocsIntoRepo(docsSourcePath, repoDir);
125
+ // Apply the baseline agent's diff to reproduce the state the judge saw
126
+ if (baselineDiff.trim()) {
127
+ const patchPath = path.join(tempDir, 'baseline.patch');
128
+ fs.writeFileSync(patchPath, baselineDiff.endsWith('\n') ? baselineDiff : baselineDiff + '\n');
129
+ try {
130
+ execFileSync('git', ['apply', '--whitespace=nowarn', '--allow-empty', patchPath], {
131
+ cwd: repoDir,
132
+ stdio: 'ignore',
133
+ });
134
+ }
135
+ catch (applyErr) {
136
+ // Fall back to 3-way apply; if that fails, propagate — rejudge is meaningless without the diff
137
+ execFileSync('git', ['apply', '--3way', '--whitespace=nowarn', patchPath], {
138
+ cwd: repoDir,
139
+ stdio: 'ignore',
140
+ });
141
+ }
142
+ }
143
+ // Re-init (e.g. npm install) — the judge may need a runnable repo for E2E testing
144
+ if (initCommand) {
145
+ try {
146
+ execSync(initCommand, { cwd: repoDir, stdio: 'ignore', timeout: 120000 });
147
+ }
148
+ catch (e) {
149
+ console.warn(` [Rejudge ${idx + 1}/${total}] Init command failed: ${e}`);
150
+ }
151
+ }
152
+ console.log(` [Rejudge ${idx + 1}/${total}] Re-judging baseline ${feature.id} with current docs...`);
153
+ const JUDGE_TIMEOUT_MS = 35 * 60 * 1000;
154
+ return await Promise.race([
155
+ judgeTaskResult({
156
+ taskPrompt: feature.prompt,
157
+ agentDiff: baselineDiff,
158
+ groundTruthDiff,
159
+ repoDir,
160
+ }),
161
+ new Promise((_, reject) => setTimeout(() => reject(new Error(`Rejudge timed out after ${JUDGE_TIMEOUT_MS / 1000}s`)), JUDGE_TIMEOUT_MS)),
162
+ ]);
163
+ }
164
+ finally {
165
+ try {
166
+ fs.rmSync(tempDir, { recursive: true, force: true });
167
+ }
168
+ catch { /* ignore */ }
169
+ }
170
+ }
171
+ function createInfrastructureFailureResult(feature, error) {
172
+ const errMsg = error instanceof Error ? error.message : String(error);
173
+ return {
174
+ featureId: feature.id,
175
+ prompt: feature.prompt,
176
+ score: -1,
177
+ diff: '',
178
+ trace: `Agent error: ${errMsg}`,
179
+ judging: {
180
+ analysis: `Agent failed: ${errMsg.slice(0, 500)}`,
181
+ strengths: [],
182
+ weaknesses: ['Agent failed due to infrastructure error'],
183
+ e2eTestsPerformed: [],
184
+ completionScore: -1,
185
+ codeQualityScore: -1,
186
+ e2eScore: -1,
187
+ overallScore: -1,
188
+ },
189
+ costEstimate: 0,
190
+ docsRead: [],
191
+ };
192
+ }
193
+ //# sourceMappingURL=eval-runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eval-runner.js","sourceRoot":"","sources":["../src/eval-runner.ts"],"names":[],"mappings":"AAAA,OAAO,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AAC;YAAS,CAAC;QACT,IAAI,CAAC;YACH,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QACtD,CAAC;QAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,SAAS,iCAAiC,CACxC,OAAsB,EACtB,KAAc;IAEd,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACrE,OAAO;QACL,SAAS,EAAE,OAAO,CAAC,EAAE;QACrB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,KAAK,EAAE,CAAC,CAAC;QACT,IAAI,EAAE,EAAE;QACR,KAAK,EAAE,gBAAgB,MAAM,EAAE;QAC/B,OAAO,EAAE;YACP,QAAQ,EAAE,iBAAiB,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;YACjD,SAAS,EAAE,EAAE;YACb,UAAU,EAAE,CAAC,0CAA0C,CAAC;YACxD,iBAAiB,EAAE,EAAE;YACrB,eAAe,EAAE,CAAC,CAAC;YACnB,gBAAgB,EAAE,CAAC,CAAC;YACpB,QAAQ,EAAE,CAAC,CAAC;YACZ,YAAY,EAAE,CAAC,CAAC;SACjB;QACD,YAAY,EAAE,CAAC;QACf,QAAQ,EAAE,EAAE;KACb,CAAA;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const JudgingResultSchema: z.ZodObject<{
3
+ analysis: z.ZodString;
4
+ strengths: z.ZodArray<z.ZodString>;
5
+ weaknesses: z.ZodArray<z.ZodString>;
6
+ e2eTestsPerformed: z.ZodArray<z.ZodString>;
7
+ completionScore: z.ZodNumber;
8
+ codeQualityScore: z.ZodNumber;
9
+ e2eScore: z.ZodNumber;
10
+ overallScore: z.ZodNumber;
11
+ docSuggestions: z.ZodOptional<z.ZodArray<z.ZodString>>;
12
+ }, z.core.$strip>;
13
+ export type JudgingResult = z.infer<typeof JudgingResultSchema>;
14
+ export interface JudgeTaskResultInput {
15
+ taskPrompt: string;
16
+ agentDiff: string;
17
+ groundTruthDiff?: string;
18
+ repoDir: string;
19
+ error?: string;
20
+ }
21
+ export declare function judgeTaskResult(input: JudgeTaskResultInput): Promise<JudgingResult>;
22
+ //# sourceMappingURL=judge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"judge.d.ts","sourceRoot":"","sources":["../src/judge.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAM1B,eAAO,MAAM,mBAAmB;;;;;;;;;;iBAiC9B,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AA2P/D,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAsB,eAAe,CACnC,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,aAAa,CAAC,CA+BxB"}
package/dist/judge.js ADDED
@@ -0,0 +1,284 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { Codex } from '@openai/codex-sdk';
4
+ import { z } from 'zod/v4';
5
+ import { truncateDiff } from './eval-helpers';
6
+ export const JudgingResultSchema = z.object({
7
+ analysis: z
8
+ .string()
9
+ .describe('Detailed analysis of what was tested and found'),
10
+ strengths: z
11
+ .array(z.string())
12
+ .describe('Key strengths of the implementation'),
13
+ weaknesses: z.array(z.string()).describe('Key weaknesses or issues found'),
14
+ e2eTestsPerformed: z
15
+ .array(z.string())
16
+ .describe('List of E2E tests that were actually performed'),
17
+ completionScore: z
18
+ .number()
19
+ .min(0)
20
+ .max(10)
21
+ .describe('How completely the prompt was addressed'),
22
+ codeQualityScore: z
23
+ .number()
24
+ .min(0)
25
+ .max(10)
26
+ .describe('Code structure and maintainability'),
27
+ e2eScore: z
28
+ .number()
29
+ .min(0)
30
+ .max(10)
31
+ .describe('How well the change works when tested end-to-end'),
32
+ overallScore: z.number().min(0).max(10).describe('Combined assessment'),
33
+ docSuggestions: z
34
+ .array(z.string())
35
+ .optional()
36
+ .describe('Informal recommendations for documentation changes to help future coding agents AND future reviewers'),
37
+ });
38
+ const RESULT_FILE_NAME = 'evalbuff-review-result.json';
39
+ function buildReviewerPrompt(input) {
40
+ const { taskPrompt, agentDiff: rawAgentDiff, groundTruthDiff: rawGroundTruthDiff, error, docsDir } = input;
41
+ const agentDiff = truncateDiff(rawAgentDiff);
42
+ const groundTruthDiff = rawGroundTruthDiff ? truncateDiff(rawGroundTruthDiff) : rawGroundTruthDiff;
43
+ const groundTruth = groundTruthDiff
44
+ ? `## Ground Truth Changes (One valid implementation)
45
+ ${groundTruthDiff}`
46
+ : `## Ground Truth
47
+ No reference implementation is available. You must judge the agent's work solely by testing it end-to-end. Focus heavily on:
48
+ - Does it build and run?
49
+ - Does the feature actually work when you test it?
50
+ - Are there errors in the logs?
51
+ - Does it handle edge cases?`;
52
+ const docsSection = docsDir
53
+ ? `\n## Project Docs\nRead the docs in the \`docs/\` directory and \`AGENTS.md\` for project-specific patterns and conventions before reviewing.\n`
54
+ : '';
55
+ return `You are a senior engineer performing a thorough code review with E2E testing.
56
+
57
+ ## Your Mission
58
+
59
+ You have been given a coding task and an AI agent's attempt. Your job is to:
60
+
61
+ 1. **Read the project docs** (if present) to understand conventions and patterns
62
+ 2. **Review the agent's diff** ${groundTruthDiff ? 'against the ground truth' : 'for correctness and completeness'}
63
+ 3. **Actually test the changes** end-to-end:
64
+ - Start the application if possible (check package.json for start/dev scripts)
65
+ - Use browser tools, curl, or the appropriate client to exercise the feature
66
+ - Check logs for errors
67
+ - Test edge cases and error states
68
+ - Take screenshots of UI changes if applicable
69
+ 4. **Write your judgment** to a JSON file
70
+
71
+ ## Important: You have full access to the repository and can run any commands.
72
+
73
+ Use whatever tools you need to verify the change actually works:
74
+ - Run the build/compile step
75
+ - Run the test suite
76
+ - Start the dev server
77
+ - Use browser tools to test the UI
78
+ - curl API endpoints
79
+ - Check logs
80
+ - Use tmux for long-running processes
81
+ - Any other verification method appropriate for the change
82
+
83
+ ${docsSection}
84
+ ## User Prompt (What the agent was asked to do)
85
+ ${taskPrompt}
86
+
87
+ ${groundTruth}
88
+
89
+ ## Agent's Changes (What the agent actually did)
90
+ \`\`\`diff
91
+ ${agentDiff || '(No changes made)'}
92
+ \`\`\`
93
+ ${error ? `\n## Error Encountered During Agent Run\n${error}\n` : ''}
94
+
95
+ ## Required Output
96
+
97
+ After your review and testing, write your judgment to the file \`${RESULT_FILE_NAME}\` in the current working directory. The JSON must have exactly this structure:
98
+
99
+ \`\`\`json
100
+ {
101
+ "analysis": "Detailed analysis of what you tested and found...",
102
+ "strengths": ["strength 1", "strength 2"],
103
+ "weaknesses": ["weakness 1", "weakness 2"],
104
+ "e2eTestsPerformed": ["Started dev server and loaded /dashboard", "Submitted form with invalid email", "Checked network tab for API errors"],
105
+ "completionScore": 7,
106
+ "codeQualityScore": 8,
107
+ "e2eScore": 6,
108
+ "overallScore": 7,
109
+ "docSuggestions": [
110
+ "Update docs/architecture.md: Add a section 'Route Registration'. All API routes must be registered in src/routes/index.ts by calling registerRoute(). The route handler file goes in src/routes/<name>.ts and must export a default function with signature (req: Request, res: Response) => void. Without registration the route silently 404s — there is no auto-discovery.",
111
+ "Create docs/patterns/error-handling.md: All async route handlers in src/routes/ must be wrapped with withErrorHandler() from src/middleware/error.ts. This wrapper catches thrown errors and returns a standardized { error: string, code: number } JSON response. Without it, unhandled rejections crash the server. Example: export default withErrorHandler(async (req, res) => { ... })"
112
+ ]
113
+ }
114
+ \`\`\`
115
+
116
+ All scores are 0-10. The e2eScore specifically measures how well the change works when actually tested, not just how the code looks.
117
+
118
+ ## Documentation Suggestions
119
+
120
+ Based on what you learned from reviewing and testing this code, suggest documentation changes that would help in two ways:
121
+
122
+ 1. **Help coding agents** do better on FUTURE similar tasks — patterns, conventions, gotchas they should know.
123
+ 2. **Help future reviewers** (like you) better evaluate changes — testing strategies that worked, verification processes, scripts or commands that reliably catch issues, ways to set up end-to-end testing for this area of the codebase.
124
+
125
+ Add all suggestions to the \`docSuggestions\` array.
126
+
127
+ Each suggestion is a string that specifies which file to create or update AND includes the full substantive content — file paths, function signatures, conventions, examples, gotchas. A separate agent will read your suggestions and edit the actual doc files, so give it everything it needs without having to re-investigate the codebase.
128
+
129
+ Good suggestion for coding agents (has the meat):
130
+ - "Create docs/patterns/error-handling.md: All async route handlers in src/routes/ must be wrapped with withErrorHandler() from src/middleware/error.ts. This wrapper catches thrown errors and returns a standardized { error: string, code: number } JSON response. Without it, unhandled rejections crash the server. Example: export default withErrorHandler(async (req, res) => { ... })"
131
+ - "Update docs/architecture.md, section 'Data Layer': Add that all database queries go through src/db/queries.ts, never raw SQL in route handlers. The query functions handle connection pooling and return typed results. Import pattern: import { getUser, createUser } from '@/db/queries'"
132
+
133
+ Good suggestion for reviewers (testing strategies, verification):
134
+ - "Update docs/testing.md, section 'E2E Verification': To test API route changes end-to-end, write a temporary script that starts the dev server with 'bun run dev', waits for port 3000, then curls each affected endpoint. Example: const proc = Bun.spawn(['bun', 'run', 'dev']); await fetch('http://localhost:3000/api/health'); // verify response shape"
135
+ - "Create docs/testing/payment-flow.md: Testing payment-related changes requires seeding the test DB with a user and subscription via src/db/seed.ts, then hitting POST /api/checkout with a Stripe test token. The key assertion is that the webhook handler at src/routes/webhook.ts correctly updates user.plan — check the DB directly after the webhook fires."
136
+
137
+ Bad suggestion (too vague, forces the refactorer to figure it out):
138
+ - "Add something about error handling conventions"
139
+ - "Document how to test this area"
140
+
141
+ Guidelines:
142
+ - Focus on GENERAL PATTERNS, not task-specific fixes.
143
+ - Include concrete file paths, function names, type signatures, import patterns, and examples.
144
+ - Describe edits to existing docs when they're incomplete or wrong, not just new docs.
145
+ - For reviewer suggestions, focus on reusable testing strategies — what to spin up, what to seed, what to assert, what scripts to write. These help future judges verify correctness beyond just reading the diff.
146
+ - If the agent scored 9+, suggestions are optional.
147
+ - If weaknesses are too task-specific to generalize, leave docSuggestions empty.
148
+
149
+ IMPORTANT: You MUST write the result file. This is the only way your review gets recorded. Do it as your very last action.`;
150
+ }
151
+ async function runCodexReviewer(prompt, cwd, timeoutMs = 40 * 60 * 1000) {
152
+ const codex = new Codex({
153
+ apiKey: process.env.OPENAI_API_KEY,
154
+ });
155
+ const thread = codex.startThread({
156
+ model: 'gpt-5.4',
157
+ workingDirectory: cwd,
158
+ approvalPolicy: 'never',
159
+ sandboxMode: 'workspace-write',
160
+ webSearchMode: 'live',
161
+ modelReasoningEffort: 'high',
162
+ });
163
+ console.log(`[Reviewer:codex] Starting review in ${cwd}`);
164
+ const abortController = new AbortController();
165
+ const timer = setTimeout(() => {
166
+ console.warn(`[Reviewer:codex] Timed out after ${timeoutMs / 1000}s`);
167
+ abortController.abort();
168
+ }, timeoutMs);
169
+ try {
170
+ const { events } = await thread.runStreamed(prompt, {
171
+ signal: abortController.signal,
172
+ });
173
+ for await (const event of events) {
174
+ if (event.type === 'item.completed') {
175
+ logItem(event.item, 'codex');
176
+ }
177
+ else if (event.type === 'turn.failed') {
178
+ console.error(`[Reviewer:codex] Turn failed: ${event.error.message}`);
179
+ }
180
+ else if (event.type === 'error') {
181
+ console.error(`[Reviewer:codex] Error: ${event.message}`);
182
+ }
183
+ }
184
+ }
185
+ catch (err) {
186
+ if (err.name === 'AbortError') {
187
+ console.warn(`[Reviewer:codex] Aborted`);
188
+ }
189
+ else {
190
+ console.error(`[Reviewer:codex] Failed: ${err.message}`);
191
+ }
192
+ }
193
+ finally {
194
+ clearTimeout(timer);
195
+ }
196
+ // Try to read the result file
197
+ const resultPath = path.join(cwd, RESULT_FILE_NAME);
198
+ return parseResultFile(resultPath, 'codex');
199
+ }
200
+ function logItem(item, label) {
201
+ switch (item.type) {
202
+ case 'agent_message':
203
+ process.stdout.write(item.text);
204
+ break;
205
+ case 'command_execution':
206
+ console.log(`[Reviewer:${label}] $ ${item.command} (exit: ${item.exit_code})`);
207
+ break;
208
+ case 'file_change':
209
+ console.log(`[Reviewer:${label}] File changes: ${item.changes.map(c => `${c.kind} ${c.path}`).join(', ')}`);
210
+ break;
211
+ case 'error':
212
+ console.error(`[Reviewer:${label}] Item error: ${item.message}`);
213
+ break;
214
+ }
215
+ }
216
+ function parseResultFile(resultPath, agentType) {
217
+ try {
218
+ if (!fs.existsSync(resultPath))
219
+ return null;
220
+ const raw = JSON.parse(fs.readFileSync(resultPath, 'utf-8'));
221
+ const parsed = JudgingResultSchema.safeParse(raw);
222
+ if (parsed.success) {
223
+ console.log(`[Reviewer:${agentType}] Parsed result file successfully`);
224
+ return parsed.data;
225
+ }
226
+ console.warn(`[Reviewer:${agentType}] Result file failed validation:`, parsed.error);
227
+ return salvagePartialResult(raw);
228
+ }
229
+ catch (error) {
230
+ console.warn(`[Reviewer:${agentType}] Failed to parse result file:`, error);
231
+ return null;
232
+ }
233
+ }
234
+ function salvagePartialResult(raw) {
235
+ if (typeof raw !== 'object' || raw === null)
236
+ return null;
237
+ if (typeof raw.overallScore !== 'number')
238
+ return null;
239
+ return {
240
+ analysis: raw.analysis || 'No analysis provided',
241
+ strengths: Array.isArray(raw.strengths) ? raw.strengths : [],
242
+ weaknesses: Array.isArray(raw.weaknesses) ? raw.weaknesses : [],
243
+ e2eTestsPerformed: Array.isArray(raw.e2eTestsPerformed)
244
+ ? raw.e2eTestsPerformed
245
+ : [],
246
+ completionScore: typeof raw.completionScore === 'number' ? raw.completionScore : raw.overallScore,
247
+ codeQualityScore: typeof raw.codeQualityScore === 'number'
248
+ ? raw.codeQualityScore
249
+ : raw.overallScore,
250
+ e2eScore: typeof raw.e2eScore === 'number' ? raw.e2eScore : raw.overallScore,
251
+ overallScore: raw.overallScore,
252
+ };
253
+ }
254
+ export async function judgeTaskResult(input) {
255
+ const { taskPrompt, agentDiff, groundTruthDiff, repoDir, error } = input;
256
+ const prompt = buildReviewerPrompt({
257
+ taskPrompt,
258
+ agentDiff,
259
+ groundTruthDiff,
260
+ error,
261
+ docsDir: fs.existsSync(path.join(repoDir, 'docs')) ? repoDir : undefined,
262
+ });
263
+ const maxRetries = 2;
264
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
265
+ const result = await runCodexReviewer(prompt, repoDir);
266
+ if (result)
267
+ return result;
268
+ if (attempt < maxRetries) {
269
+ console.warn(`[Judge] Attempt ${attempt}/${maxRetries} failed, retrying...`);
270
+ }
271
+ }
272
+ console.error(`[Judge] All ${maxRetries} attempts failed`);
273
+ return {
274
+ analysis: 'Error: reviewer agent failed to provide results after retries',
275
+ strengths: [],
276
+ weaknesses: ['Reviewer agent failed'],
277
+ e2eTestsPerformed: [],
278
+ completionScore: 0,
279
+ codeQualityScore: 0,
280
+ e2eScore: 0,
281
+ overallScore: 0,
282
+ };
283
+ }
284
+ //# sourceMappingURL=judge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"judge.js","sourceRoot":"","sources":["../src/judge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAI7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,CAAC,gDAAgD,CAAC;IAC7D,SAAS,EAAE,CAAC;SACT,KAAK,CAAC,CAAC,CAAC,MAAM,E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,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=perfect-feature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perfect-feature.d.ts","sourceRoot":"","sources":["../src/perfect-feature.ts"],"names":[],"mappings":""}