-
Notifications
You must be signed in to change notification settings - Fork 30
New Remote Env / TS Env #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| console.print("\nNext steps:") | ||
| console.print(f" cd {created_path}") | ||
| console.print(" # Edit sandbox/src/index.ts to define your tools and rewards") | ||
| console.print(" prime env push") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--rewrite-readme option silently ignored with sandbox/ts flags
Low Severity
The rewrite_readme parameter is defined as a CLI option but is only used when neither --sandbox nor --ts flags are set. When using --sandbox or --ts, the option is accepted but silently ignored. The init_sandbox_environment and init_ts_environment functions always overwrite all files (including README.md) using write_text(), which is inconsistent with the regular init path that respects the --rewrite-readme flag. Users could specify --sandbox --rewrite-readme and expect specific behavior that doesn't occur.
| def init_sandbox_environment(name: str, path: str) -> Path: | ||
| env_id_underscore = name.replace("-", "_") | ||
| local_dir = Path(path) / env_id_underscore | ||
| local_dir.mkdir(parents=True, exist_ok=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty name causes files written to wrong location
Low Severity
When name is an empty string, Path(path) / env_id_underscore evaluates to just Path(path) (the environments directory itself). This causes all generated files (pyproject.toml, README.md) to be written directly to the environments directory rather than a subdirectory, potentially overwriting existing files. The Python file would be created as .py (a hidden file with no real name). Other commands in the codebase validate empty names with if not name: checks, but these new functions lack such validation.
Additional Locations (1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a1ddcec712
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Edit `sandbox/setup.sh` to install dependencies and start your service. | ||
| The last command in setup.sh should start your long-running process. | ||
| ''' | ||
| (local_dir / "README.md").write_text(readme_content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid overwriting existing env files on init
The sandbox/TS init path writes README.md (and other files) unconditionally because it creates the target directory with exist_ok=True and then calls write_text without checking for pre‑existing content. If a user re-runs prime env init --sandbox/--ts in an existing environment directory (for example to add the new template files), this will silently clobber their README and other edits, even though the CLI already has a --rewrite-readme flag for the legacy path. Consider failing when files already exist or honoring --rewrite-readme to avoid data loss in that scenario.
Useful? React with 👍 / 👎.
|
Let's wait on this until we land the env patterns in a verifiers release |
Intro:
This PR is for 2 new additions to the
prime env initcommand, specifically adding flags--sandboxand--ts. Minimal changes to env.py with just the necessary updates for handling the 2 flags and calling init_sandbox_environment() or init_ts_environment() based on the flag used.Corresponding verifiers PR
Changes:
environments/myenv/sandbox/folder withsetup.shsandbox/package.json,sandbox/src/index.tswhere index.ts is initialized as a template file to show the user how to write tools and rewardsHow it works:
The standard env init command creates all the contents of the environment at environments/myenv in which the user is then expected to make updates to myenv.py to build their environment. The new remote pattern works in a way so that people can build environments without having to write any python.
.
.
This works by using the
--tsflag, a newenvironments/myenv/sandbox/folder is created and includes asandbox/setup.shandsandbox/src/index.tsin which the user then gets a template index.ts file that shows how to write tools and reward functions..
Then the typescript user just has to define their tools and reward functions like here
Note
Adds new remote environment scaffolding options to
prime env init.--sandboxand--tsflags inenv.pyto generate remote environment templates; flags are mutually exclusive with clear next-steps outpututils/remote_env.pywithinit_sandbox_environmentandinit_ts_environmentto scaffold directories and files:pyproject.toml,README.md,{name}.pyloader usingRemoteEnvorTypeScriptEnv, andsandbox/setup.shsandbox/package.jsonandsandbox/src/index.ts(Bun server) exposing REST endpoints fortoolsandrewardsdiscovery/executionWritten by Cursor Bugbot for commit a1ddcec. This will update automatically on new commits. Configure here.