Skip to content

fix(space): install only what the server imports, and declare the right port - #1

Merged
OfficialAbhinavSingh merged 1 commit into
mainfrom
fix/space-deploy-config
Sep 2, 2026
Merged

fix(space): install only what the server imports, and declare the right port#1
OfficialAbhinavSingh merged 1 commit into
mainfrom
fix/space-deploy-config

Conversation

@OfficialAbhinavSingh

Copy link
Copy Markdown
Owner

The image installed a training stack it never runs

requirements.txt went into the Space image, and it includes torch, transformers, trl, datasets and matplotlib. Nothing served imports any of them — the full closure reachable from server/app.py is:

server/app.py -> env, executor, graders, leaderboard, models, tasks
third-party:     fastapi, uvicorn, pydantic, duckdb

grep for torch|trl|transformers|datasets|matplotlib across every served module returns nothing. They belong to train.py and scripts/ablation.py, neither of which the image runs.

Measured, same Dockerfile otherwise:

before after
build still installing at 5+ min 16.6s
image never finished 633MB
cold start serves in 2s

Requirements are now one definition, not two

requirements-serve.txt holds the serving set; requirements.txt includes it with -r instead of repeating it. A hand-copied subset would drift the moment a version changed on one side. Every other dependency stays declared exactly as before.

The port was never actually declared

Front matter said app_file: server/app.py. app_file is a Gradio/Streamlit field and is ignored when sdk: docker — so no port was declared at all. It worked only because 7860 is the default and the Dockerfile happens to serve there. Now app_port: 7860, matching openenv.yaml's deployment.port and the Dockerfile's EXPOSE.

Discoverability

Adds agent-environment and rl-environment. That is how the OpenEnv catalog and the Spaces category filter find community environments; without them this env is invisible to anyone browsing. Checked against three published community environments (EnvArchitects/RecruitmentEnv, bpHigh/financial-task-env, sammy-1904/devops-incident-env) — all three carry both.

Validation

Built and run locally, not just configured:

  • docker build — 16.6s, 633MB
  • container up in 2s; /, /tasks, /reset, /step, /state all HTTP 200 with valid JSON
  • a real /step with an optimized rewrite returned reward.score 0.1633 and correctly gave zero for speedup and correctness, because the query I submitted referenced a column that does not exist: Binder Error: Table "o" does not have a column named "order_id". The execution-grounded reward does what it claims — a plausible-looking rewrite that does not run earns nothing.

Not changed

openenv-core, pyyaml and requests are declared but imported nowhere in the repo. Left alone: the env is OpenEnv-compliant by implementing the HTTP contract rather than by importing the library, and pruning declared dependencies from a compliance-claiming environment is a separate decision.

…ht port

The Space image installed torch, transformers, trl, datasets and matplotlib.
No served module imports any of them: the whole dependency closure reachable
from server/app.py is fastapi, uvicorn, pydantic and duckdb, plus the standard
library. They are training dependencies, used by train.py and scripts/ablation.py,
and the image never runs either.

Measured before and after, same Dockerfile otherwise: the image now builds in
17 seconds at 633 MB, where before it was still installing after five minutes.

requirements-serve.txt holds that serving set and requirements.txt includes it
with -r rather than repeating it, so the image and the full install cannot
disagree about a version. Everything else stays declared exactly as it was.

The front matter also said app_file: server/app.py. app_file is a Gradio and
Streamlit field and is ignored when sdk is docker, so the port was never
declared at all -- it only worked because 7860 happens to be the default and
the Dockerfile serves there. It now says app_port: 7860, matching
openenv.yaml's deployment.port and the Dockerfile's EXPOSE.

Adds the agent-environment and rl-environment tags, which is how the OpenEnv
catalog and the Spaces filter find community environments. Checked against
three published community environments, which all carry both.
@OfficialAbhinavSingh
OfficialAbhinavSingh merged commit bb76742 into main Sep 2, 2026
1 check passed
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