Skip to content

Conversation

@cdreetz
Copy link

@cdreetz cdreetz commented Jan 8, 2026

Intro:

This PR is for 2 new additions to the prime env init command, specifically adding flags --sandbox and --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:

  • --sandbox flag is the "base" version of this pattern and in addition to the regular init will include an environments/myenv/sandbox/ folder with setup.sh
  • --ts flag is an extension that then also includes typescript specific files like sandbox/package.json, sandbox/src/index.ts where index.ts is initialized as a template file to show the user how to write tools and rewards

How 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.
.

image

.
This works by using the --ts flag, a new environments/myenv/sandbox/ folder is created and includes a sandbox/setup.sh and sandbox/src/index.ts in which the user then gets a template index.ts file that shows how to write tools and reward functions.
.

image

Then the typescript user just has to define their tools and reward functions like here

image

Note

Adds new remote environment scaffolding options to prime env init.

  • Introduces --sandbox and --ts flags in env.py to generate remote environment templates; flags are mutually exclusive with clear next-steps output
  • New utils/remote_env.py with init_sandbox_environment and init_ts_environment to scaffold directories and files: pyproject.toml, README.md, {name}.py loader using RemoteEnv or TypeScriptEnv, and sandbox/setup.sh
  • TypeScript template additionally creates sandbox/package.json and sandbox/src/index.ts (Bun server) exposing REST endpoints for tools and rewards discovery/execution

Written by Cursor Bugbot for commit a1ddcec. This will update automatically on new commits. Configure here.

@cdreetz cdreetz marked this pull request as ready for review January 8, 2026 05:09
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")
Copy link

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.

Fix in Cursor Fix in Web

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)
Copy link

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)

Fix in Cursor Fix in Web

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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)

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@willccbb
Copy link
Member

willccbb commented Jan 8, 2026

Let's wait on this until we land the env patterns in a verifiers release

@willccbb willccbb marked this pull request as draft January 8, 2026 18:00
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.

2 participants