Repository navigation
fix(cli): validate the selected model during config writes - #144474
Conversation
Resolve primary and fallback selections from the metadata captured during read-only runtime admission, then materialize the selected identity without reapplying authored input aliases. Forward the snapshot explicitly so bare defaults use the canonical resolver's captured-metadata path. Reuse the lease options contract while preserving ephemeral read-only ownership, live catalog defaults, cancellation, and the isolated runner's static mode. Cover cold, matching, foreign, runtime-only, and bare-default model validation, including manifest normalization before the matching fallback runtime hook.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 10, 2026, 7:59 PM ET / 23:59 UTC (Revision 3). ClawSweeper reviewWhat this changesCLI config validation now uses captured provider metadata to validate the selected model without resolving its aliases again, while preserving authored configuration and updating runtime lease callers. Merge readiness✅ Ready for maintainer review The fix remains necessary on fetched main and addresses the documented validation contract. No blocking introduced defect was found; the test-only follow-up preserves the production implementation and its recorded proof. Priority: P2 Review scores
Verification
How this fits togetherCLI configuration writes validate changed primary and fallback models before saving. Provider metadata and an isolated runtime supply the selected model’s identity and capabilities, allowing validation to accept or reject the write. flowchart TD
A[CLI configuration change] --> B[Collect changed model references]
B --> C[Capture provider metadata]
C --> D[Resolve aliases once]
D --> E[Materialize selected model]
E --> F{Model supported?}
F -->|Yes| G[Save authored reference]
F -->|No| H[Reject without changing config]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +19, Tests +165. Total +184 across 16 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep model selection within captured admission metadata and materialize that identity once, preserving authored references and existing rejection behavior. Do we have a high-confidence way to reproduce the issue? Yes, from source: a chained alias can be normalized during selection and again during materialization on fetched main. The PR records failing baseline cases; this read-only review did not execute tests. Is this the best way to solve the issue? Yes. The patch reuses existing captured-metadata and selected-identity contracts, with focused coverage for normalization order, unchanged configuration, and runtime cleanup. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 48b319e240fa. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Read the AbortSignal from the existing lease options object and assert the static catalog mode in that same object. Preserve the isolated-generation, cancellation reason, parent signal, release, and queue cleanup assertions.
|
Merged via squash.
|
…144474) * fix(cli): validate model refs with captured provider metadata Resolve primary and fallback selections from the metadata captured during read-only runtime admission, then materialize the selected identity without reapplying authored input aliases. Forward the snapshot explicitly so bare defaults use the canonical resolver's captured-metadata path. Reuse the lease options contract while preserving ephemeral read-only ownership, live catalog defaults, cancellation, and the isolated runner's static mode. Cover cold, matching, foreign, runtime-only, and bare-default model validation, including manifest normalization before the matching fallback runtime hook. * test(agents): adapt isolated probe mock to lease options Read the AbortSignal from the existing lease options object and assert the static catalog mode in that same object. Preserve the isolated-generation, cancellation reason, parent signal, release, and queue cleanup assertions.
Related: #130706. Builds on #144429.
What Problem This Solves
Fixes an issue where CLI config validation can resolve an authored model alias twice and validate a different model. With
entry → middle → final, a cold primary can materializefinalat 4,096 tokens instead ofmiddleat 32,000. A matching warm fallback can call its runtime normalizer before applying the manifest alias.Why This Change Was Made
Derive primary and fallback references from metadata captured during read-only runtime admission, then materialize the selected model without another input-alias pass. The existing helpers receive that snapshot explicitly, including bare defaults repaired by #144429. The read-only acquisition facade reuses the existing lease-options contract while preserving ephemeral ownership, live defaults, cancellation and release. Production delta: +19 lines.
User Impact
Config writes validate the intended model while preserving the authored reference. Cold and warm validation use the same static-before-runtime normalization order, and rejected writes leave config bytes unchanged.
Evidence
Production/runtime validation is bound to
8216e47759774f63abb1f8ff284bce3cbb12417cagainst the actual #144429 merge,cc748884201771eeac74dc6d8cf0c5b758bade76.middlebefore its runtime hook and materializesmiddle-runtimeat 64,000 tokens. Native cases retain configuredpin-customerwhile the admittedollamahook runs.The first compiled matrix passed 19/21 cases but lacked native hook observations because its fixture did not declare the configured logical namespace. That failed attempt remains recorded. The final matrix corrected only external manifest ownership and strengthened namespace assertions; source and build stayed unchanged. This proves compiled CLI/config-write and provider-hook behavior, not hosted vendor inference.
Current test-only follow-up:
7a4d91c8a9a990777de0c1dfa6f8c6efe0d58420. CI found a missed adapter in an existing isolated-probe fixture: it still treated the new options object as a positional AbortSignal. The fixture now readsoptions.abortSignaland expects the exact{ abortSignal, catalogMode: "static" }call, preserving all cancellation, isolation, release and queue-cleanup assertions. The local baseline reproduced all three failures; the correction passed 61 affected/sibling tests, the full changed-file gate and fresh P2 review. Production and package inputs are identical; the original 8216 build and 21-case/31-child compiled proof are explicitly carried after byte verification. No build was repeated or restamped. Fresh CI is required for this updated head.