Skip to content

feat(api-proxy): use runtime model metadata and pricing overlays - #6695

Merged
lpcox merged 2 commits into
mainfrom
runtime-model-metadata
Jul 28, 2026
Merged

feat(api-proxy): use runtime model metadata and pricing overlays#6695
lpcox merged 2 commits into
mainfrom
runtime-model-metadata

Conversation

@lpcox

@lpcox lpcox commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • preserve normalized provider model metadata and use versioned Copilot runtime pricing ahead of bundled catalogs
  • support apiProxy.providers operator pricing overlays end-to-end, including the previously dropped default-pricing assembly path
  • add long-context pricing and provenance to AI-credit accounting, logs, /reflect, and models.json
  • fail closed for unverifiable Copilot auto requests when model policy, multiplier caps, or AI-credit pricing cannot be proven
  • add claude-opus-5 and the gpt-5.6-{sol,terra,luna} family to static model/pricing catalogs
  • extend catalog consistency tests to catch future drift from docs/model-api-mapping.json

Validation

  • root Jest suite: 271 suites, 4,543 tests
  • API proxy Jest suite: 212 suites, 2,659 tests
  • TypeScript type-check and build
  • ESLint and changed-document Markdown lint

Closes #6682
Closes #6674
Refs #6688

Add provider pricing overlays and Copilot runtime pricing tiers.

Fail closed for unverifiable auto routing and check catalog consistency.

Closes #6682

Closes #6674

Refs #6688

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a9cf3033-ffae-4b83-b174-b8b2099c5416
Copilot AI review requested due to automatic review settings July 28, 2026 17:18
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation build failed for this PR. View logs.

Built from commit 869e267

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 99.17% 99.20% 📈 +0.03%
Statements 99.07% 99.10% 📈 +0.03%
Functions 99.45% 99.45% ➡️ +0.00%
Branches 95.75% 95.79% 📈 +0.04%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/commands/validators/api-proxy-validator.ts 96.7% → 97.0% (+0.30%) 97.0% → 97.3% (+0.25%)
src/log-directory-setup.ts 96.2% → 100.0% (+3.78%) 96.3% → 100.0% (+3.71%)

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

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.

Pull request overview

Adds runtime/provider pricing metadata to API-proxy accounting and expands Copilot model support.

Changes:

  • Wires operator pricing overlays through configuration.
  • Adds runtime Copilot pricing, long-context tiers, and provenance.
  • Expands model catalogs and fail-closed auto handling.
Show a summary per file
File Description
src/types/rate-limit-options.ts Types provider overlays.
src/services/api-proxy-env-config.ts Exports overlay environment data.
src/services/api-proxy-env-config.test.ts Tests overlay export.
src/copilot-model.ts Adds supported models.
src/copilot-model-catalog-sync.test.ts Expands catalog consistency checks.
src/config-mapper.ts Maps provider configuration.
src/config-file.ts Types provider configuration.
src/config-file-mapping.test.ts Tests provider mapping.
src/commands/validators/config-assembly-model-detection.test.ts Tests runtime validation deferral.
src/commands/validators/api-proxy-validator.ts Defers unknown direct models.
src/commands/build-config.ts Preserves pricing configuration.
src/commands/build-config.test.ts Tests end-to-end configuration.
src/awf-config-schema.json Adds providers schema.
docs/awf-config.schema.json Publishes providers schema.
docs/awf-config-spec.md Documents pricing precedence.
docs/api-proxy-sidecar.md Documents runtime metadata.
containers/api-proxy/token-tracker-shared.js Persists pricing provenance.
containers/api-proxy/token-budget-log.test.js Tests provenance fields.
containers/api-proxy/token-budget-log.js Logs pricing provenance.
containers/api-proxy/server.token-guards.test.js Tests fail-closed auto.
containers/api-proxy/server.network.test.js Tests metadata discovery.
containers/api-proxy/server.js Exposes runtime metadata.
containers/api-proxy/runtime-model-catalog.test.js Tests runtime normalization.
containers/api-proxy/runtime-model-catalog.js Implements runtime catalog.
containers/api-proxy/providers/index.js Documents adapter metadata fields.
containers/api-proxy/providers/copilot.js Versions Copilot discovery.
containers/api-proxy/provider-pricing-overlays.js Resolves operator overlays.
containers/api-proxy/model-discovery.js Preserves discovered metadata.
containers/api-proxy/management.js Adds metadata to reflection.
containers/api-proxy/key-validation.js Maintains runtime snapshots.
containers/api-proxy/guards/model-policy-guard.test.js Tests auto policy behavior.
containers/api-proxy/guards/model-policy-guard.js Fails closed for dynamic policy.
containers/api-proxy/guards/max-model-multiplier-guard.test.js Tests dynamic multiplier handling.
containers/api-proxy/guards/max-model-multiplier-guard.js Guards unverifiable multipliers.
containers/api-proxy/guards/ai-credits-guard.test.js Tests pricing precedence.
containers/api-proxy/guards/ai-credits-guard.js Applies runtime tiered pricing.
containers/api-proxy/Dockerfile Packages new runtime modules.
containers/api-proxy/copilot-byok.test.js Tests versioned discovery headers.
containers/api-proxy/ai-credits-pricing.js Adds static model prices.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 39/39 changed files
  • Comments generated: 5
  • Review effort level: Medium

