Repository navigation
feat: load reviewed model catalogue prices at runtime - #10494
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9f808cbf-0350-4a39-8c4b-a3c44851b7d7
Documentation PreviewDocumentation has been built for this PR. To view locally:
Built from commit f1bda57 |
There was a problem hiding this comment.
🔵 Needs a closer look
Default-on fetched pricing and automatic publication affect budget enforcement and retain unresolved correctness and startup risks.
6 open issues
Use deterministic dates in catalogue publication fixtures · New Reject default tariff fallback for incomplete long-context tiers · New Handle socket errors while awaiting catalogue readiness · New Retry catalogue fetch after transient proxy startup failures · New Avoid repeated synchronous catalogue validation during request capture · New Enforce trusted catalogue sources in the configuration schema · New
What changed in this PR
Adds the bounded runtime consumer for the reviewed catalogue publications introduced in #10473, allowing API-proxy pricing to refresh independently of package releases. The broader pricing and eligibility migration remains out of scope.
Changes:
- Adds authenticated retrieval, private caching, refresh/offline controls, and additive
/reflectstate. - Pins catalogue and provider pricing across request guards, fallback selection, and HTTP/WebSocket accounting.
- Packages shared validators and replaces the manual publication flag with automated producer/consumer checks.
| File | Description |
|---|---|
src/types/rate-limit-options.ts |
Defines runtime catalogue options. |
src/services/api-proxy-env-config.ts |
Forwards catalogue configuration to proxies. |
src/services/api-proxy-env-config.test.ts |
Tests configuration forwarding and unchanged proxy routing. |
src/config-mapper.ts |
Maps file-based catalogue settings. |
src/config-file.ts |
Types catalogue settings in configuration files. |
src/config-file-mapping.test.ts |
Tests catalogue option mapping. |
src/commands/build-config.ts |
Carries catalogue options into runtime configuration. |
src/awf-config-schema.json |
Adds runtime configuration validation fields. |
shared/model-information/publication.cjs |
Shares snapshot production and validation logic. |
shared/model-information/publication-contract.cjs |
Centralizes publication envelope and digest contracts. |
scripts/model-information/publication.test.ts |
Tests publication-to-accounting integration and workflow gates. |
scripts/model-information/publication-contract.cjs |
Reuses the shared publication contract. |
scripts/model-information/compile.cjs |
Generates packaged proxy contract files. |
scripts/model-information/build-publication.cjs |
Uses the shared snapshot producer. |
docs/model-catalogue-publication.md |
Documents runtime trust, configuration, and publication gates. |
docs/awf-config.schema.json |
Defines catalogue configuration schema fields. |
docs/awf-config-spec.md |
Documents configuration mapping and pricing precedence. |
docs/adr/0004-model-information-management.md |
Records delivered runtime scope and remaining boundaries. |
containers/api-proxy/websocket-tunnel.js |
Uses connection-pinned pricing for accounting. |
containers/api-proxy/websocket-proxy.js |
Captures pricing before WebSocket guards. |
containers/api-proxy/websocket-guards.js |
Passes pinned pricing into priceability checks. |
containers/api-proxy/upstream-token.js |
Uses request-pinned pricing for response accounting. |
containers/api-proxy/upstream-http.test.js |
Tests request context in fallback checks. |
containers/api-proxy/upstream-http.js |
Carries request context through fallback eligibility. |
containers/api-proxy/token-budget-log.js |
Forwards pricing captures into credit accounting. |
containers/api-proxy/startup.js |
Starts and drains the catalogue loader. |
containers/api-proxy/server.js |
Wires loader lifecycle and readiness. |
containers/api-proxy/server-factory.js |
Delays inference dispatch until initial resolution. |
containers/api-proxy/runtime-model-catalog.js |
Supports captured provider-pricing snapshots. |
containers/api-proxy/proxy-request.js |
Pins pricing for requests and fallback guards. |
containers/api-proxy/proxy-guards.js |
Uses pinned pricing during guard evaluation. |
containers/api-proxy/management.js |
Adds catalogue state to /reflect. |
containers/api-proxy/guards/ai-credits-guard.js |
Integrates central tariffs into pricing resolution. |
containers/api-proxy/Dockerfile |
Includes loader, pricing, and validator files. |
containers/api-proxy/catalogue-proxy.test.js |
Tests readiness, accounting pinning, and packaging. |
containers/api-proxy/catalogue-pricing.js |
Validates and resolves scoped central tariffs. |
containers/api-proxy/catalogue-loader.test.js |
Covers authentication, caching, freshness, and failures. |
containers/api-proxy/catalogue-loader.js |
Implements bounded retrieval, caching, and activation. |
containers/api-proxy/catalogue-contract/schema.v1.json |
Packages the canonical model schema. |
containers/api-proxy/catalogue-contract/publication.v1.schema.json |
Packages the publication schema. |
containers/api-proxy/catalogue-contract/publication.cjs |
Packages snapshot production and validation. |
containers/api-proxy/catalogue-contract/publication-contract.cjs |
Packages envelope and digest checks. |
containers/api-proxy/catalogue-contract/identity.js |
Packages provider-qualified identity helpers. |
containers/api-proxy/catalogue-contract/contracts.js |
Packages schema and semantic validation. |
.github/workflows/publish-model-catalogue.yml |
Gates automatic publication on runtime integration tests. |
Review effort: Max
| const model = structuredClone(baseline.models.find(entry => entry.tariffs?.length)); | ||
| model.identity = { key: 'copilot/loader-test', provider: 'copilot', rawId: 'loader-test', lookupId: 'loader-test' }; | ||
| model.tariffs = [model.tariffs.find(tariff => tariff.tier === 'default')]; | ||
| model.tariffs[0].components.input.price = price; | ||
| return { ...baseline, models: [model] }; |
| isGithubCopilotCatalogTarget(deriveCopilotApiTarget(process.env)); | ||
| const central = provider && copilotScope | ||
| ? resolveCentralPricing(provider, pricingModel, inputTokens, capture) : null; | ||
| if (central) return central; |
| server.on('upgrade', async (req, socket, head) => { | ||
| if (catalogueReady) await catalogueReady; | ||
| if (socket.destroyed) return; | ||
| attachCaller(req, adapter); | ||
| handleUpgrade(req, socket, head); | ||
| }); |
| await refresh(); | ||
| if (!stopped && !timer) { | ||
| timer = setInterval(refresh, interval); | ||
| timer.unref(); | ||
| } |
| function capture() { | ||
| const candidate = active; | ||
| if (!candidate) return null; | ||
| try { validateCandidate(candidate); } catch (error) { | ||
| failure(error, true); | ||
| return null; | ||
| } | ||
| return Object.freeze({ snapshot: candidate.value, time: now(), maxAge, | ||
| source: status.source, revision: candidate.value.revision }); | ||
| } | ||
| function reflect() { | ||
| if (active) { | ||
| try { validateCandidate(active); } catch (error) { failure(error, true); } | ||
| } | ||
| return { ...status, | ||
| ageSeconds: active ? Math.max(0, Math.floor((now() - Date.parse(active.value.publishedAt)) / 1000)) : null }; | ||
| } |
| "source": { | ||
| "type": "string", | ||
| "pattern": "^(github|https://[^\\s]+)$", | ||
| "default": "github" | ||
| }, | ||
| "trustSource": { | ||
| "type": "boolean", | ||
| "default": false | ||
| }, | ||
| "localSnapshot": { | ||
| "type": "object" | ||
| }, |
Load proxy-only transport dependencies only for network retrieval. Read and validate private cache files through one no-follow descriptor. Keep cached source identifiers local during bounded candidate-selected ancestry checks. Add cache replacement, symlink and history-bound regressions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9f808cbf-0350-4a39-8c4b-a3c44851b7d7
|
✅ Copilot review passed with no inline comments. @lpcox Add the |
|
| Metric | Base | PR | Delta |
|---|---|---|---|
| Lines | 93.47% | 93.46% | 📉 -0.01% |
| Statements | 91.91% | 91.90% | ➡️ -0.01% |
| Functions | 91.04% | 91.04% | ➡️ +0.00% |
| Branches | 85.98% | 85.97% | 📉 -0.01% |
📁 Per-file Coverage Changes (2 files)
| File | Lines (Before → After) | Statements (Before → After) |
|---|---|---|
src/nvx/one-shot-adapter.ts |
83.4% → 82.9% (-0.56%) | 80.7% → 80.2% (-0.52%) |
src/enclave/host-executor-server.ts |
91.0% → 91.0% (+0.00%) | 90.0% → 89.7% (-0.29%) |
Coverage comparison generated by scripts/ci/compare-coverage.ts
…ile' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9f808cbf-0350-4a39-8c4b-a3c44851b7d7
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9f808cbf-0350-4a39-8c4b-a3c44851b7d7
Preserve private cache directory creation from the concurrent security autofix. Validate existing ownership and permissions rather than silently repairing them. Keep cache errors on the explicit fallback path and cover shared and linked directories. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9f808cbf-0350-4a39-8c4b-a3c44851b7d7
|
@copilot merge main and resolve conflicts |
…ue-loader Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Merged |
✅ Coverage Check PassedOverall Coverage
Coverage comparison generated by |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤
|
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅
|
|
🚀 Security Guard has started processing this pull request |
|
✅ Smoke Claude passed
|
|
✅ Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓
|
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.
|
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 Smoke CodexOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
💎 Smoke Gemini is crystallizing results on this pull request... |
|
❌ Smoke Copilot BYOK AOAI (api-key) reports failed. AOAI BYOK (api-key) mode investigation needed...
|
Chroot Version Comparison
Result: FAILED. Node.js differs between host and chroot, so the
|
|
Smoke Test: Copilot BYOK (Direct) Mode ✅
Status: PASS
|
|
Cloud Hypervisor + Copilot smoke test
|
OTEL Smoke Test
|
|
Smoke test (Copilot) for @lpcox
|
Smoke Claude Results
Overall result: PASS
|
|
EGRESS_RESULT allow=pass deny=pass
Overall: PASS — cc @lpcox
|
|
Smoke test: FAIL
|
🏗️ Build Test Suite Results
Overall: 7/8 ecosystems passed — FAIL Java failure: .NET note: The first run failed because The
|


