Skip to content

fix: skip Agent configs that have nothing to migrate - #251

Open
yujiezhang-ops wants to merge 1 commit into
mainfrom
claude/skip-unrelated-migration
Open

yujiezhang-ops wants to merge 1 commit into
mainfrom
claude/skip-unrelated-migration

Conversation

@yujiezhang-ops

Copy link
Copy Markdown
Collaborator

Summary

On a Windows machine with OpenClaw installed, every page showed:

无法迁移旧 BootAgent 配置:migrate C:\Users\….openclaw\openclaw.json: hujson: line 2, column 3: invalid literal: models

OpenClaw's config format is JSON5: this file has an unquoted top-level key (models:) and a trailing comma. hujson only accepts JSONC, so migrateLegacyOpenClaw fails before it can see the file has no oneagent provider at all. MigrateLegacyAgentConfigs runs on every launch when ~/.oneagent does not exist, so the notice comes back on every start.

Every migration here renames an identifier OneAgent wrote (oneagent keys and prefixes, OneAgent - names). MigrateLegacyAgentConfigs now skips any file that does not mention oneagent (case-insensitive) without parsing it. A file that does mention it is parsed exactly as before, so a genuinely broken legacy config is still reported.

Not in this PR

ReadOpenClawConfig (encoding/json) and WriteOpenClaw (loadJSON) also cannot read JSON5. With this file, OpenClaw status reports it as unreadable, and configuring OpenClaw from BootAgent would fail. That needs a JSON5 parser and a decision on how to write the file back, so it is left as a follow-up.

Test plan

  • New TestMigrateIgnoresAConfigWithNothingToMigrate: a JSON5 openclaw.json (unquoted key, trailing comma, no oneagent) returns nil and is left byte-identical
  • Existing migrate tests pass, including TestMigrateContinuesPastAFileItCannotParse: its broken file mentions oneagent, so it is still reported
  • go test ./internal/config ./internal/app on Windows: same failure set as main (22 pre-existing Unix-permission failures)
  • CI

🤖 Generated with Claude Code

Every legacy migration renames an identifier OneAgent wrote, yet each config
was parsed unconditionally on launch. OpenClaw's openclaw.json is JSON5, which
hujson rejects (`invalid literal: models` for an unquoted key), so a user with
no OneAgent history saw "无法迁移旧 BootAgent 配置" on every page. A file that
never mentions oneagent is now left unread.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@yujiezhang-ops
yujiezhang-ops requested a review from a team September 26, 2026 11:31
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.

2 participants