Commit ce7a20c
authored
QVAC-23466 infra: cut Device Farm cost by serving mobile e2e models from an S3 bucket in the Device Farm region (us-west-2) (#3852)
* QVAC-23466 pilot: point OCR+TTS mobile tests at us-west-2 US model bucket (Android-only)
* QVAC-23466 fix: skip tag propagation in model sync (role lacks s3:GetObjectTagging)
* QVAC-23466 feat: auto-refresh OIDC creds during model sync via credential_process (survive 2h STS cap)
* QVAC-23466 fix: unset (not blank) AWS_PROFILE in credential_process helper
* infra: seed+presign LLM/diffusion mobile models from US bucket (QVAC-23466 pilot)
Pilot: source llm-llamacpp and diffusion-cpp mobile models from the
Device-Farm-local US bucket (us-west-2) instead of huggingface.co.
- New seed-and-presign composite action: mirrors an addon's pinned models
into tether-ai-dev-us if missing (idempotent, sha256-verified) and
presigns them, using an auto-refreshing OIDC credential_process so a
multi-GB first seed survives the 2h STS cap. Runs before the app build.
- LLM: generate-prestage-block.js honors PRESTAGE_URL_MAP to stage from the
US presigned URLs (host-side prestage) instead of HF; HF path unchanged
when the env is absent.
- Diffusion: rewrite models.manifest.json to prepend US presigned URLs
before build (models are fetched on-device from the bundled manifest),
keeping HF/github as fallbacks.
* fix: stream sha256 for >2GB models in mobile model seed (QVAC-23466)
readFileSync throws ERR_FS_FILE_TOO_LARGE past the 2 GiB Buffer cap, so
hash model files in 8 MiB chunks instead. Diffusion/LLM mobile models
reach ~25 GB.
* fix: scope mobile model seed to the on-device subset (QVAC-23466)
Only seed/presign the models a phone actually stages, not the whole
integration manifest:
- LLM: the ~28-model / ~26GB mobile set (union of mobile manifest +
benchmark matrix), computed from the addon's own resolver, skipping the
19-25GB desktop-only builds.
- Diffusion: nearly every image/video test is `skip = isMobile || noGpu`,
so on-device only SD v2.1 (+ tiny ESRGAN asset) download; seed just those
(~2GB) and let the rewritten manifest keep HF fallbacks for the rest.
Adds an optional MODEL_NAMES allowlist to the seed script / composite.
* QVAC-23466 pilot: point ASR mobile tests at us-west-2 US model bucket
ASR is S3-native and already host-side prestages every model (parakeet
GGUFs via adb push/pymobiledevice3, whisper via public HF on the host),
so nothing downloads in-test. Repoint the OIDC region + MODEL_S3_BUCKET
to the us-west-2 mirror (parakeet/indic live under qvac_models_compiled/
ggml/, already mirrored by the EU->US sync job). Runs both Android + iOS.
* QVAC-23466 fix: dedupe embedded URLs in LLM prestage block (Linux 128KB env cap)
The prestage block is passed to the Device Farm upload step as the
EXTRA_PRE_TEST env var. It base64-embedded a manifest keyed testName ->
[{name,url}], so each model URL was repeated across ~70+ test entries.
With the pilot's presigned US-bucket URLs (~900-1200 chars each) that blob
hit ~259KB, exceeding Linux MAX_ARG_STRLEN (128KB per env string) on the
self-hosted Android runner -> execve E2BIG ("Argument list too long").
iOS (macOS) has no such per-string cap, so only Android broke.
Embed a normalised { urls: {name:url}, tests: {testName:[name]} } instead
so every URL appears once; the host-side parser rebuilds the same deduped
prestage list. Block drops to ~57KB. Shrinks the HF path too; no behaviour
change for existing callers.
* QVAC-23466 pilot: point vla/translation/embed mobile tests at us-west-2 US bucket
Roll the US-mirror pilot out to the remaining mobile addons that download
models during the Device Farm run:
- vla-ggml (S3-native): presign SmolVLA + GR00T against tether-ai-dev-us in
us-west-2 instead of the cross-region EU bucket.
- translation-nmtcpp (S3-native): presign IndicTrans against the US bucket;
Bergamot stays on its public Firefox CDN.
- embed-llamacpp (HF-bound): add the seed-and-presign step (mirrors the 2
mobile models into the US bucket, ~0.9GB) + PRESTAGE_URL_MAP so the host
stages from us-west-2 instead of huggingface.co, matching the llm pattern.
All of these models live under qvac_models_compiled/, already mirrored by the
EU->US sync job. Out of scope (documented in the PR): audiogen (on-device
registry download, not workflow-wirable), bci-whispercpp / classification-ggml
(models bundled into the app at build time -> runner cost, not device-minutes),
decoder-audio / inference-addon-cpp / model-fit (no on-device model download).
* QVAC-23466 pilot: restore OCR + TTS iOS matrix coverage
The initial OCR/TTS pilot commit trimmed their default functional matrices to
Android-only to save device-minutes while measuring. That was a testing
convenience, not part of the US-bucket migration -- restore the iOS entries so
this PR changes only the model source (EU/HF -> us-west-2 US bucket) and leaves
test coverage untouched. Any matrix reduction is a separate, explicit decision.
* QVAC-23466: validate seed model names, live-default sync, trim comments
- security: reject path-traversal / absolute model names in seed-and-presign.mjs
before they build an S3 key or local path (the names come from a PR-controlled
manifest and the seed runs on shared self-hosted runners).
- sync-models-to-s3: default a manual dispatch to a live add-only sync (dry run
is now an explicit opt-in); the sync only copies missing objects and never
deletes, so a live default is safe.
- strip verbose/narrative comments across the seed action, the pilot workflows,
and the prestage generators, keeping only non-obvious rationale.
* QVAC-23466 fix: restore ASR OIDC trust-policy phrase
ci-trust-policy.test.mjs asserts integration-mobile-test-asr-ggml.yml contains
"release environment authorizes GitHub OIDC". The earlier comment trim dropped
that phrase; restore it (keeping the concise US-bucket note) so policy-tests pass.
* QVAC-23466 test: address seed/presign review comments
- seed-and-presign: wrap per-model download/verify/upload in try/finally so
partial multi-GB files are always removed, even when a model fails (no disk
leak on shared self-hosted runners); move workDir cleanup into a finally too.
- llm prestage generator: extract normalizeManifest + expandPrestageList as the
single source of truth and embed the parser into the host prelude via
.toString() so CI and Device Farm can never drift; add round-trip unit tests.
- Add unit tests for validateModelName (path-traversal rejection), rewriteManifest,
and the PRESTAGE_URL_MAP override path (llm + embed); wire the new
seed-and-presign action tests into on-pr-shared-ci-infra.
* QVAC-23466 fix: address seed/presign review (mask, fetch allowlist, single-writer)
Ian's review on the mobile US-bucket seeding:
- Mask presigned URLs on the runner (seed action) and scrub AWS SigV4
credentials (X-Amz-Signature/Credential/Security-Token) from the world-
readable console-logs artifacts before upload.
- Treat the seeded manifest URLs as untrusted input: restrict the fetch to
https on huggingface.co/github.com, add proto-redir + a `--` terminator, and
fail closed when a model omits its sha256/bytes pins.
- Presign after all seeding completes (not inside the loop) so no URL ages while
other multi-GB models download; carry the pinned upstream URL as an on-device
fallback for llm/embed; let diffusion's on-device retry rotate to the fallback
on a 403/404.
- Split seeding from presigning: one non-matrixed seed-models job mirrors the
objects (single writer, no concurrent-write race across the platform legs) and
each leg presigns for itself (fresh URLs, no cross-job secret).
* QVAC-23466 fix: setup node in standalone seed-models jobs
The new non-matrixed seed-models job runs the seed action (node) directly, but
node is job-managed on the self-hosted runners (only on PATH after setup-node).
embed/diffusion lacked the step so seeding failed with "node: command not found";
add Setup Node before the seed action (llm already had it for its compute step).1 parent 8475a37 commit ce7a20c
21 files changed
Lines changed: 1238 additions & 113 deletions
File tree
- .github
- actions/run-mobile-integration-tests
- collect-and-upload-logs
- seed-and-presign-models
- test
- workflows
- packages
- diffusion-cpp/test/integration
- embed-llamacpp/scripts
- __tests__
- llm-llamacpp/scripts
- __tests__
Lines changed: 35 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
431 | 466 | | |
432 | 467 | | |
433 | 468 | | |
| |||
Lines changed: 129 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
0 commit comments