Skip to content

feat: load reviewed model catalogue prices at runtime - #10494

Merged
lpcox merged 7 commits into
mainfrom
lpcox-runtime-catalogue-loader
Oct 24, 2026
Merged

lpcox merged 7 commits into
mainfrom
lpcox-runtime-catalogue-loader

Conversation

@lpcox

@lpcox lpcox commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

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

  • Default source is the fixed github/gh-aw-firewall repository over anonymous GitHub HTTPS/API using the existing proxy transport. Resolve catalogue-data once, then read pointer and snapshot at that same immutable commit.
  • Verify schemas, canonical bytes, exact paths, revisions/digests, reviewed-main ancestry and accepted-source ordering. Independently reconstruct the entire snapshot using local validator/producer code, immutable reviewed catalogue evidence and original source commit metadata. This authenticates publishedAt, effectiveFrom, observedAt and sourceCommit, including legitimate immutable rollback reuse; a matching payload hash alone is insufficient.
  • Bound time and response size. Never follow redirects, import remote code/schemas, use ambient credentials, change source after failure, implicitly allowlist domains, or retry outside the configured proxy. Explicitly trusted custom HTTPS mirrors or inline local snapshots remain operator-controlled trust roots.
  • Reject unsupported schemas, tariff shapes and explicit harness constraints rather than silently activating facts the current proxy cannot enforce. Failures/age/source/revision/fallback are diagnosed in logs and additive /reflect state.

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_PASSED with 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/bootstrap catalogue-data without 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

  • Full API-proxy regression suite: 128 suites, 2,730 tests passed.
  • Exact automatic runtime gate: 7 suites, 168 tests passed.
  • Producer/publication and compiler tests: 2 suites, 50 tests passed; publication gate rerun separately after final workflow changes.
  • Targeted root configuration/service suites: 5 suites, 329 tests passed.
  • npm run models:check, npm run type-check, lint (existing warnings, no errors), edited-document Markdown lint and git diff --check passed.
  • Disposable producer → published Git branch/pointer → actual loader → resolver/accounting fixtures cover envelope tampering, mutable-ref races, immutable rollback, source anti-regression, freshness/effective dates, cache failure preservation, authority, request pinning and offline/denied/timeout/malformed/oversize paths.
  • Docker application staging and npm package-content checks passed; staged proxy runs without repository source paths. Security reviews reported no vulnerabilities.

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.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9f808cbf-0350-4a39-8c4b-a3c44851b7d7
Copilot AI max review requested due to automatic review settings October 23, 2026 15:58
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation has been built for this PR.

Download preview artifact

To view locally:

  1. Download the docs-preview-pr-10494 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit f1bda57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Default-on fetched pricing and automatic publication affect budget enforcement and retain unresolved correctness and startup risks.

6 open issues
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 /reflect state.
  • 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

Comment on lines +28 to +32
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;
Comment on lines +221 to 226
server.on('upgrade', async (req, socket, head) => {
if (catalogueReady) await catalogueReady;
if (socket.destroyed) return;
attachCaller(req, adapter);
handleUpgrade(req, socket, head);
});
Comment on lines +261 to +265
await refresh();
if (!stopped && !timer) {
timer = setInterval(refresh, interval);
timer.unref();
}
Comment on lines +277 to +293
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 };
}
Comment on lines +302 to +313
"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
@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@lpcox Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

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

lpcox and others added 4 commits October 23, 2026 14:18
…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
@lpcox

lpcox commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot merge main and resolve conflicts

…ue-loader

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

Copilot AI commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

@copilot merge main and resolve conflicts

Merged main cleanly with no conflicts in 18b5473.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 93.48% 93.48% ➡️ +0.00%
Statements 91.93% 91.93% ➡️ +0.00%
Functions 91.09% 91.09% ➡️ +0.00%
Branches 86.02% 86.02% ➡️ +0.00%

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅

📡 OTel tracing validated by Smoke OTel Tracing

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Security Guard has started processing this pull request

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ Smoke Claude passed

Generated by Smoke Claude for #10494

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓

🪪 BYOK (AOAI Entra) report filed by Smoke Copilot BYOK AOAI (Entra)

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

Tested by Smoke Chroot

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

Smoke Codex

Outcome: reported_no_action

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.

Generated from Smoke Codex · gpt54 · 15.2 AIC · ⊞ 21.0K · ◷

🔮 The oracle has spoken through Smoke Codex

@github-actions

Copy link
Copy Markdown
Contributor

💎 Smoke Gemini is crystallizing results on this pull request...

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

❌ Smoke Copilot BYOK AOAI (api-key) reports failed. AOAI BYOK (api-key) mode investigation needed...

🔑 BYOK (AOAI api-key) report filed by Smoke Copilot BYOK AOAI (api-key)

