Skip to content

feat(config): validate agent model IDs with actionable error UX - #37

Merged
thientranhung merged 3 commits into
masterfrom
feat/model-id-validation
Apr 24, 2026
Merged

feat(config): validate agent model IDs with actionable error UX#37
thientranhung merged 3 commits into
masterfrom
feat/model-id-validation

Conversation

@thientranhung

Copy link
Copy Markdown
Owner

Summary

  • valid_models_for() in src/config.rs now validates model IDs against researched whitelists for all three providers
  • Error message is multi-line with a bulleted list + pointer to .squad/models.md, instead of a one-liner
  • New .squad/models.md — human-readable lookup file with inline source URLs
  • squad-station init auto-generates .squad/models.md in every project (via include_str!) so end users always get the reference file
  • .gitignore exception for .squad/models.md so repo contributors also get it
  • README.md points users to .squad/models.md when unsure about model IDs

Sources (fetched 2026-04-24)

Provider Source IDs added
Claude Code docs.anthropic.com/en/docs/about-claude/models/overview claude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5-20251001 + legacy
Codex developers.openai.com/codex/models + issue #486 gpt-5.5/5.4/5.4-mini/5.3-codex/5.3-codex-spark/5.2, o4-mini
Gemini CLI packages/core/src/config/models.ts gemini-2.5-pro/flash/flash-lite, gemini-3*-preview + aliases (auto, pro, flash, flash-lite)

Test plan

  • cargo test — 411 passing (+2 for write_models_md_if_absent)
  • cargo clippy --all-targets — clean
  • cargo fmt --check — clean
  • Manual: run squad-station init in a fresh project, verify .squad/models.md is created
  • Manual: declare an invalid model in squad.yml, verify error message shows bulleted list + .squad/models.md reference

Notes

  • o4-mini is included despite not appearing on the official Codex models page — it is the documented default in Codex CLI (see bug: o4-mini is not in the list of available models; yet it is the default openai/codex#486). Flagged with an inline comment.
  • Source of truth for validation is hardcoded in Rust (valid_models_for). .squad/models.md is a human reference only and is not parsed at runtime — keeps init safe on fresh projects where .squad/ does not yet exist.

🤖 Generated with Claude Code

thientranhung and others added 3 commits April 24, 2026 20:27
- valid_models_for() now validates model IDs against researched whitelists
  sourced from: docs.anthropic.com (Claude), developers.openai.com/codex
  (Codex), and packages/core/src/config/models.ts (Gemini CLI)
- Error message is multi-line with a bulleted list of valid IDs and a
  pointer to .squad/models.md, instead of a comma-separated one-liner
- Added .squad/models.md as a human-readable lookup with source URLs
- Added !.squad/models.md to .gitignore so the file is tracked for repo
  contributors
- squad-station init now writes .squad/models.md from an embedded template
  (include_str!) if absent in the project, so end users always get the
  reference file alongside the validation error message
- README points users to .squad/models.md when unsure about model IDs

Tests: 411 passing (+2 for write_models_md_if_absent).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- write_models_md_if_absent: replace exists() + write() with atomic
  OpenOptions::create_new(true) + write_all to close the TOCTOU window
  where a concurrent init could overwrite a just-written file
- Docstring: note that existing .squad/models.md is preserved on upgrade
  while the Rust whitelist stays authoritative, so the file may lag
- .squad/models.md: caveat on the Codex source URL noting it may not be
  canonical and to re-verify against platform.openai.com if broken

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lippy

Replace nested `if` inside `"bmad"` and `"gsd"` match arms with match
guards (`arm if condition =>`). Semantics are identical; the guard form
makes the intent explicit and satisfies the collapsible_match lint fired
by Rust 1.95.0 CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@thientranhung
thientranhung merged commit 569be68 into master Apr 24, 2026
1 check passed
@thientranhung
thientranhung deleted the feat/model-id-validation branch April 24, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant