seriffic Claude Opus 4.7 (1M context) commited on
Commit
94e4c67
·
1 Parent(s): eea4d6e

docs: refresh droplet runbook for May 9 state

Browse files

- Mark scripts/update_hf_env.sh + scripts/redeploy.sh as landed (was a 'gap')
- Add RIPRAP_NYCHA_REGISTERS=1 to the post-redeploy env block (without
it the FSM never attaches step_nycha / step_doe_schools / step_doh_hospitals)
- Document the May 9 source-committed droplet fixes:
* _build_chip_tensor 5-D handling for eo_chip_cache chips
* TerraMind synthesis adapter via /v1/terramind dispatch
Both inherit on destroy + redeploy via scripts/deploy_droplet.sh
- Bump 'Last verified' to 2026-05-09 with all three terramind paths
+ prithvi_eo_live confirmed firing in the live trace

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files changed (1) hide show
  1. docs/DROPLET-RUNBOOK.md +45 -10
docs/DROPLET-RUNBOOK.md CHANGED
@@ -1,6 +1,13 @@
1
  # Droplet Runbook
2
 
3
- _Last verified: 2026-05-06 (live introspection of droplet 569363721)_
 
 
 
 
 
 
 
4
 
5
  ## Spec
6
 
@@ -44,9 +51,11 @@ be a leftover placeholder, not load-bearing for Riprap.
44
  | `scripts/save_droplet_image.sh` | Commits the running container, saves + compresses to a local tarball via scp. Useful as a fallback if the public-base Dockerfile rebuild fails. | Complete but **moot** once the bootstrap droplet is destroyed — requires a live droplet to extract from. |
45
  | `scripts/probe_addresses.py` | End-to-end test against `/api/agent/stream` on the HF Space. 5/5 must pass before merging. | Not a droplet-setup script; it tests the full system end-to-end. |
46
 
47
- **Gap:** No `update_hf_env.sh` exists. Updating HF Space env vars after a redeploy (new IP
48
- or new token) is a manual `huggingface-cli space variables` command — see §Required
49
- secrets below. This would be a good script to add.
 
 
50
 
51
  **Gap:** No `redeploy.sh` wrapper exists. `deploy_droplet.sh` handles bring-up on a fresh
52
  droplet but does not handle the HF Space variable update or the post-deploy probe run.
@@ -354,11 +363,17 @@ huggingface-cli space variables \
354
  RIPRAP_LLM_API_KEY="$TOKEN" \
355
  RIPRAP_ML_BACKEND=remote \
356
  RIPRAP_ML_BASE_URL="http://${NEW_IP}:${MODELS_PORT}" \
357
- RIPRAP_ML_API_KEY="$TOKEN"
 
358
 
359
  huggingface-cli space restart lablab-ai-amd-developer-hackathon/riprap-nyc
360
  ```
361
 
 
 
 
 
 
362
  ## Health check
363
 
364
  Two curl commands that confirm both services are live:
@@ -390,12 +405,32 @@ For a full end-to-end check via the HF Space:
390
  # Want: 5/5 PASS
391
  ```
392
 
393
- ## Gaps in existing scripts
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
 
395
- | Missing script | What it needs to do |
396
- |----------------|---------------------|
397
- | `scripts/update_hf_env.sh` | Accept `<ip> <token>` args, run `huggingface-cli space variables` to update `RIPRAP_LLM_BASE_URL`, `RIPRAP_LLM_API_KEY`, `RIPRAP_ML_BASE_URL`, `RIPRAP_ML_API_KEY`, then restart the Space. Called as the last step after a successful `deploy_droplet.sh`. |
398
- | `scripts/redeploy.sh` | Thin orchestrator: generate a fresh token, call `deploy_droplet.sh <ip> <token>`, then call `update_hf_env.sh <ip> <token>`, then run `probe_addresses.py` against the live Space to confirm 5/5. Reduces a 4-step redeploy to one command. |
399
 
400
  `save_droplet_image.sh` is complete but only useful while a working droplet is alive.
401
  The bootstrap droplet was destroyed 2026-05-06; this script cannot recover from that.
 
1
  # Droplet Runbook
2
 
3
+ _Last verified: 2026-05-09 (terramind synthesis + LoRA adapters confirmed firing live)_
4
+
5
+ > **Quick redeploy:** `HF_TOKEN=<write-token> scripts/redeploy.sh <new-droplet-ip>`
6
+ > generates a fresh bearer token, builds + brings up vLLM + riprap-models, updates
7
+ > the HF Space env vars, restarts the Space, and runs the end-to-end probe.
8
+ > Source-committed fixes (e.g. the May 9 terramind chip-tensor + synthesis
9
+ > patches) are inherited automatically because `deploy_droplet.sh` tars
10
+ > `services/riprap-models/` from this repo at run time.
11
 
12
  ## Spec
