Repository navigation
fix(cli): resolve alias targets from the write snapshot - #128223
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 27, 2026, 5:14 AM ET / 09:14 UTC. ClawSweeper reviewWhat this changesMoves Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 3 items remain The patch is correct and fixes a current-main stale-target race, but this external PR still needs real configuration/CLI proof beyond mocked Vitest coverage before merge. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe models CLI resolves a model reference and writes a global aliases map through a hash-fenced configuration update. The resolved target is persisted in source config and then shown in the command’s success output. flowchart LR
A[Alias add command] --> B[Read config snapshot]
B --> C[Materialize runtime aliases]
C --> D[Resolve requested target]
D --> E[Hash-fenced source write]
E --> F[Success message]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +2, Tests +54. Total +56 across 2 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep resolution and the fenced write on one snapshot, then add redacted real CLI/config-I/O proof that a write-time remap persists and reports the same canonical target. Do we have a high-confidence way to reproduce the issue? Yes. The divergent-snapshot regression is a high-confidence deterministic reproduction, and current-main source confirms its pre-write resolution path; it was not executed in this read-only review. Is this the best way to solve the issue? Yes. Resolving inside the existing snapshot owner is the narrow canonical repair, matching the AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 049f4940b9f9. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
b254fc4 to
6a34bbe
Compare
|
Applied the ClawSweeper finding: the audit event-loop probe tolerance change is removed from this PR (head is now the alias fix only, |
6a34bbe to
01d7ef5
Compare
|
CI status on head The fix for that probe is #128228 (green). Suggest landing #128228 first and re-running this PR's CI, or treating the remaining red as the known flake — maintainers' call. No code changes here since ClawSweeper's reviewed head; content is identical to |
01d7ef5 to
6292c92
Compare
|
Land-ready status for head Rebased onto current
The review's remaining item is the maintainer decision it names: whether to accept that No proof gaps known. |
…remapped concurrently `openclaw models aliases add <alias> <model-or-alias>` resolved its `<model-or-alias>` argument from the config loaded at command start, then entered `updateConfig`, which takes a fresh snapshot and fences the write on that snapshot's hash. When another writer remapped the source alias in between, the hash check still passed and the new alias was attached to the model the argument no longer denoted, and the success line reported that stale target. Resolve the argument inside the fenced mutator from the same snapshot that guards the write, using the resolver `models set` already uses (authored source aliases first, runtime-materialized built-in aliases second), and drop the pre-CAS read. This also aligns `aliases add` with `models set` when an authored alias shares a name with a built-in one. Closes openclaw#127618 Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JisrS8fiHvELHvmi7iabZ9
6292c92 to
93995a0
Compare
|
Rebased onto current The conflict was semantic, not textual, so flagging the resolution for reviewers: #116652 added case-folded alias-collision detection to const normalizedAlias = alias.toLowerCase();
let target: string | undefined;
await updateConfig((cfg, context) => {
const resolved = resolveModelTargetForWrite({ cfg, resolveCfg: context.runtimeConfig, modelRaw });
const modelKey = `${resolved.provider}/${resolved.model}`;
target = modelKey;
// ... existing case-folded collision check, unchangedThe test file conflict was additive (both sides appended cases); both sets are kept. Proof on
Diff vs |
|
@clawsweeper re-review Fresh reviewed head: Rank-up handling:
The prior review is older than 12 hours and the behavior/scope changed |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Added exact-head real CLI/config-I/O proof to the PR body. Blacksmith Testbox lease The remote command and assertions exited 0. Exact-head CI run |
|
🦞👀 |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
) * fix(cli): models aliases add targets a stale model when the alias is remapped concurrently `openclaw models aliases add <alias> <model-or-alias>` resolved its `<model-or-alias>` argument from the config loaded at command start, then entered `updateConfig`, which takes a fresh snapshot and fences the write on that snapshot's hash. When another writer remapped the source alias in between, the hash check still passed and the new alias was attached to the model the argument no longer denoted, and the success line reported that stale target. Resolve the argument inside the fenced mutator from the same snapshot that guards the write, using the resolver `models set` already uses (authored source aliases first, runtime-materialized built-in aliases second), and drop the pre-CAS read. This also aligns `aliases add` with `models set` when an authored alias shares a name with a built-in one. Closes openclaw#127618 Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JisrS8fiHvELHvmi7iabZ9 * fix(cli): resolve alias targets from write snapshot --------- Co-authored-by: Claude Fable 5 <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
Closes #127618
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
openclaw models aliases add <alias> <model-or-alias>resolved the target beforeupdateConfigobtained the snapshot and hash that fence the write. If anotherconfig writer remapped the input alias between those reads, the command
successfully attached the new alias to the stale model and logged that stale
target.
Why This Change Was Made
modelsAliasesAddCommandnow resolvesmodelRawinside theupdateConfigmutator from
context.runtimeConfig. Resolution and the compare-and-swap writetherefore share one authoritative snapshot. The canonical model key is persisted
to the source config and retained for the post-commit success line.
No shared resolver, config shape, CLI flag, migration, fallback, or docs change
is included.
User Impact
models aliases addfollows the alias mapping current at the fenced write.Alias <alias> -> <target>line matches the persisted target.written.
Evidence
AI-assisted (Claude Code and Codex); I have read and understand the change.
Red-before on current main
node scripts/run-vitest.mjs src/commands/models/aliases.test.tsThe reconstructed two-snapshot regression failed as intended: the stale
pre-snapshot mapped
old-aliastoopenai/gpt-5.6-sol, the CAS snapshot mappedit to
anthropic/claude-opus-5, and pre-fix code wrotenew-aliasto the staleOpenAI target. Result: 1 failed, 17 passed.
Focused owner and sibling tests
All requested files passed and were observed in the native review output.
pnpm check:changedandgit diff --checkalso passed.Autoreview
Fresh branch autoreview with Codex
gpt-5.6-solat high reasoning reported noaccepted or actionable findings; overall correctness confidence was 0.99.
Real CLI/config-I/O proof
Blacksmith Testbox lease
tbx_01m118jw10zrx3x400tr2ten3b, Actions run33058459463, executed the exact reviewed tree with an isolated config. Anexternal atomic writer moved
old-aliasfrom the OpenAI model to the Anthropicmodel before the real CLI write:
The remote command and assertions exited 0.
Gate note
Local
prepare-gatesbuild and check passed. The full test encountered unrelatedtooling noise:
telegram-user-crabbox-proof.test.tsreproduced the same failureon current main,
test-live.test.tspassed on current-main retry, and thetest-perf-budget.test.ts/test-projects.test.tsshard reproduced a no-outputhang on current main. An initial Blacksmith Testbox full-gate lease failed before
tests because its hydrated checkout lacked
node_modulesand could not importtsx.Exact-head CI run
33057073509completed successfully with no failed jobs.OPENCLAW_TESTBOX=1 scripts/pr prepare-run 128223accepted that hosted proof andcompleted with
gates_mode=hosted_exact_or_recent_parent.Repair Closeout
aliases addresolvedmodelRawbefore the CAS-owned configsnapshot existed.
src/commands/models/aliases.ts.updateConfigusingcontext.runtimeConfig.tests passed.
src/commands/models/shared.tsis unchanged.