Skip to content

fix(envs): migrate remaining envs to uv and fix Docker health checks#466

Open
mroyme wants to merge 4 commits into
huggingface:mainfrom
mroyme:fix/461-docker-builds
Open

fix(envs): migrate remaining envs to uv and fix Docker health checks#466
mroyme wants to merge 4 commits into
huggingface:mainfrom
mroyme:fix/461-docker-builds

Conversation

@mroyme
Copy link
Copy Markdown
Contributor

@mroyme mroyme commented Mar 26, 2026

Fixes #461 (browsergym-env build in CI) and also applies the same fixes to calendar-env, grid-world-env, and carla-env which are not built in CI.

Changes:

  • browsergym-env: replace pip/requirements.txt with uv sync; add override-dependencies to resolve beartype cross-platform conflict
  • calendar-env: rewrite Dockerfile to echo_env multi-stage uv pattern
  • grid-world-env: rewrite Dockerfile to uv multi-stage; fix requires-python (>=3.12 → >=3.10) so uv uses the base image Python rather than downloading an isolated 3.13 that disappears in the final stage; apply try/except fallback for relative model imports (same pattern as connect4-env, maze-env, snake-env); remove stale uv.lock with broken local path reference
  • carla-env: replace pip install calls with uv pip install; add missing deps (websockets, numpy, shapely, networkx) to pyproject.toml
  • Remove all requirements.txt files superseded by pyproject.toml + uv
  • test-docker-builds.sh: add dual-platform support (linux/amd64 + linux/arm64 by default, --platform= to override); add browsergym-env, grid-world-env, calendar-env to the test matrix; switch env builds from docker buildx --load to plain docker build --platform so locally-tagged base images are found; improve container start error reporting

Summary

  • Migrates browsergym-env, calendar-env, grid-world-env, and carla-env from pip/requirements.txt to uv sync, matching the pattern established in fix(envs): standardize Docker builds with uv and per-env pyproject.toml #452.
  • Fixes a Python version mismatch in grid-world-env where requires python = ">=3.12" caused uv to download Python 3.13, which then disappeared in the multi-stage final image; also applies the standard try/except relative-import fallback pattern.
  • Updates test-docker-builds.sh to test both linux/amd64 and linux/arm64 by default with --platform= override, and adds the three previously-untested envs to the matrix. All 6 checks (3 envs × 2 platforms) pass.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • New environment
  • Refactoring

Alignment Checklist

Before submitting, verify:

  • I have read .claude/docs/PRINCIPLES.md and this PR aligns with our principles
  • I have checked .claude/docs/INVARIANTS.md and no invariants are violated
  • I have run /pre-submit-pr (or bash .claude/hooks/lint.sh and tests) and addressed all issues

RFC Status

  • Not required (bug fix, docs, minor refactoring)
  • RFC exists: #___
  • RFC needed (will create before merge)

Test Plan

Verified using scripts/test-docker-builds.sh, which builds each env image and polls /health before passing:

  bash scripts/test-docker-builds.sh "browsergym-env,grid-world-env,calendar-env"

  Results:

  ✓ Passed (6): browsergym-env (linux-amd64)
                 grid-world-env (linux-amd64)
                 calendar-env   (linux-amd64)
                 browsergym-env (linux-arm64)
                 grid-world-env (linux-arm64)
                 calendar-env   (linux-arm64)
  ✓ All checks passed.
  • carla-env changes were not run-tested locally (requires GPU + external CARLA 0.9.x server) but the migration is mechanical - pip install -r requirements.txt replaced with uv pip install --system with equivalent packages, and missing transitive deps added to pyproject.toml.

Claude Code Review

Alignment Review Report

Automated Checks

  • Lint: PASS — ruff format + ruff check all clean
  • Debug code: CLEAN — no debugger statements introduced; all flagged prints are pre-existing in src/

Open RFCs Context

All 5 RFCs (000–005) are "In Review". None are relevant to this PR — the RFCs cover abstractions, env spec, MCP support, rubrics, and agentic harnesses. This PR is purely build
tooling (Dockerfiles, uv migration, test script).

Tier 1: Fixes Required

None.

Tier 2: Alignment Discussion

Principle Conflicts

None identified. No changes to public APIs, reward computation, agent/orchestration boundaries, or client-server separation.

RFC Conflicts

None identified. RFCs 001–005 address runtime behavior and API design; this PR only changes packaging and build infrastructure.

Summary

  • 0 mechanical issues to fix
  • 0 alignment flags for human review
  • 0 RFC conflicts to discuss

The PR is a pure build hygiene change. The one runtime-visible change (from models import ... fallback in grid_world_env) follows the established pattern from connect4_env,
maze_env, and snake_env and has no alignment implications.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 26, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 26, 2026

Greptile Summary

This PR migrates browsergym-env, calendar-env, grid-world-env, and carla-env from pip/requirements.txt to uv sync, aligning them with the pattern established in #452. It also fixes a Python version mismatch in grid-world-env (>=3.12 → >=3.10), applies the standard try/except relative-import fallback to grid_world_env, switches all Docker health checks from curl-based to urllib.request, and expands the test script to cover both linux/amd64 and linux/arm64 platforms.\n\nKey changes:\n- browsergym-env: pip → uv sync; adds beartype>=0.20.0 override to resolve cross-platform conflict; health check updated — blocked by a gWORKDIR typo on line 4 that will break the Docker build\n- calendar-env / grid-world-env: rewritten to multi-stage uv builder pattern consistent with other envs\n- grid-world-env: requires-python corrected (>=3.12 → >=3.10); stale uv.lock with broken local path removed; try/except import fallbacks added to app.py and grid_world_environment.py\n- carla-env: uv pip install --system replaces pip; missing runtime deps (websockets, numpy, shapely, networkx) added to pyproject.toml\n- test-docker-builds.sh: dual-platform testing, three new envs in matrix, improved container start error reporting\n\nTier 1 (fix required):\n- envs/browsergym_env/server/Dockerfile:4gWORKDIR /app/env is not a valid Dockerfile instruction; Docker will reject the build\n\nTier 2 (alignment):\n- None identified. No changes to reward computation, agent/env API boundaries, or client-server separation.

Confidence Score: 3/5

Safe to merge after fixing the one-character typo in the browsergym Dockerfile; all other changes are clean.

All env migrations follow the established uv pattern correctly and the test script improvements are solid. However, gWORKDIR on line 4 of envs/browsergym_env/server/Dockerfile is an invalid Docker instruction that will cause the browsergym-env Docker build to fail completely — this breaks the primary user path for that environment.

envs/browsergym_env/server/Dockerfile — line 4 has gWORKDIR instead of WORKDIR; single-character fix required before merging.

Important Files Changed

Filename Overview
envs/browsergym_env/server/Dockerfile Migrates from pip to uv sync, but has a critical typo gWORKDIR on line 4 that will break the Docker build entirely.
envs/calendar_env/Dockerfile Rewrites to multi-stage uv pattern matching echo_env; health check correctly switched from requests to urllib; CMD updated to cd into /app/env before starting uvicorn.
envs/grid_world_env/server/Dockerfile Replaces custom base image + pip with standard multi-stage uv pattern; health check updated to urllib; CMD updated correctly.
envs/grid_world_env/pyproject.toml Fixes requires-python from >=3.12 to >=3.10 so uv uses the base image Python; removes broken local path uv.sources reference.
envs/carla_env/server/Dockerfile Replaces pip+requirements.txt with uv pip install --system for system Python; health check updated to urllib; CMD changed to cd into /app/env.
envs/carla_env/server/Dockerfile.real Migrates to uv sync with venv pattern; health check updated from curl to urllib; CMD updated to cd into /app/env; user stays as non-root carla.
envs/carla_env/pyproject.toml Adds previously-missing runtime deps (websockets, numpy, shapely, networkx) that were only declared in requirements.txt.
scripts/test-docker-builds.sh Adds dual-platform support (amd64 + arm64), adds browsergym-env/grid-world-env/calendar-env to test matrix, switches from docker buildx --load to plain docker build --platform for local base image resolution.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: envs/browsergym_env/server/Dockerfile
Line: 4

Comment:
**Stray `g` prefix breaks Docker build**

`gWORKDIR` is not a valid Dockerfile instruction. Docker will reject the build at this line with `unknown instruction: GWORKDIR` (instructions are case-insensitive). This was introduced when the `# Set working directory` comment was removed — the `g` leaked from the editor/search operation. The file currently has no valid `WORKDIR` set, so the subsequent `COPY . .` and all `RUN` steps would run in whatever default directory the base Playwright image provides (which is not `/app/env`).

```suggestion
WORKDIR /app/env
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(envs): migrate remaining envs to uv ..." | Re-trigger Greptile

Comment thread envs/browsergym_env/server/Dockerfile Outdated
@mroyme mroyme force-pushed the fix/461-docker-builds branch from 277a83f to a1c20d9 Compare May 20, 2026 03:38
mroyme added 4 commits May 20, 2026 21:08
Fixes huggingface#461 and applies the
same fixes to browsergym-env, calendar-env, grid-world-env, and carla-env
which are not built in CI.

Changes:
- browsergym-env: replace pip/requirements.txt with uv sync; add
  override-dependencies to resolve beartype cross-platform conflict
- calendar-env: rewrite Dockerfile to echo_env multi-stage uv pattern
- grid-world-env: rewrite Dockerfile to uv multi-stage; fix
  requires-python (>=3.12 → >=3.10) so uv uses the base image Python
  rather than downloading an isolated 3.13 that disappears in the final
  stage; apply try/except fallback for relative model imports (same
  pattern as connect4-env, maze-env, snake-env); remove stale uv.lock
  with broken local path reference
- carla-env: replace pip install calls with uv pip install; add missing
  deps (websockets, numpy, shapely, networkx) to pyproject.toml
- Remove all requirements.txt files superseded by pyproject.toml + uv
- test-docker-builds.sh: add dual-platform support (linux/amd64 +
  linux/arm64 by default, --platform= to override); add browsergym-env,
  grid-world-env, calendar-env to the test matrix; switch env builds from
  docker buildx --load to plain docker build --platform so locally-tagged
  base images are found; improve container start error reporting
- Add .dockerignore for leaner, reproducible builds
- Switch to openenv-core[core] and browsergym-core to avoid dependency
  conflicts with openai and beartype
- Add openai<2 override in uv.lock for compatibility with open_apps
- Update Dockerfile to ensure venv PATH is set for all commands
@mroyme mroyme force-pushed the fix/461-docker-builds branch from f27e4a5 to 05241bc Compare May 20, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant