Misbahuddin Claude Opus 4.8 (1M context) commited on
Commit
04a389a
·
1 Parent(s): 438e8e8

Phase 5 prep: harden eval CI against the HF-429 judge flake

Browse files

Deploy-readiness audit + CI hygiene ahead of the Hugging Face Docker Space.

The live LLM-judge step was blocking and twice reddened the workflow on a
transient HF-Hub HTTP 429 while pulling the all-MiniLM-L6-v2 embedding model
during build_index. The deterministic safety gate (the real blocking gate)
always passed; only the advisory judge flaked on an external dependency.

- Make the judge step continue-on-error (advisory). Per this repo's own design,
only the deterministic gate may fail the build; the nondeterministic live
model and its external deps (HF Hub, Anthropic API) must never gate.
- Cache ~/.cache/huggingface (actions/cache) so the embedding model isn't
re-downloaded every run — removes the 429 root cause on warm caches.

Same model download happens in the Space's Docker build (build_index), so a
transient 429 there is a one-shot rebuild, not a code bug — documented in STATUS.

Build readiness verified: README HF frontmatter (sdk: docker, port 7860),
multi-stage Dockerfile, frontend/package-lock.json (npm ci), api.py imports no
eval/ dep, requirements has fastapi+uvicorn. React stage builds clean locally.

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

Files changed (2) hide show
  1. .github/workflows/eval.yml +15 -0
  2. STATUS.md +46 -17
.github/workflows/eval.yml CHANGED
@@ -36,10 +36,25 @@ jobs:
36
  - name: Deterministic safety gate (free, blocking)
37
  run: python -m eval.run_eval --deterministic-only
38
 
 
 
 
 
 
 
 
 
 
 
39
  # Live layers run only if the secret is present. Builds the policy/precedent index first
40
  # (local embeddings, no key needed), then triages a 5-case subset with the LLM-as-judge.
 
 
 
 
41
  - name: LLM-judge on a subset (only if ANTHROPIC_API_KEY is set)
42
  if: ${{ env.ANTHROPIC_API_KEY != '' }}
 
43
  run: |
44
  python -m scripts.build_index
45
  python -m eval.run_eval --judge --limit 5 --strict
 
36
  - name: Deterministic safety gate (free, blocking)
37
  run: python -m eval.run_eval --deterministic-only
38
 
39
+ # Cache the local embedding model so the judge step's build_index doesn't re-download it from
40
+ # the HF Hub on every run (that download has rate-limited to HTTP 429 and is the only thing
41
+ # that has ever reddened this workflow). Cold cache still downloads; a warm cache skips it.
42
+ - name: Cache embedding model (all-MiniLM-L6-v2)
43
+ if: ${{ env.ANTHROPIC_API_KEY != '' }}
44
+ uses: actions/cache@v4
45
+ with:
46
+ path: ~/.cache/huggingface
47
+ key: hf-${{ runner.os }}-all-MiniLM-L6-v2
48
+
49
  # Live layers run only if the secret is present. Builds the policy/precedent index first
50
  # (local embeddings, no key needed), then triages a 5-case subset with the LLM-as-judge.
51
+ # ADVISORY, not blocking (continue-on-error): per this repo's design the *deterministic* gate
52
+ # above is the only thing that may fail the build. The live model is nondeterministic and its
53
+ # external deps (HF Hub, Anthropic API) can flake, so it must never gate. Results are still
54
+ # uploaded below; a real judge regression surfaces there, not as a red required check.
55
  - name: LLM-judge on a subset (only if ANTHROPIC_API_KEY is set)
56
  if: ${{ env.ANTHROPIC_API_KEY != '' }}
57
+ continue-on-error: true
58
  run: |
59
  python -m scripts.build_index
60
  python -m eval.run_eval --judge --limit 5 --strict
STATUS.md CHANGED
@@ -252,12 +252,16 @@ gate's invariants become a CI gate. New/changed:
252
  if `ANTHROPIC_API_KEY` is set** (so forks/unconfigured repos stay green and the model never gates
253
  the build). Results uploaded as an artifact.
254
 
255
- **Verified:** `eval.run_eval --deterministic-only` → **10/10**, exit 0, fully offline (no key, no
256
- index, agent import kept lazy so the free gate stays light); `build_testset --check` green; live
257
- harness exercised end-to-end (Anthropic 2-case + judge, and a full **free local Ollama** run, zero
258
- spend); `scripts.smoke_test` still 12/12. **CI is fully green on GitHub Actions** — the free
259
- deterministic gate blocks every push, and the `ANTHROPIC_API_KEY` secret is now set, so the **live
260
- judge step ran green in CI** (`build_index` + 5-case triage + judge, `--strict`, 2m31s).
 
 
 
 
261
 
