Skip to content

Add generation environment and source - #1

Merged
frvnkliu merged 3 commits into
mainfrom
add-generation
Oct 11, 2026
Merged

frvnkliu merged 3 commits into
mainfrom
add-generation

Conversation

@frvnkliu

Copy link
Copy Markdown
Contributor

Adds the code that generates attempts for the 100 tasks: one request and one reply per attempt, through OpenRouter or any OpenAI-compatible server. The README describes the request and how to run it. The grader comes in a later release.

  • node tools/3jsbench.js generate --model MODEL --out DIR saves each reply verbatim as DIR/<task>/<n>/asset.ts, beside the request, every response and the parsed completion.
  • node tools/3jsbench.js prompts --out DIR writes each task's exact messages.
  • There are no package dependencies. npm test runs offline.

🤖 Generated with Claude Code

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 7 new potential issues.

Devin Review

Comment thread tools/3jsbench.js Outdated
Comment thread tools/3jsbench.js Outdated
Comment thread tools/3jsbench.js
Comment thread tools/3jsbench.js
Comment thread tools/3jsbench.js
Comment on lines +58 to +61
const worker = async () => {
while (next < items.length) await work(items[next++]);
};
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));

@devin-ai-integration devin-ai-integration Bot Oct 11, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 One failed job strands queued attempts

If generateAttempt throws, its worker stops and pool rejects. Queued attempts remain unprocessed, and the command exits without a final tally.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intended. A thrown error here is a setup error (a missing key, an unwritable folder), so stopping is correct. Model and transport failures do not throw: they are recorded in completion.json, and the run continues. A rerun resumes and skips finished attempts.

Comment thread src/model-call.js
Comment thread src/generation.js Outdated

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Devin Review

Comment thread src/generation.js
Comment on lines +77 to +80
completion = JSON.parse(await readFile(path.join(dir, 'completion.json'), 'utf8'));
} catch (error) {
if (error.code === 'ENOENT') return null;
throw error;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Partial completion blocks all attempts

When a run stops during completion.json writing, savedAttempt throws on partial JSON. The rerun aborts instead of marking that attempt unfinished, blocking other attempts.

Learn more

A model call creates completion.json using a normal write after the provider replies. If the process stops mid-write, the directory and a truncated completion file remain. On rerun, parsing that file throws before the existing-directory check can mark the attempt unfinished. The worker pool then rejects and stops scheduling other attempts.

Example: A run stops after writing the first half of spiral-staircase/1/completion.json. The next generate command exits on a JSON parse error instead of reporting that attempt unfinished and continuing with the remaining tasks.

Recommended fix: Treat a JSON parse failure as an unfinished attempt by returning null from savedAttempt. The caller already checks that the attempt directory exists and refuses to resend its request.

Suggested change
completion = JSON.parse(await readFile(path.join(dir, 'completion.json'), 'utf8'));
} catch (error) {
if (error.code === 'ENOENT') return null;
throw error;
completion = JSON.parse(await readFile(path.join(dir, 'completion.json'), 'utf8'));
} catch (error) {
if (error.code === 'ENOENT' || error instanceof SyntaxError) return null;
throw error;

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed at the source. completion.json is now written to completion.json.partial and then renamed, so it is complete or absent. A run that stops before the rename leaves only the folder, and a rerun reports that attempt as unfinished and continues.

@frvnkliu
frvnkliu merged commit 4812548 into main Oct 11, 2026
2 checks passed
@frvnkliu
frvnkliu deleted the add-generation branch October 11, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant