Repository navigation
feat(usai-provider): self-register provider facts + own normalizer + vendored fallback (ADR 0004 Layer 1) #424
Description
Summary
Layer 1 of ADR 0004 (integrations/isolation/docs/decisions/0004-neutral-model-provider-discovery.md, PR #423). This is the first buildable slice — independently useful and testable even before Layer 2 (the models orchestrator kit) exists.
Scope
-
Self-registration facts file.
usai-provider'sstartupphase writes a small, static JSON facts file to/var/lib/acq/models/providers/usai.json:{ "schemaVersion": "acq-provider-facts/v1", "providerId": "usai", "host": "api.gsa.usai.gov", "baseUrl": "https://api.gsa.usai.gov/api/v1", "modelsUrl": "https://api.gsa.usai.gov/api/v1/models", "keyEnv": "USAI_API_KEY" }/var/lib/acq/is root-owned (mirrors the existing kit-env marker convention,acq.backends/msb.sh:1571in quickstart) — not agent-writable, so a compromised agent process cannot plant a bogus provider entry. -
Env-var-ownership invariant (security-load-bearing, from the ADR's incorporated dissent).
keyEnvMUST name a variable this SAME kit's ownspec.yamlenvironment:/secret-binding declares. Add ascripts/verifyassertion (or avalidate-kits.pycheck) that fails if the facts file'skeyEnvdoesn't match the kit's own declared name — this is the mechanical check that prevents a provider kit from ever naming a credential it doesn't own. -
Provider's own normalizer. A small script (raw USAi
/modelsresponse → the neutral catalog schema defined in ADR 0004) ships insideusai-provider's own kit directory. This can reuse/extract logic from the existingscripts/sync-usai-models.mjsrather than starting from scratch. -
Provider's own vendored fallback snapshot. A small, committed, last-known-good model list, used when live refresh fails (this issue doesn't build the refresh mechanism yet — Layer 2 does — but the snapshot file and its shape should exist so Layer 2 has something to fall back to on day one).
Explicitly out of scope for this issue
- The models orchestrator kit itself (separate issue, Layer 2).
- Any change to
usai-provider's existingopencode.jsoncrendering — unaffected until Layer 3 wires the harness kit to read the new neutral aggregate. - goose-server migration (separate issue once this lands, to fix the confirmed
usai/goose-usaisecret-duplication bug via the SAME provider identity).
Verification
sh -n/shellcheck --severity=warningon any new script.scripts/scan_unsafe_shell.pyon any new script.validate-kits.py --strict(kit still valid).- Live
RUN_ACQ=1 scripts/verify: assert the facts file exists at the expected path post-boot, has the expected shape, andkeyEnvmatches the kit's own declared env var name.
References
- ADR 0004: docs(isolation): add ADR 0004 for neutral model-provider discovery #423
- Confirmed secret-duplication bug this eventually fixes (Layer 1 lays the groundwork; full fix lands when goose-server migrates):
usai-providerregisters serviceusai; in-flightgoose-serverindependently registers the same USAi credential asgoose-usai— traced viaacq.backends/secret-store.sh's_acq_secret_key(dedupes by service-name string only, never by host).
Activity
[-]feat(usai-provider): self-register provider facts + own normalizer + vendored fallback (ADR 0003 Layer 1)[/-][+]feat(usai-provider): self-register provider facts + own normalizer + vendored fallback (ADR 0004 Layer 1)[/+]