262
  **Repo is on GitHub:** `m-misbahuddin/amana-triage-copilot` (**private**), default branch `main`
263
  carries the full project; work continues on `feature/ts-triage-copilot`. CI: `.github/workflows/eval.yml`.
@@ -314,6 +318,30 @@ substance.
314
  debt-principal showcase APPROVE is preserved. **Not yet re-run:** the full `--judge` Anthropic eval
315
  for the headline video numbers (user action).
316
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  ## AWAITING — user action
318
  - **Build/run the container** (start Docker Desktop): `docker build -t amana .` then
319
  `docker run -p 7860:7860 -e ANTHROPIC_API_KEY=sk-... amana` → open http://localhost:7860.
@@ -334,21 +362,22 @@ for the headline video numbers (user action).
334
  FastAPI console), 3.7 (policy drawer), 4 (eval + CI), and **4.1 (gate hardening)** are **done and
335
  verified** (see the DONE sections above; build log in `docs/DEVLOG.md`). **On GitHub** at
336
  `m-misbahuddin/amana-triage-copilot` (private); work branch `feature/ts-triage-copilot`, full project
337
- also on `main`. **CI is green incl. the live judge step** (secret is set). The two eval findings are
338
- **closed** (gate corroborates hard citations + enforces ELIG-4). **Not yet committed** Phase 4.1
339
- changes are in the working tree (gate.py, run_eval.py, smoke_test.py, STATUS/DEVLOG); commit + push
340
- to re-run CI.
 
341
 
342
  **Pick up here:**
343
- 1. *(commit first)* Commit the Phase 4.1 gate-hardening changes on `feature/ts-triage-copilot` and
344
- push so the CI deterministic gate (now 12 checks) + live judge re-run green.
345
- 2. *(then) **Phase 5 — Deploy.** Create the Hugging Face **Docker** Space; push the repo to its git
346
- remote; set `ANTHROPIC_API_KEY` + `LLM_PROVIDER=anthropic` as Space secrets. Verify
347
- `docker build -t amana .` + `docker run` locally first (start Docker Desktop). See `PLAN.md` §5.
348
- 3. *(user, for the video)* Run a **full Anthropic eval** (`python -m eval.run_eval --judge`) for the
349
  demo's headline numbers — escalation recall / reject precision should now improve on camp-011/012/
350
  018 — and the in-browser click-through; switch to **Ollama** to show the gate firing on a weak model.