@github-actions

Copy link
Copy Markdown
Contributor

Chroot Version Comparison

Runtime Host Version Chroot Version Match?
Python Python 3.12.15 Python 3.12.15 ✅
Node.js v24.21.0 v22.23.2 ❌
Go go1.22.12 go1.22.12 ✅

Result: FAILED. Node.js differs between host and chroot, so the smoke-chroot label was not added.

Tested by Smoke Chroot
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct) Mode ✅

  1. ✅ MCP connectivity verified
  2. ✅ GitHub.com accessible (HTTP 200)
  3. ✅ File write/read test passed
  4. ✅ BYOK inference working (direct BYOK mode via api-proxy → api.githubcopilot.com)

Status: PASS
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) via api-proxy sidecar to api.githubcopilot.com

🔑 BYOK report filed by Smoke Copilot BYOK
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Cloud Hypervisor + Copilot smoke test

  1. Merged PR lookup: PASS
  2. github.com connectivity: PASS (HTTP 200)
  3. File write/read: PASS
  4. example.com blocked: PASS (HTTP 000)
    Overall: PASS

Cloud Hypervisor + Copilot smoke test by Smoke Cloud Hypervisor
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

OTEL Smoke Test

  • ✅ S1 Module loading: otel.js loads; exports startRequestSpan, setTokenAttributes, endSpan, shutdown, isEnabled, etc.
  • ✅ S2 Tests: 3 suites, 75/75 passed
  • ✅ S3 Env forwarding: trace/parent span IDs in env-passthrough.ts; OTEL vars in api-proxy-env-config.ts
  • ✅ S4 Token tracker: onUsage hook present in token-tracker-http.js
  • ✅ S5 Diagnostics: /tmp/gh-aw/otel.jsonl present (1 line)

📡 OTel tracing validated by Smoke OTel Tracing
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke test (Copilot) for @lpcox

  • GitHub MCP: ✅ (latest PR: "chore: upgrade gh-aw workflows to v0.93.3")
  • GitHub.com connectivity: ✅ (200)
  • File write/read: ✅
    Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Claude Results

  • API status: ✅ PASS
  • GitHub check: ✅ PASS
  • File status: ✅ PASS

Overall result: PASS

Generated by Smoke Claude for #10494 · claude · haiku45 · 34 AIC · ⊞ 6.1K · ◷
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

EGRESS_RESULT allow=pass deny=pass

  • ✅ Allowed domain (api.github.com → 200)
  • ✅ Blocked domain (example.com blocked)

Overall: PASS — cc @lpcox

🛡️ Egress verdict from Smoke Copilot Network Isolation
Add label ready-for-aw to run again

@github-actions github-actions Bot added the smoke-copilot-network-isolation Copilot network-isolation egress smoke test label Oct 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Smoke test: FAIL

  • fix: improve authentication diagnostics and conformance recovery ✅
  • feat: publish reviewed model catalogue snapshots automatically ✅
  • PR detail read ✅
  • Playwright title check ❌
  • File write/read ✅
  • AWF build ✅

🔮 The oracle has spoken through Smoke Codex
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia ✅ 1/1 passed ✅ PASS
Bun hono ✅ 1/1 passed ✅ PASS
C++ fmt ✅ N/A ✅ PASS
C++ json ✅ N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world ✅ N/A ✅ PASS
.NET json-parse ✅ N/A ✅ PASS
Go color ✅ ok ✅ PASS
Go env ✅ ok ✅ PASS
Go uuid ✅ ok ✅ PASS
Java gson ❌ not run ❌ FAIL
Java caffeine ❌ not run ❌ FAIL
Node.js clsx ✅ all passed ✅ PASS
Node.js execa ✅ all passed ✅ PASS
Node.js p-limit ✅ all passed ✅ PASS
Rust fd ✅ 1/1 passed ✅ PASS
Rust zoxide ✅ 1/1 passed ✅ PASS

Overall: 7/8 ecosystems passed — FAIL

Java failure: mvn compile could not resolve maven-resources-plugin:3.5.0 from Maven Central. The required ~/.m2/settings.xml proxy points at squid-proxy:3128, which this run could not reach. The default ~/.m2 is also root-owned, which caused "Could not create local repository". I retried with an alternate local repository and got the same download failure.

.NET note: The first run failed because /run/user/<uid> was missing. It passed after setting XDG_RUNTIME_DIR and DOTNET_CLI_HOME to temp directories.

The build-test label was not added because of the Java failure.

Generated by Build Test Suite for #10494 · copilot · auto · 24.7 AIC · ⊞ 5.7K · ◷
Add label ready-for-aw to run again

This branch was previously deployed

1 inactive deployment
aoai-model — 18b5473d Deployed Oct 24, 2026 by lpcox via conclusion #2135
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants