Skip to content

fix(scripts): cross-runtime compatibility for submit and checkpoint - #9

Open
undivisible wants to merge 2 commits into
MaincodeHQ:mainfrom
undivisible:fix/scripts-cross-runtime
Open

fix(scripts): cross-runtime compatibility for submit and checkpoint#9
undivisible wants to merge 2 commits into
MaincodeHQ:mainfrom
undivisible:fix/scripts-cross-runtime

Conversation

@undivisible

@undivisible undivisible commented Jun 25, 2026

Copy link
Copy Markdown

Summary

  • Rewrote scripts/submit.mjs and scripts/checkpoint.mjs to use only Node.js standard library — works with both bun and node
  • Fixed 6 bugs that prevented the scripts from running at all

Fixes

Bug Cause Fix
Missing imports $, fs, question used as globals (Bun shell preloads only in .ts, not .mjs) Explicit imports from node:child_process, node:fs, node:readline
Wrong path resolution cd .. relative to CWD, not script location import.meta.url + fileURLToPath
fs.pathExists undefined fs-extra API, not in node:fs existsSync from node:fs
fs.move undefined fs-extra API, not in node:fs fs.rename from node:fs/promises
stdout.trim not a function Bun $ returns Buffer, not string execSync with encoding: "utf-8"
xargs: command line cannot be assembled, too long Presigned S3 URL exceeds xargs limit Pass URL directly to curl

Additional improvements

  • Exclude .venv, __pycache__ and .DS_Store from submission zip (was 234MB with venv, now ~10MB)
  • Clean up zip file on error

Test plan

  • node scripts/submit.mjs works (tested on Node 24)
  • bun scripts/submit.mjs works (tested on Bun 1.3.14)
  • node scripts/checkpoint.mjs works
  • bun scripts/checkpoint.mjs works
  • Submission zip excludes venv/data/git/pycache
  • Upload succeeds with presigned S3 URL

Generated with Devin

undivisible and others added 2 commits June 26, 2026 08:23
Rewrote submit.mjs and checkpoint.mjs to use only Node.js standard
library (child_process, fs, path, url, readline). No runtime-specific
APIs. Works with both `bun scripts/submit.mjs` and `node scripts/submit.mjs`.

Fixes:
- Missing imports ($, fs, question were undefined)
- Relative path resolution (used cd .. from CWD, now uses import.meta.url)
- fs-extra APIs (pathExists, move) replaced with node:fs equivalents
- Bun Buffer stdout (stdout.trim failed, now uses execSync with encoding)
- xargs command line limit (presigned S3 URL too long, now passed directly)
- Excludes .venv, __pycache__, .DS_Store, mainrun.log from zip

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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