351
- 4. *(optional hardening)* the Chroma RustBindings flake noted under Phase 3.5 (the eval harness
352
  already isolates it as an `ERROR` row so it can't tank a run).
353
 
354
  **Progress:** ✅ Phase 1 data · ✅ Phase 2 agent+tools · ✅ Phase 2.5 local-LLM toggle · ✅ Phase 3
 
252
  if `ANTHROPIC_API_KEY` is set** (so forks/unconfigured repos stay green and the model never gates
253
  the build). Results uploaded as an artifact.
254
 
255
+ **Verified:** `eval.run_eval --deterministic-only` → **10/10** (now **12/12** after Phase 4.1),
256
+ exit 0, fully offline (no key, no index, agent import kept lazy so the free gate stays light);
257
+ `build_testset --check` green; live harness exercised end-to-end (Anthropic 2-case + judge, and a
258
+ full **free local Ollama** run, zero spend); `scripts.smoke_test` still 12/12. **CI: the free
259
+ deterministic gate blocks every push and is reliably green**; the `ANTHROPIC_API_KEY` secret is set
260
+ so the **live judge step runs** (`build_index` + 5-case triage + judge, `--strict`). *Caveat (fixed
261
+ in Phase 5 prep):* the judge step was **blocking** and twice reddened the run on a transient HF-Hub
262
+ **HTTP 429** while downloading the embedding model — never a code/safety failure. The judge is now
263
+ **advisory (`continue-on-error`)** + the model is **cached**, matching the design intent that only
264
+ the deterministic gate gates the build. See the Phase 5 prep note below.
265
 
266
  **Repo is on GitHub:** `m-misbahuddin/amana-triage-copilot` (**private**), default branch `main`
267
  carries the full project; work continues on `feature/ts-triage-copilot`. CI: `.github/workflows/eval.yml`.
 
318
  debt-principal showcase APPROVE is preserved. **Not yet re-run:** the full `--judge` Anthropic eval
319
  for the headline video numbers (user action).
320
 
321
+ ## What's IN PROGRESS — Phase 5: Deploy prep 🛠️ (2026-06-06)
322
+
323
+ **Build-readiness audited before handing the image to Hugging Face.** No new app code — verifying the
324
+ container will actually build, and hardening the one thing that has ever flaked.
325
+ - **Verified ready:** README HF frontmatter (`sdk: docker`, `app_port: 7860`) ✓; multi-stage
326
+ `Dockerfile` + `.dockerignore` ✓; `frontend/package-lock.json` present so `npm ci` works ✓;
327
+ `api.py` imports only `fastapi`/`pydantic`/`src.*` (no `eval/` dep — Dockerfile correctly omits
328
+ `eval/`) ✓; `requirements.txt` has fastapi + uvicorn[standard] + anthropic + chromadb ✓.
329
+ - **Stage 1 (React) builds clean locally** (`npm run build` → 1535 modules, dist emitted).
330
+ - **Stage 2 (`build_index`)** proven by the smoke suite (local embeddings, no key).
331
+ - **CI hardening (`.github/workflows/eval.yml`):** the live judge step was *blocking* and twice
332
+ reddened the workflow on a transient **HF-Hub HTTP 429** while pulling `all-MiniLM-L6-v2` (the
333
+ deterministic gate always passed). Fixed: judge is now **`continue-on-error`** (advisory — only the
334
+ deterministic gate blocks, matching the workflow's own stated design) and the model is **cached**
335
+ (`actions/cache` on `~/.cache/huggingface`) to avoid the 429 across runs.
336
+ - **⚠ Deploy-build risk (same root cause):** the Space's Docker build runs the *same* `build_index`
337
+ → *same* `all-MiniLM-L6-v2` download. A 429 during the HF Space build would fail the build the same
338
+ way — it's a one-shot build, so **just rebuild the Space** if it hits a transient 429 (or build the
339
+ image locally first, where the model layer caches). Not a code bug.
340
+
341
+ **Remaining (needs Docker Desktop running / an HF account — user actions):** local `docker build` +
342
+ `docker run` smoke; create the HF **Docker** Space; set `ANTHROPIC_API_KEY` + `LLM_PROVIDER=anthropic`
343
+ as Space secrets; add the Space git remote and push. Recipe in `PLAN.md` §5b.
344
+
345
  ## AWAITING — user action
346
  - **Build/run the container** (start Docker Desktop): `docker build -t amana .` then
347
  `docker run -p 7860:7860 -e ANTHROPIC_API_KEY=sk-... amana` → open http://localhost:7860.
 
362
  FastAPI console), 3.7 (policy drawer), 4 (eval + CI), and **4.1 (gate hardening)** are **done and
363
  verified** (see the DONE sections above; build log in `docs/DEVLOG.md`). **On GitHub** at
364
  `m-misbahuddin/amana-triage-copilot` (private); work branch `feature/ts-triage-copilot`, full project
365
+ also on `main`. Phase 4.1 gate hardening is **committed + pushed** (`438e8e8`) and **CI passed**
366
+ (12-check deterministic gate + judge both green on that run). The two eval findings are **closed**
367
+ (gate corroborates hard citations + enforces ELIG-4). **Phase 5 deploy prep is underway** — see the
368
+ "Phase 5: Deploy prep" section above; CI judge step hardened against the HF-429 flake (advisory +
369
+ cached). The eval.yml/STATUS/DEVLOG deploy-prep edits may be uncommitted in the working tree.
370
 
371
  **Pick up here:**
372
+ 1. *(Phase 5 — Deploy, user actions)* Start Docker Desktop and run `docker build -t amana .` +
373
+ `docker run -p 7860:7860 -e ANTHROPIC_API_KEY=sk-... amana` open http://localhost:7860 to smoke
374
+ the container. Then create the Hugging Face **Docker** Space, set `ANTHROPIC_API_KEY` +
375
+ `LLM_PROVIDER=anthropic` as Space secrets, add the Space git remote, and push. See `PLAN.md` §5b.
376
+ *(If the Space build hits a transient HF-Hub 429 on the embedding-model pull, just rebuild it.)*
377
+ 2. *(user, for the video)* Run a **full Anthropic eval** (`python -m eval.run_eval --judge`) for the
378
  demo's headline numbers — escalation recall / reject precision should now improve on camp-011/012/
379
  018 — and the in-browser click-through; switch to **Ollama** to show the gate firing on a weak model.
380
+ 3. *(optional hardening)* the Chroma RustBindings flake noted under Phase 3.5 (the eval harness
381
  already isolates it as an `ERROR` row so it can't tank a run).
382
 
383
  **Progress:** ✅ Phase 1 data · ✅ Phase 2 agent+tools · ✅ Phase 2.5 local-LLM toggle · ✅ Phase 3