hf-space-recovery

Diagnose and recover failing or stuck Hugging Face Space deployments for OpenEnv environments. Use when deploying envs from `envs/` to the Hub (`openenv`…

npx skills add https://github.com/huggingface/openenv --skill hf-space-recovery

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:

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.
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:

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:

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:

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:

hf spaces info openenv/<space-id> --expand=runtime
curl -sS -m 10 https://<space-subdomain>.hf.space/health

Then verify fleet-wide:

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:

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.

Thêm skills từ huggingface

cpu-kernels
huggingface
Cung cấp hướng dẫn về việc viết, tối ưu hóa và đánh giá hiệu năng các nhân CPU C++ với SIMD intrinsics (AVX2/AVX512) cho hệ sinh thái nhân của Hugging Face. Bao gồm…
official
generate-openenv-env
huggingface
Tạo môi trường OpenEnv từ một trường hợp sử dụng cụ thể (ví dụ: "tạo môi trường cho thư viện textarena"). Sử dụng khi được yêu cầu thiết kế hoặc triển khai một…
official
hf-mcp
huggingface
Sử dụng Hugging Face Hub qua các công cụ máy chủ MCP. Tìm kiếm mô hình, bộ dữ liệu, Spaces, bài báo. Lấy chi tiết kho lưu trữ, tải tài liệu, chạy tác vụ tính toán và sử dụng Gradio…
official
trl-training
huggingface
Huấn luyện và tinh chỉnh các mô hình ngôn ngữ transformer bằng TRL (Transformers Reinforcement Learning). Hỗ trợ huấn luyện SFT, DPO, GRPO, KTO, RLOO và Reward Model…
official
deploy-hf
huggingface
Triển khai môi trường OpenEnv lên Hugging Face Spaces. Sử dụng khi được yêu cầu triển khai, đẩy lên Hugging Face, hoặc cập nhật một space.
official
pre-submit-pr
huggingface
Xác thực các thay đổi trước khi gửi pull request. Chạy các kiểm tra toàn diện bao gồm lint, kiểm thử, đánh giá sự phù hợp và phân tích RFC. Sử dụng trước khi tạo…
official
example-skill
huggingface
Kỹ năng fixture mẫu để kiểm thử hành động
official
cuda-kernels
huggingface
Cung cấp hướng dẫn để viết và đánh giá hiệu năng các nhân CUDA tối ưu hóa cho GPU NVIDIA (H100, A100, T4) nhắm đến các bộ khuếch tán và máy biến áp của HuggingFace…
official