Summary
Adds the bounded runtime consumer deferred from #10473. The API proxy resolves reviewed pricing before inference, refreshes periodically, preserves a proxy-private source/schema-partitioned cache, and pins catalogue/provider pricing per HTTP request or WebSocket connection, including fallback-model guard checks and accounting. It never rewrites bundled assets.
Refs #10290, #10295, #10298. This is not completion of all Phase 5/8 criteria and does not include the rejected execution-attestation expansion or the unresolved compiler companion github/gh-aw#70728.
Trust and temporal integrity
github/gh-aw-firewallrepository over anonymous GitHub HTTPS/API using the existing proxy transport. Resolvecatalogue-dataonce, then read pointer and snapshot at that same immutable commit.publishedAt,effectiveFrom,observedAtandsourceCommit, including legitimate immutable rollback reuse; a matching payload hash alone is insufficient./reflectstate.Configuration and pricing
Enabled by default when the API proxy runs, through existing AWF configuration/environment wiring (
modelCatalogue/AWF_MODEL_CATALOGUE), including dedicated proxy variants. Defaults: 5-second total retrieval deadline, hourly refresh, 30-day maximum age. Supports disabled, offline, explicitly trusted local/mirror, freshness/refresh and private cache directory options. Offline/local modes make zero feed network requests. The default cache is container-local, not a new persistent host mount.Pricing order: operator overlays > existing configured v1 catalogue > complete fresh provider prices > validated fresh central prices > existing reviewed/bundled and selector/default fallbacks. Preserve provider/channel/deployment scope, supported components/units/tiers, effective intervals and provenance; fetched pricing remains
central_feed. Expired/missing long-context tariffs cannot be substituted with central short-context rates. Refresh only affects subsequent requests, never previous accounting.Automatic publication gate
Replaces
MODEL_CATALOGUE_PHASE5_LOADER_AUTH_TESTS_PASSEDwith actual read-only producer/source-authentication/runtime/packaging/accounting tests before the existing write job. Exact selectors are asserted in workflow tests and documented. After merge, eligible main pushes can automatically test/build/publish/bootstrapcatalogue-datawithout a manual flag or dispatch. Existing source/action pins, write-job isolation and normal non-force publication remain intact.No repository variables/secrets, branch rules, signing credentials or live publication were provisioned or changed. No workflows were dispatched.
Validation
npm run models:check,npm run type-check, lint (existing warnings, no errors), edited-document Markdown lint andgit diff --checkpassed.Unverified deployment boundaries: no real Docker/Squid execution or live anonymous GitHub retrieval/publication was exercised. Existing egress policy may deny the feed; applicable approved pricing paths remain available with explicit fallback diagnostics. Actual post-merge publication and any repository policy restrictions remain observable in the ordinary workflow run.