Skip to content

Define versioned model contracts and provider-qualified identity - #10310

Merged
lpcox merged 5 commits into
mainfrom
copilot/adr-0004-phase-2-define-schemas
Oct 19, 2026
Merged

lpcox merged 5 commits into
mainfrom
copilot/adr-0004-phase-2-define-schemas

Conversation

Copilot AI commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

ADR 0004 Gate 2 needs a canonical model contract without silently changing the host and proxy behaviors characterized in Phase 1. The existing configured pricing catalogue must also retain its authority above runtime pricing, distinct from a future fetched feed.

  • Schemas and identity: Add opt-in schemas and fixtures for model records, overlays, imported snapshots, central feeds, and resolved exports. Add shared provider-qualified matching and cross-record checks for collisions, replacements, rule conflicts, and family exceptions.
  • Pricing compatibility: Project resolved version-1 configured-catalogue tariffs into the new contract while preserving tier boundaries, component prices, catalogue provenance, and existing production parsing.
  • ADR and migration handoff: Document legacy-versus-target matching, pricing precedence, and additive model data on the existing /reflect endpoint. Production consumers remain unchanged.

Open dependency: The workflow-frontmatter-to-AWF-config payload still requires agreement with github/gh-aw; the ADR records this as a blocker rather than declaring a one-sided format final.

Copilot AI and others added 2 commits October 19, 2026 21:17
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement ADR 0004 phase 2 for canonical schemas and identity Define versioned model contracts and provider-qualified identity Oct 19, 2026
Copilot AI requested a review from lpcox October 19, 2026 21:22
@lpcox
lpcox marked this pull request as ready for review October 19, 2026 21:45
Copilot AI max review requested due to automatic review settings October 19, 2026 21:45

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.

🟡 Changes recommended

Validation, alias matching, and pricing compatibility defects remain in the new contracts.

11 open issues
What changed in this PR

Adds opt-in model-information contracts for ADR 0004 Gate 2 while leaving production consumers unchanged.

Changes:

  • Introduces versioned schemas, fixtures, shared identity matching, and cross-record validation.
  • Projects existing configured-catalogue pricing into canonical tariffs.
  • Documents migration compatibility, additive /reflect data, and the unresolved workflow handoff.
File Description
src/​model-information-contract.test.ts Tests schemas, validation, and identity matching.
shared/​model-information/​schema.v1.json Defines versioned model-information formats.
shared/​model-information/​identity.js Implements provider-qualified identity and matching.
shared/​model-information/​identity.d.ts Declares identity API types.
shared/​model-information/​fixtures.v1.json Supplies representative contract fixtures.
shared/​model-information/​contracts.js Implements validation and pricing projection.
shared/​model-information/​contracts.d.ts Declares contract API types.
docs/​adr/​0004-model-information-management.md Records compatibility and migration requirements.
containers/​api-proxy/​model-information-contract.test.js Tests proxy interoperability and catalogue projection.

Review effort: Max

