Skip to content

fix(claw-migrate): resolve model aliases against real OpenClaw catalog schema (salvage #16778) - #16977

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-cd7ac2fc
Apr 28, 2026
Merged

fix(claw-migrate): resolve model aliases against real OpenClaw catalog schema (salvage #16778)#16977
teknium1 merged 2 commits into
mainfrom
hermes/hermes-cd7ac2fc

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvages @vominh1919's PR #16778 with corrected lookup direction.

Summary

claw migrate now correctly resolves an OpenClaw model display-name alias to the real provider/model API ID before writing to config.yaml, so Hermes no longer sends "Claude Opus 4.6" to the Anthropic API and gets HTTP 404.

Root cause

OpenClaw's agents.defaults.models catalog is keyed by the full provider/model API ID, with an alias field on the value:

{ "anthropic/claude-opus-4-6": { "alias": "Claude Opus 4.6" } }

The original PR assumed the catalog was keyed by display name with {"id": ..., "provider": ...} as the value — the inverse shape. The forward lookup if model_str in model_catalog would have missed on every real OpenClaw config, including the exact catalog shown in issue #16745's repro.

Fix

Do a reverse lookup: if model_str isn't already a catalog key, scan catalog items for one whose alias (or plain-string value) matches model_str, then use that entry's key as the resolved API ID. Leave model_str alone when it's already an API ID or has no match.

Changes

  • optional-skills/migration/openclaw-migration/scripts/openclaw_to_hermes.py (+23 / -0): reverse-lookup in migrate_model_config
  • tests/skills/test_openclaw_migration.py (+137 / -0): 6 regression tests covering real schema, bare-string model value, already-an-API-ID passthrough, unknown-alias passthrough, string-valued entries, no catalog

Validation

Targeted suite: 100/100 passing (tests/skills/test_openclaw_migration*.py + tests/hermes_cli/test_setup_openclaw_migration.py).

E2E: real OpenClaw schema from issue #16745 resolves {"primary": "Claude Opus 4.6"}anthropic/claude-opus-4-6 in the written config.yaml.

Credit

Cherry-picked @vominh1919's commit (authorship preserved); lookup direction amended to match the real OpenClaw catalog shape, plus a follow-up commit adding regression tests. Closes #16778, fixes #16745.

vominh1919 and others added 2 commits April 28, 2026 04:48
`hermes claw migrate` copied OpenClaw's model setting verbatim, which
could be a display alias (e.g. "Claude Opus 4.6") instead of the actual
API ID (e.g. "claude-opus-4-6"). Hermes then sent the alias to the API,
causing HTTP 404 model not found.

Fix: look up the model string in agents.defaults.models (plural) alias
catalog. If found, use the resolved "id" field, prepending the provider
prefix if needed. If not found (already an API ID), pass through unchanged.

Fixes #16745
…w schema

Real OpenClaw configs key agents.defaults.models by full provider/model
API ID with an 'alias' field on the value (e.g.
{'anthropic/claude-opus-4-6': {'alias': 'Claude Opus 4.6'}}).  Add
regression tests for issue #16745 covering:

- reverse-lookup of alias against real schema (keyed by API ID)
- alias resolution when model is a bare string vs {'primary': ...}
- passthrough when the value is already a provider/model API ID
- passthrough when the alias has no catalog match
- string-valued catalog entries (belt-and-suspenders)
- no catalog at all
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard labels Apr 28, 2026
@teknium1
teknium1 merged commit 1369dae into main Apr 28, 2026
11 of 12 checks passed
@teknium1
teknium1 deleted the hermes/hermes-cd7ac2fc branch April 28, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: claw migrate: model alias copied verbatim instead of resolved to API ID

4 participants