fix(space): install only what the server imports, and declare the right port - #1
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The image installed a training stack it never runs
requirements.txtwent into the Space image, and it includestorch,transformers,trl,datasetsandmatplotlib. Nothing served imports any of them — the full closure reachable fromserver/app.pyis:grepfortorch|trl|transformers|datasets|matplotlibacross every served module returns nothing. They belong totrain.pyandscripts/ablation.py, neither of which the image runs.Measured, same Dockerfile otherwise:
Requirements are now one definition, not two
requirements-serve.txtholds the serving set;requirements.txtincludes it with-rinstead 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_fileis a Gradio/Streamlit field and is ignored whensdk: docker— so no port was declared at all. It worked only because 7860 is the default and the Dockerfile happens to serve there. Nowapp_port: 7860, matchingopenenv.yaml'sdeployment.portand the Dockerfile'sEXPOSE.Discoverability
Adds
agent-environmentandrl-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/,/tasks,/reset,/step,/stateall HTTP 200 with valid JSON/stepwith an optimized rewrite returnedreward.score 0.1633and 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,pyyamlandrequestsare 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.