| Unversioned operator overlay | Exact dated cost wins before base prefix; a base can match specialized suffixes; queries do not match in Phase 1 fixtures. | Keep the open legacy reader; new strict overlays use deterministic exact/alias/family specificity with declared exclusions for specialized variants. |
| Configured shared catalogue | `AWF_MODEL_PRICING_CATALOG` v1 strips prefix/date, normalizes separators/case, uses configured provider aliases, selects long tier only when input tokens **exceed** threshold. Carries `shared_catalog`, ID and version; outranks complete runtime pricing. | Map to `configured_catalog` pricing authority, **not** fetched-feed authority. Preserve existing acceptance, provider aliases, component rates, threshold boundary and accounting. Never apply new strict-format rejection retroactively. |
| Fetched central feed | No corresponding Phase 1 loader exists. | Explicit source/revision, freshness, integrity and offline policy; price and harness only, below complete fresh runtime pricing and the existing configured catalogue. A failed custom source never triggers an unconfigured default. |
| Curated and `models.dev` | Curated precedes bundled import; `models.dev` retains case differences and provider identity, and rejects query suffixes. The same slug at another provider is not a match. | Use reviewed facts ahead of governed imports, with source revision and per-component provenance; no cross-provider slug match or imported availability. |
Comment on lines +40 to +41
if (['overlay', 'importedSnapshot', 'centralFeed', 'resolvedExport'].includes(kind)) {
const errors = validateRecords(value.models, value.rules || []);
Comment on lines +42 to +47
if (kind === 'centralFeed') {
for (const model of value.models) {
if (model.availability?.length || model.lifecycle.status !== 'active') {
errors.push(`Central feed cannot establish availability or lifecycle: ${model.identity.key}`);
}
}
Comment on lines +58 to +70
const errors = [];
const keys = new Set();
const lookups = new Set();
const aliases = [];
for (const model of models) {
const validation = validate('model', model);
errors.push(...validation);
if (validation.length) continue;
const id = model.identity;
const expected = identity(id.provider, id.rawId);
if (id.key !== expected.key || id.lookupId !== expected.lookupId) {
errors.push(`Invalid identity projection: ${id.key}`);
}
Comment on lines +83 to +90
const ambiguous = aliases.some(({ alias: prior, key }) => key !== id.key &&
prior.scope.provider === alias.scope.provider &&
prior.scope.channel === alias.scope.channel &&
prior.scope.deployment === alias.scope.deployment &&
[alias.match, prior.match].some(match => {
const options = { caseInsensitive: match === 'case-insensitive', separators: match === 'separators' };
return normalizeId(alias.id, options) === normalizeId(prior.id, options);
}));
Comment thread shared/model-information/contracts.js Outdated
const provenance = {
authority: 'configured_catalog',
source: 'shared_catalog',
revision: `${resolution.pricingCatalogId}/${resolution.pricingCatalogVersion}`,
Comment thread shared/model-information/contracts.js Outdated
};
const components = Object.fromEntries(
Object.entries(resolution.pricing).filter(([name]) => name !== 'threshold').map(([name, price]) =>
[name, { price: price === null ? { unavailable: true } : String(price), provenance }]),
Comment thread shared/model-information/contracts.js Outdated
Comment on lines +154 to +161
const components = Object.fromEntries(
Object.entries(resolution.pricing).filter(([name]) => name !== 'threshold').map(([name, price]) =>
[name, { price: price === null ? { unavailable: true } : String(price), provenance }]),
);
return {
scope: { provider: scope.provider, channel: scope.channel, ...(scope.deployment ? { deployment: scope.deployment } : {}) },
currency: 'USD', unit: 'USD_PER_1M_TOKENS', tier: resolution.tier,
...(resolution.tier === 'long_context' ? { promptTokensAbove: resolution.pricing.threshold } : {}),
Comment thread shared/model-information/schema.v1.json Outdated
"harnesses": { "type": "array", "items": { "$ref": "#/$defs/harness" } },
"limits": { "type": "object", "properties": { "contextTokens": { "type": "integer", "minimum": 1 }, "outputTokens": { "type": "integer", "minimum": 1 }, "tokenizer": { "type": "string" }, "provenance": { "$ref": "#/$defs/provenance" } }, "required": ["provenance"], "additionalProperties": false },
"modalities": { "type": "object", "properties": { "input": { "type": "array", "items": { "type": "string" }, "uniqueItems": true }, "output": { "type": "array", "items": { "type": "string" }, "uniqueItems": true }, "provenance": { "$ref": "#/$defs/provenance" } }, "required": ["provenance"], "additionalProperties": false },
"reasoning": { "type": "object", "required": ["support", "rawEfforts", "selectableEfforts", "mode", "provenance"], "properties": { "support": { "$ref": "#/$defs/state" }, "condition": { "type": "string" }, "rawEfforts": { "type": "array", "items": { "type": "string" } }, "selectableEfforts": { "type": "array", "items": { "type": "string" } }, "default": { "type": "string" }, "mode": { "enum": ["optional", "required", "forbidden"] }, "requestFields": { "type": "object", "additionalProperties": { "type": "string" } }, "effortAliases": { "type": "object", "additionalProperties": { "type": "string" } }, "provenance": { "$ref": "#/$defs/provenance" } }, "additionalProperties": false },
Comment thread shared/model-information/schema.v1.json Outdated
"modalities": { "type": "object", "properties": { "input": { "type": "array", "items": { "type": "string" }, "uniqueItems": true }, "output": { "type": "array", "items": { "type": "string" }, "uniqueItems": true }, "provenance": { "$ref": "#/$defs/provenance" } }, "required": ["provenance"], "additionalProperties": false },
"reasoning": { "type": "object", "required": ["support", "rawEfforts", "selectableEfforts", "mode", "provenance"], "properties": { "support": { "$ref": "#/$defs/state" }, "condition": { "type": "string" }, "rawEfforts": { "type": "array", "items": { "type": "string" } }, "selectableEfforts": { "type": "array", "items": { "type": "string" } }, "default": { "type": "string" }, "mode": { "enum": ["optional", "required", "forbidden"] }, "requestFields": { "type": "object", "additionalProperties": { "type": "string" } }, "effortAliases": { "type": "object", "additionalProperties": { "type": "string" } }, "provenance": { "$ref": "#/$defs/provenance" } }, "additionalProperties": false },
"protocols": { "type": "array", "items": { "type": "object", "required": ["protocol", "support"], "properties": { "protocol": { "type": "string", "minLength": 1 }, "support": { "$ref": "#/$defs/fact" }, "features": { "type": "object", "additionalProperties": { "$ref": "#/$defs/fact" } } }, "additionalProperties": false } },
"translations": { "type": "array", "items": { "type": "object", "required": ["from", "to", "revision", "support", "features"], "properties": { "from": { "type": "string", "minLength": 1 }, "to": { "type": "string", "minLength": 1 }, "revision": { "type": "string", "minLength": 1 }, "support": { "enum": ["supported", "lossy", "unsupported", "unknown", "conditional"] }, "features": { "type": "object", "additionalProperties": { "$ref": "#/$defs/fact" } } }, "additionalProperties": false } },
@lpcox

lpcox commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Copilot AI commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedback

Addressed in 1662f90.

@lpcox

lpcox commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

@copilot for copilot models, the authoritative list of supported models is the URL https://docs.github.com/en/copilot/reference/ai-models/supported-models

However, this document may lag changelog announcements of deprecation plans like blog posts https://github.blog/changelog/2026-09-18-upcoming-deprecation-of-selected-github-copilot-models-in-mid-october/ and https://github.blog/changelog/2026-10-15-upcoming-deprecation-of-selected-github-copilot-models-in-mid-november/

As part of maintaining model information, we should draw on these information sources.

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

Copilot AI commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot for copilot models, the authoritative list of supported models is the URL https://docs.github.com/en/copilot/reference/ai-models/supported-models

However, this document may lag changelog an...

Documented the supported-models reference as the current-support authority and changelog posts as supplemental evidence for reviewed, dated lifecycle changes. Added in 002ea7e.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

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

@github-actions

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-10310 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 263de17

@github-actions

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 93.39% 93.39% ➡️ +0.00%
Statements 91.95% 91.95% ➡️ +0.00%
Functions 91.15% 91.15% ➡️ +0.00%
Branches 85.91% 85.91% ➡️ +0.00%

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

@lpcox
lpcox enabled auto-merge (squash) October 19, 2026 22:52
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Smoke Gemini completed. All facets verified. 💎

💎 Faceted by Smoke Gemini

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct Mode) ✅

  1. MCP Connectivity: ✅ (verified PR listing)
  2. GitHub.com HTTP: ✅ (code 200)
  3. File Write/Read: ✅ (smoke-test-copilot-byok.txt exists)
  4. BYOK Inference: ✅ (agent → api-proxy → api.githubcopilot.com working)

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

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

@github-actions github-actions Bot added smoke-copilot-byok smoke-copilot-network-isolation Copilot network-isolation egress smoke test labels Oct 19, 2026
@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

Copy link
Copy Markdown
Contributor

Smoke Test: Claude Engine Validation

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

Overall result: PASS

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

@github-actions

Copy link
Copy Markdown
Contributor

OTEL smoke results

  • ✅ 1 Module loading: otel.js loads; exports startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled (+ internals)
  • ✅ 2 Tests: 3 OTEL suites, 68/68 pass
  • ✅ 3 Env forwarding: trace ID/parent span ID in env-passthrough.ts; OTLP endpoint/headers/trace vars in api-proxy-env-config.ts
  • ✅ 4 Token tracker: onUsage hook present in token-tracker-http.js
  • ✅ 5 Diagnostics: /tmp/gh-aw/otel.jsonl has 1 exported span record

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

@github-actions

Copy link
Copy Markdown
Contributor

Services smoke test: PASS

  • ✅ Redis PING → PONG
  • ✅ pg_isready → accepting connections
  • ✅ psql SELECT 1 → 1

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke test (Copilot)

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Gemini Engine Validation

  1. GitHub MCP: ✅
    • test(router): record Python-specific router behavior as fixtures for the Go port
    • test: Characterize model metadata behavior and drift
  2. GitHub.com Connectivity: ❌ (HTTP 000)
  3. File Writing: ✅
  4. Bash Tool: ✅
    Overall status: FAIL

💎 Faceted by Smoke Gemini
Add label ready-for-aw to run again

@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 ✅ YES
Node.js v24.22.0 v26.11.1 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Result: Not all tests passed (Node.js version mismatch), 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

🏗️ 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 ✅ pass ✅ PASS
Go env ✅ pass ✅ PASS
Go uuid ✅ pass ✅ PASS
Java gson ✅ 1/1 passed ✅ PASS
Java caffeine ✅ 1/1 passed ✅ PASS
Node.js clsx ✅ pass ✅ PASS
Node.js execa ✅ pass ✅ PASS
Node.js p-limit ✅ pass ✅ PASS
Rust fd ✅ 1/1 passed ✅ PASS
Rust zoxide ✅ 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — PASS

Notes: the Bun and Deno install scripts were blocked by the sandbox, so I installed both from npm instead. For .NET and Maven I used writable runtime and repository paths (XDG_RUNTIME_DIR and -Dmaven.repo.local) because the defaults weren't usable.

Generated by Build Test Suite for #10310 · copilot · auto · 28.8 AIC · ⊞ 12K · ◷
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke test:

  • PRs read: ✅
  • PR details read: ✅
  • Playwright github.com title check: ❌ policy-blocked
  • Temp file write/read: ✅
  • Build (npm ci && npm run build): ✅
  • Latest merged PRs: "test(router): record Python-specific router behavior as fixtures for the Go port", "test: Characterize model metadata behavior and drift"
  • Overall: FAIL

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

@lpcox
lpcox merged commit ec57d42 into main Oct 19, 2026
135 of 140 checks passed
@lpcox
lpcox deleted the copilot/adr-0004-phase-2-define-schemas branch October 19, 2026 23:13

This branch had an error being deployed

1 failed deployment
aoai-model — 002ea7eb Deployed Oct 19, 2026 by lpcox via conclusion #2051
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.

ADR 0004 phase 2: define canonical schemas and provider-qualified identity

3 participants