13
 
 
51
  | `scripts/save_droplet_image.sh` | Commits the running container, saves + compresses to a local tarball via scp. Useful as a fallback if the public-base Dockerfile rebuild fails. | Complete but **moot** once the bootstrap droplet is destroyed — requires a live droplet to extract from. |
52
  | `scripts/probe_addresses.py` | End-to-end test against `/api/agent/stream` on the HF Space. 5/5 must pass before merging. | Not a droplet-setup script; it tests the full system end-to-end. |
53
 
54
+ _Previously a gap; now landed:_ `scripts/update_hf_env.sh` automates updating HF
55
+ Space variables (`RIPRAP_LLM_BASE_URL`, `RIPRAP_ML_BASE_URL`, `RIPRAP_NYCHA_REGISTERS`,
56
+ etc.) and restarting the Space. `scripts/redeploy.sh` orchestrates the three-step
57
+ sequence (deploy droplet → update HF Space env → run end-to-end probe) into one
58
+ command.
59
 
60
  **Gap:** No `redeploy.sh` wrapper exists. `deploy_droplet.sh` handles bring-up on a fresh
61
  droplet but does not handle the HF Space variable update or the post-deploy probe run.
 
363
  RIPRAP_LLM_API_KEY="$TOKEN" \
364
  RIPRAP_ML_BACKEND=remote \
365
  RIPRAP_ML_BASE_URL="http://${NEW_IP}:${MODELS_PORT}" \
366
+ RIPRAP_ML_API_KEY="$TOKEN" \
367
+ RIPRAP_NYCHA_REGISTERS=1
368
 
369
  huggingface-cli space restart lablab-ai-amd-developer-hackathon/riprap-nyc
370
  ```
371
 
372
+ `RIPRAP_NYCHA_REGISTERS=1` is required for the FSM to attach `step_nycha`,
373
+ `step_doe_schools`, `step_doh_hospitals` — without it, the Keystone Stone is
374
+ missing those three specialists in the per-query trace. (`scripts/update_hf_env.sh`
375
+ sets this automatically.)
376
+
377
  ## Health check
378
 
379
  Two curl commands that confirm both services are live:
 
405
  # Want: 5/5 PASS
406
  ```
407
 
408
+ ## Source-committed droplet fixes (May 9 2026)
409
+
410
+ Two patches landed in `services/riprap-models/main.py` after a live debugging
411
+ session against a running droplet. They are committed to source, so the next
412
+ `scripts/deploy_droplet.sh` (or `scripts/redeploy.sh`) bring-up will inherit
413
+ them automatically — the build context is tarred from this repo at run time.
414
+
415
+ | Patch | Problem | Fix |
416
+ |-------|---------|-----|
417
+ | `_build_chip_tensor` shape handling | The HF Space's `eo_chip_cache` ships chips at `(B, C, T, H, W)` 5-D; the droplet assumed `(C, H, W)` 3-D and called `.unsqueeze(1).repeat(1, 4, 1, 1)`, raising `RuntimeError: Number of dimensions of repeat dims can not be smaller than number of dimensions of tensor`. Every TerraMind LoRA request silently failed. | `_build_chip_tensor` now branches on `ndim`: 5-D passes through, 4-D adds batch, 3-D expands to T=4 and adds batch. |
418
+ | TerraMind synthesis remote dispatch | `_terramind_inference` only knew `lulc` / `buildings` adapters. `synthesis` (the IBM/NASA v1 base DEM→LULC generative path) had no remote handler, so the HF specialist always fell through to its local terratorch path and crashed on `torchvision::nms` (HF's CPU torch can't load torchvision's C extension). | `_TERRAMIND_SPECS["synthesis"]` + `_load_terramind_synthesis` (FULL_MODEL_REGISTRY build of `terratorch_terramind_v1_base_generate`) + `_terramind_synthesis_inference` (DEM-only 4-D input, 10-class ESRI LULC output). `TerramindIn` schema relaxed so `s2` is optional. |
419
+
420
+ After a destroy + redeploy you can verify both with:
421
+
422
+ ```bash
423
+ # Beach Channel single-address — single_address full activation
424
+ .venv/bin/python scripts/probe_addresses.py \
425
+ --base https://lablab-ai-amd-developer-hackathon-riprap-nyc.hf.space \
426
+ --addresses "2508 Beach Channel Drive, Queens" \
427
+ --timeout 240
428
+ ```
429
 
430
+ Want all three TerraMind paths firing in the trace (`terramind_lulc`,
431
+ `terramind_buildings`, `terramind_synthesis`) along with `prithvi_eo_live`
432
+ and `eo_chip_fetch`. All four EO specialists lazy-load on first request,
433
+ so the first probe pays cold-load (~30-90 s); subsequent probes are warm.
434
 
435
  `save_droplet_image.sh` is complete but only useful while a working droplet is alive.
436
  The bootstrap droplet was destroyed 2026-05-06; this script cannot recover from that.