Comment thread containers/api-proxy/runtime-model-catalog.js Outdated
Comment thread containers/api-proxy/runtime-model-catalog.js
Comment thread containers/api-proxy/runtime-model-catalog.js Outdated
Comment thread containers/api-proxy/guards/ai-credits-guard.js Outdated
Comment thread src/commands/validators/api-proxy-validator.ts
@lpcox lpcox changed the title Use runtime model metadata and provider pricing overlays feat(api-proxy): use runtime model metadata and pricing overlays Jul 28, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a9cf3033-ffae-4b83-b174-b8b2099c5416
@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 Jul 28, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (Entra) reports failed. AOAI BYOK (Entra) mode investigation needed...

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Contribution Check failed. Please review the logs for details.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Build Test Suite completed successfully!

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🛡️ Smoke Copilot Network Isolation confirmed the egress allowlist is enforced. ✅

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude passed

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini completed. All facets verified. 💎

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Security Guard failed. Please review the logs for details.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Claude Engine Validation

Check Result
API status ✅ PASS
gh check ✅ PASS
File status ✅ PASS

Overall result: PASS

Generated by Smoke Claude for #6695 · haiku45 · 55.1 AIC · ⊞ 3.3K ·
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct) — PASS

Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) via api-proxy → api.githubcopilot.com

Test Result
GitHub MCP connectivity
GitHub.com connectivity (HTTP 200)
File write/read
BYOK inference (agent → api-proxy → api.githubcopilot.com)

Overall: PASS

@lpcox

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

@github-actions

Copy link
Copy Markdown
Contributor

@lpcox — smoke test results for this PR:

EGRESS_RESULT allow=pass deny=pass
  • ✅ Allowed domain (api.github.com): HTTP 200
  • ✅ Blocked domain (example.com): connection denied (403 from proxy)

Overall: PASS

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • example.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "example.com"

See Network Configuration for more information.

🛡️ 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 Jul 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔬 Smoke Test Results

Test Status
GitHub MCP connectivity ⚠️ PR data filtered by secrecy policy
GitHub.com HTTP ✅ 200 OK
File write/read ❌ File not found (pre-step skipped/template not resolved)

Overall: PARTIAL — template variables were not resolved (${{ steps.smoke-data.outputs.* }}), indicating the workflow ran without the pre-compute step populating outputs. MCP read filtered by secrecy policy.

PR author: @lpcox

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

@github-actions

Copy link
Copy Markdown
Contributor

🔬 Smoke Test: API Proxy OpenTelemetry Tracing

Scenario Result Notes
1. Module Loading ✅ Pass otel.js loads successfully; exports: startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled
2. Test Suite ✅ Pass 59 tests across 2 suites (otel.test.js, otel-fanout.test.js) — all passed
3. Env Var Forwarding ✅ Pass src/services/api-proxy-env-config.test.ts confirms forwarding of GH_AW_OTLP_ENDPOINTS, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, GITHUB_AW_OTEL_TRACE_ID, GITHUB_AW_OTEL_PARENT_SPAN_ID, OTEL_SERVICE_NAME
4. Token Tracker Integration ✅ Pass onUsage callback present in token-tracker-http.js (line 406) as the OTEL hook point
5. OTEL Diagnostics ✅ Pass Module initializes; falls back to /var/log/api-proxy/otel.jsonl when no OTLP endpoint configured

All 5 scenarios pass. OTEL tracing integration is functional.

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results — Services Connectivity

Check Result
Redis PING host.docker.internal not resolvable
PostgreSQL pg_isready ❌ no response
PostgreSQL SELECT 1 ❌ host not resolvable

Overall: FAILhost.docker.internal DNS resolution fails in this environment. Service containers are not reachable.

🔌 Service connectivity validated by Smoke Services
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results

Overall status: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • localhost

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "localhost"

See Network Configuration for more information.

💎 Faceted by Smoke Gemini
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 1/1 passed ✅ PASS
Go env 1/1 passed ✅ PASS
Go uuid 1/1 passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx passed ✅ PASS
Node.js execa passed ✅ PASS
Node.js p-limit passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Generated by Build Test Suite for #6695 · sonnet46 · 43.3 AIC · ⊞ 8.4K ·
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.13 ✅ YES
Node.js v24.18.0 v22.23.1 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Result: ❌ FAILED — Node.js version mismatch (host: v24.18.0, chroot: v22.23.1).

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke test results for feat(api-proxy): use runtime model metadata and pricing overlays

  • merged PRs: chore: upgrade gh-aw extension to v0.83.4 pre-release and recompile workflows; feat: add sealed probes for private repositories
  • GitHub query: ✅
  • Playwright title check: ✅
  • Temp file write/read: ✅
  • npm ci && npm run build: ❌ (403 fetching yocto-queue)
    Overall: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

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

@github-actions

Copy link
Copy Markdown
Contributor

🔥 Smoke Test: Docker Sbx — PASS

Test Result
GitHub MCP connectivity ✅ Connected
GitHub.com HTTP ✅ 200 OK
File write/read ✅ Verified (smoke-test-docker-sbx-30387655442.txt)

Overall: ✅ PASS

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

@lpcox
lpcox merged commit 1714eb7 into main Jul 28, 2026
141 of 146 checks passed
@lpcox
lpcox deleted the runtime-model-metadata branch July 28, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants