fix: pin fastapi>=0.116.0 to prevent starlette 0.46+ incompatibility - #810
Conversation
|
Fixes the failing CI run: https://github.com/huggingface/OpenEnv/actions/runs/27136794124/job/80091698241 |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Pull request overview
This PR addresses a CI/runtime import failure caused by an incompatible FastAPI/Starlette combination when the openapp_env Docker image installs dependencies in multiple pip install steps. The fix enforces fastapi>=0.116.0 so that installing/upgrading Starlette to 0.46+ does not leave FastAPI on a version that still passes the removed on_startup argument into Starlette internals.
Changes:
- Bump OpenEnv’s minimum FastAPI version to
>=0.116.0inpyproject.toml(bothdependenciesand[project.optional-dependencies].core). - Ensure the
openapp_envDockerfile’s post-install upgrade step also upgrades FastAPI to>=0.116.0.
Alignment Review Report
Automated Checks
- Lint: NOT RUN - repository hooks exist (
.claude/hooks/lint.sh) but were not executable from the review tooling surface. - Debug code: NOT RUN - repository hook exists (
.claude/hooks/check-debug.sh) but was not executable from the review tooling surface.
Open RFCs Context
- RFCs 000, 001, 002, 003, and 005 are marked In Review; none appear directly impacted by a dependency floor bump for FastAPI.
Tier 1: Fixes Required
- None identified in the changed diff hunks.
Tier 2: Alignment Discussion
Principle Conflicts
None identified.
RFC Conflicts
None identified.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
pyproject.toml |
Raises the minimum FastAPI version to avoid Starlette 0.46+ incompatibility. |
envs/openapp_env/server/Dockerfile |
Forces FastAPI upgrade in the final dependency reconciliation step to prevent mixed-version installs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| # Ensure fastmcp runtime deps are on compatible versions after all installs. | ||
| RUN pip install --no-cache-dir --upgrade "beartype>=0.22.6" "fastmcp>=2.14.5" | ||
| RUN pip install --no-cache-dir --upgrade "beartype>=0.22.6" "fastmcp>=2.14.5" "fastapi>=0.116.0" |
There was a problem hiding this comment.
Leaving the initial install unpinned here: the final --upgrade ... "fastapi>=0.116.0" step is the actual correctness fix, and pinning the earlier step is only a redundant-download optimization. Not worth the extra churn in this bugfix PR.
|
|
||
| # Ensure fastmcp runtime deps are on compatible versions after all installs. | ||
| RUN pip install --no-cache-dir --upgrade "beartype>=0.22.6" "fastmcp>=2.14.5" | ||
| RUN pip install --no-cache-dir --upgrade "beartype>=0.22.6" "fastmcp>=2.14.5" "fastapi>=0.116.0" |
There was a problem hiding this comment.
Done — bumped envs/openapp_env/pyproject.toml to fastapi>=0.116.0 in a6c0e26 so non-Docker installs of the env are covered too.
| # Heavy dependencies (torch, numpy, smolagents, etc.) should be in | ||
| # individual environment pyproject.toml files | ||
| "fastapi>=0.104.0", | ||
| "fastapi>=0.116.0", |
There was a problem hiding this comment.
Updated the two scaffolding templates (src/openenv/cli/templates/openenv_env/server/requirements.txt and the generate-openenv-env skill asset) to fastapi>=0.116.0 in a6c0e26. The broader sweep of the remaining envs/*/pyproject.toml files (most don't pull in fastmcp/mcp, so they aren't affected by the starlette 0.46 incompatibility) I'll handle in a separate follow-up PR to keep this one focused on the openapp-env CI fix.
Address Copilot review on #810: align openapp_env package dep and the CLI/skill scaffolding templates with the new core minimum so non-Docker and freshly-generated envs can't land on the incompatible fastapi 0.115.x. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
Pins
fastapi>=0.116.0inpyproject.tomland in theopenapp_envDockerfile to prevent a starlette 0.46+ incompatibility. Thebuild-envs (openapp-env)GitHub Actions job wasfailing because the Dockerfile's two-step
pip installpattern could land on fastapi 0.115.x in the first step, then upgrade starlette to 0.46+ via fastmcp/mcp in a second stepwithout re-evaluating fastapi. fastapi <0.116 passes
on_startupto starlette'sRouter.__init__, which was removed in starlette 0.46, causing aTypeErrorat import time.Type of Change
Alignment Checklist
Before submitting, verify:
.claude/docs/PRINCIPLES.mdand this PR aligns with our principles.claude/docs/INVARIANTS.mdand no invariants are violated/pre-submit-pr(orbash .claude/hooks/lint.shand tests) and addressed all issuesRFC Status
Test Plan
The
Build and Push Docker Images / build-envs (openapp-env)job in CI will pass after this change. The fix can be verified by running the openapp_env Docker build locally:Claude Code Review
N/A