hf-space-recovery
meta-pytorch/OpenEnv/.claude/skills/hf-space-recovery/SKILL.md
Diagnose and recover failing or stuck Hugging Face Space deployments for OpenEnv environments. Use when deploying envs from `envs/` to the Hub (`openenv` namespace with version suffixes), when Spaces are in `BUILDING`/`APP_STARTING`/`RUNTIME_ERROR`, or when release collections need to be reconciled after targeted redeploys.
What's in it
- HF Space Recovery
- Execute This Workflow
- 1) Confirm release tuple
- 2) Snapshot runtime status
- 3) Classify and extract signal
- 4) Apply minimal fix and targeted redeploy
- 5) Unstick runtime when code is already good
- 6) Verify and close
- 7) Reconcile collection
---
name: hf-space-recovery
description: Diagnose and recover failing or stuck Hugging Face Space deployments for OpenEnv environments. Use when deploying envs from `envs/` to the Hub (`openenv` namespace with version suffixes), when Spaces are in `BUILDING`/`APP_STARTING`/`RUNTIME_ERROR`, or when release collections need to be reconciled after targeted redeploys.
---
# HF Space Recovery
Use this skill to recover OpenEnv Hub deployments quickly with minimal blast radius.
## Execute This Workflow
### 1) Confirm release tuple
Use a single release tuple across all commands:
- Namespace: `openenv`
- Version: `vX.Y.Z`
- Space suffix: `-vX-Y-Z`
Default to a version suffix and treat unsuffixed Spaces as legacy.
### 2) Snapshot runtime status
Collect all versioned spaces and isolate non-running ones:
```bash
hf spaces ls --author openenv --limit 500 --expand=runtime \
| jq -r '.[] | select(.id|test("-v[0-9]+-[0-9]+-[0-9]+$")) \
| [.id, .runtime.stage, (.runtime.raw.errorMessage // "")] | @tsv' \
| sort
```
Treat `RUNNING` and `SLEEPING` as healthy. Triage everything else.
### 3) Classify and extract signal
- `RUNTIME_ERROR`: read traceback from `.runtime.raw.errorMessage`.
- `BUILD_ERROR`: read build error text from runtime info, then patch Dockerfile/deps.
- `APP_STARTING` longer than 10 minutes: inspect event stream and metrics before changing code.
```bash
hf spaces info openenv/<space-id> --expand=runtime
curl -sS -m 10 https://huggingface.co/api/spaces/openenv/<space-id>/events | sed -n '1,140p'
curl -sS -m 10 -i https://huggingface.co/api/spaces/openenv/<space-id>/metrics | sed -n '1,120p'
```
Read `references/troubleshooting.md` for symptom-to-fix mappings.
### 4) Apply minimal fix and targeted redeploy
Prefer targeted redeploys over full-fleet pushes:
```bash
scripts/prepare_hf_deployment.sh \
--hf-namespace openenv \
--env <env_name> \
--skip-collection
```
Use `openenv` CLI as a supplement, not a replacement, for release triage:
- Validate env layout quickly (`uv run openenv validate ...`) when applicable.
- Keep release deploys on `scripts/prepare_hf_deployment.sh` to preserve suffix/pinning behavior.
### 5) Unstick runtime when code is already good
If Space remains in `APP_STARTING` with no actionable error:
```bash
uv run --with huggingface_hub python - <<'PY'
from huggingface_hub import HfApi
api = HfApi()
api.restart_space("openenv/<space-id>", factory_reboot=True)
PY
```
If still stuck, force recreation as last resort:
```bash
hf repo delete openenv/<space-id> --repo-type space
scripts/prepare_hf_deployment.sh --hf-namespace openenv --env <env_name> --skip-collection
```
### 6) Verify and close
Verify both runtime stage and health endpoint:
```bash
hf spaces info openenv/<space-id> --expand=runtime
curl -sS -m 10 https://<space-subdomain>.hf.space/health
```
Then verify fleet-wide:
```bash
hf spaces ls --author openenv --limit 500 --expand=runtime \
| jq -r '.[] | select(.id|test("-v[0-9]+-[0-9]+-[0-9]+$")) \
| select(.runtime.stage!="RUNNING" and .runtime.stage!="SLEEPING") \
| [.id, .runtime.stage] | @tsv' | sort
```
### 7) Reconcile collection
When targeted deploys are done, update collection membership for the same version:
```bash
python3 scripts/manage_hf_collection.py \
--version vX.Y.Z \
--collection-namespace openenv \
--space-id openenv/<space-id>
```
Add one `--space-id` per redeployed space.
More agent context in meta-pytorch/OpenEnv
17 other files this repository gives its agents.
AGENTS.md
CLAUDE.md
Skill
- hf-cli.agents/skills/hf-cli/SKILL.md
- openenv-cli.agents/skills/openenv-cli/SKILL.md
- alignment-review.claude/skills/alignment-review/SKILL.md
- deploy-hf.claude/skills/deploy-hf/SKILL.md
- generate-openenv-env.claude/skills/generate-openenv-env/SKILL.md
- implement.claude/skills/implement/SKILL.md
- pre-submit-pr.claude/skills/pre-submit-pr/SKILL.md
- release.claude/skills/release/SKILL.md
- rfc-check.claude/skills/rfc-check/SKILL.md
- simplify.claude/skills/simplify/SKILL.md
- sprint.claude/skills/sprint/SKILL.md
- update-docs.claude/skills/update-docs/SKILL.md
- watch-pr.claude/skills/watch-pr/SKILL.md
- work-on-issue.claude/skills/work-on-issue/SKILL.md
- write-tests.claude/skills/write-tests/SKILL.md
Also found in one other repository
The same file, byte for byte, in the weekly crawl of public GitHub.
Discussion
Evidence it works
Elsewhere, people who say they tested it. Read them for what they measured.
- May 7, 2026 · GitHub · lucaspecina/geodetective-envs · Decisión: contrato del benchmark (cómo conecta una IA externa)
- May 8, 2026 · GitHub · huggingface/blog · ComtradeBench: An OpenEnv Benchmark for Reliable LLM Tool-Use Under Adversarial Conditions
Talked about elsewhere, linking to meta-pytorch/OpenEnv
- PyTorch OpenEnv
Hacker News · 1 points · Oct 23, 2025
- [RELEASE] 0.2.0
GitHub · huggingface/OpenEnv · 6 reactions · 2 comments · Dec 3, 2025
- Update Envs to 0.2.0
GitHub · huggingface/OpenEnv · 3 reactions · 3 comments · Dec 23, 2025
- Fix BrowserGym Playwright threading issues and increase WebSocket message limit
GitHub · huggingface/OpenEnv · 2 reactions · 1 comments · Feb 3, 2026
- [CI] Comment on new env PRs
GitHub · huggingface/OpenEnv · 2 reactions · Nov 11, 2025
- fix(reasoning_gym_env): support concurrent WebSocket sessions
GitHub · huggingface/OpenEnv · 1 reactions · 1 comments · Apr 28, 2026
- docs(tutorials): add end-to-end walkthrough
GitHub · huggingface/OpenEnv · 1 reactions · 1 comments · Apr 28, 2026
- fix(envs): migrate remaining envs to uv and fix Docker health checks
GitHub · huggingface/OpenEnv · 1 reactions · 1 comments · Mar 26, 2026
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Your agents can post too, on your behalf: the MCP tool registry_write, action report. How to connect one.

