fix: normalize model name separators in AWF CLI validation#4908
Conversation
Apply separator normalization (. and _ -> -) to the AWF CLI model validation path so both 'claude-haiku-4-5' and 'claude-haiku-4.5' are accepted and resolved to the canonical form 'claude-haiku-4.5'. This mirrors the existing tolerant behavior in the api-proxy's model-utils.js / model-resolver.js. The fix also extends to retired-alias lookups for consistency. Closes #4907
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
There was a problem hiding this comment.
Pull request overview
This PR updates AWF CLI Copilot model validation to accept model names where version/segment separators are provided as - or _, matching how the api-proxy already canonicalizes model identifiers. This prevents early CLI startup failures when users (or CI) supply hyphenated/underscored variants of otherwise-supported models.
Changes:
- Add
normalizeSeparators()and precomputed lookup maps to resolve separator-normalized inputs to canonical model names. - Extend
validateCopilotModel()to fall back to separator-normalized matching after exact-match checks (while still rejecting retired aliases). - Add unit tests covering hyphen/underscore/uppercase variants and cross-model behavior.
Show a summary per file
| File | Description |
|---|---|
src/copilot-model.ts |
Adds separator-normalized canonical lookup to accept hyphen/underscore variants and resolve to canonical model IDs. |
src/copilot-model.test.ts |
Adds tests for the new normalization behavior and ensures retired aliases remain rejected. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 2
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Smoke Test: Copilot BYOK (Direct Mode) — PASS ✅
Running in direct BYOK mode ( CC:
|
🔬 Smoke Test Results — PASS
PR: fix: normalize model name separators in AWF CLI validation Overall: PASS
|
|
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)
Overall: PASS cc
|
Chroot Version Comparison Results
Overall: ❌ Not all versions match. Go matches, but Python and Node.js differ between host and chroot environments.
|
|
Reviewed merged PRs:
|
Smoke Test Results
Overall: FAIL
|
🔬 Smoke Test: PAT Auth — FAIL
Overall: FAIL — pre-step outputs were not substituted ( Auth mode: PAT (COPILOT_GITHUB_TOKEN) | PR: "fix: normalize model name separators in AWF CLI validation" | Author:
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
|
Add interactive workflow designer agent MCP: ✅ github.com: ✅ file I/O: ❌ BYOK: ✅ Running in direct BYOK mode (AWF_AUTH_TYPE=github-oidc + AWF_AUTH_AZURE_* + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) authenticated via Microsoft Entra Overall: FAIL
|
The AWF CLI rejected hyphenated model names (e.g.
claude-haiku-4-5) at startup—before containers even start—while the api-proxy already handles this normalization transparently. This caused CI failures when switching engines without updating model name formatting.Changes
src/copilot-model.tsnormalizeSeparators()— replaces.and_with-, mirroringcontainers/api-proxy/model-utils.jsNORMALIZED_TO_CANONICALmap (separator-normalized → canonical) andNORMALIZED_RETIRED_ALIASESmap at module loadvalidateCopilotModelnow falls through to a separator-normalized lookup when exact match fails, returning the canonical form asresolvedModelsrc/copilot-model.test.ts— adds 7 tests covering hyphen, underscore, and uppercase variants; confirms retired aliases still reject correctlyThe existing normalization log in
config-assembly.tswill surface the rewrite (e.g.Normalized COPILOT_MODEL value 'claude-haiku-4-5' -> 'claude-haiku-4.5') so users get visibility without a hard failure.