Skip to content

fix: Title: memos-local-openclaw-plugin corrupts openclaw.json by inserting "group:plugins" into models[*].input #1377

Closed

Description

@CN-P5

Pre-submission checklist | 提交前检查

  • I have searched existing issues and this hasn't been mentioned before | 我已搜索现有问题,确认此问题尚未被提及
  • I have read the project documentation and confirmed this issue doesn't already exist | 我已阅读项目文档并确认此问题尚未存在
  • This issue is specific to MemOS and not a general software issue | 该问题是针对 MemOS 的,而不是一般软件问题

Bug Description | 问题描述

What happened:
After installing/enabling the memos-local plugin, startup logs show:
memos-local: added 'group:plugins' to tools.allow in openclaw.json
But instead of being added to tools.allow, the config becomes corrupted and "group:plugins" is inserted into:
models.providers.xxxxxx.models.0.input
Example broken config:
"input": ["text", "image", "group:plugins"]
Validation error:
models.providers.xxxxxx.models.0.input.2: Invalid input (allowed: "text", "image")
Expected:
"group:plugins" should only be added under tools.allow, or not written automatically at all.
Actual:
The plugin writes/merges config into the wrong path, corrupting model config.

How to Reproduce | 如何重现

  1. Start from a valid ~/.openclaw/openclaw.json that contains a provider model config like:
{
  "models": {
    "providers": {
      "xxxxx": {
        "models": [
          {
            "id": "qwen3.5-plus-search",
            "name": "qwen3.5-plus-search",
            "input": ["text", "image"]
          }
        ]
      }
    }
  }
}
  1. Install the plugin
  2. Restart OpenClaw gateway or start OpenClaw so the plugin initializes.
  3. Check the logs
  4. Observe that the plugin logs
  5. Then inspect ~/.openclaw/openclaw.json
  6. In my case, instead of only updating tools.allow, the config became corrupted and "group:plugins" was inserted into:models.providers.xxxxx.models[0].input
  7. OpenClaw then fails config validation with:
models.providers.xxxxx.models.0.input.2: Invalid input (allowed: "text", "image")

Environment | 环境信息

Environment:

  • OpenClaw 2026.3.23-2
  • @memtensor/memos-local-openclaw-plugin 1.0.7

Additional Context | 其他信息

No response

Willingness to Implement | 实现意愿

  • I'm willing to implement this myself | 我愿意自己解决
  • I would like someone else to implement this | 我希望其他人来解决

Activity

  1. added
    ai:taskDispatched to AI coding agent | 已派发给 AI 编码任务
    on Jun 29, 2026
  2. Memtensor-AI commented on Jun 30, 2026

    @Memtensor-AI
    Collaborator

    🤖 AutoDev has picked up this issue and started working on it.

    Task ID: 57250d8598d12340
    Working branch: bugfix/autodev-1377
    Target branch: latest dev* branch
    Workflow: opsp (analysis → coding → testing → PR)

    I will post the PR link here once done. If I need more information, I will ask in the comments.

  3. self-assigned this
    on Jun 30, 2026
  4. Memtensor-AI commented on Jun 30, 2026

    @Memtensor-AI
    Collaborator

    ✅ AutoDev task 57250d8598d12340 completed.

    Summary: Fixes #1377: the memos-local-openclaw plugin was corrupting ~/.openclaw/openclaw.json by writing "group:plugins" into models.providers..models[].input instead of tools.allow.

    Root cause: the original implementation in apps/memos-local-openclaw/index.ts used a non-global String.replace against the raw JSON text. The regex looked for the JSON literal of the last tools.allow entry followed by ]. Because models.providers..models[].input appears before tools.allow in the default OpenClaw layout, and the input array often ends with the same literal (e.g. "image") as the last tools.allow entry, the first match landed inside the wrong array. The literal was also fed to RegExp without escaping regex metacharacters.

    Fix: extracted a small pure helper ensureToolsAllowEntry(raw, entry) in apps/memos-local-openclaw/src/openclaw-config.ts that parses the JSON, appends the entry to tools.allow only, and re-serialises while preserving the original indent and trailing newline. The helper is a no-op when the entry is already present, when tools.allow contains "*", when tools.allow is missing/empty, or when the input cannot be parsed. index.ts now calls the helper instead of running the textual patch.

    Tests: added tests/openclaw-config.test.ts with 8 cases, including a direct regression reproducing the exact input/allow shape from the issue. Verified locally: vitest run on the new test plus 5 neighbouring suites — 35/35 passed in 8.96s; tsc --noEmit clean. Pushed bugfix/autodev-1377 to origin; opsp specs archived to memos-autodev-specs#main (commit ca26b01). Scheduler should now open the PR against dev-20260624-v2.0.22.

    Base branch: main
    Branch: bugfix/autodev-1377
    Commit: cae4e4a
    PR: #1980
    Assigned to: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller
    Reviewers: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller

  5. added
    ai:testingAI agent is running tests | AI 正在运行测试
    ai:pr-readyAI-created PR is ready for review | AI 生成的 PR 已等待评审
    and removed
    ai:codingAI agent is coding | AI 正在编码
    ai:testingAI agent is running tests | AI 正在运行测试
    ai:taskDispatched to AI coding agent | 已派发给 AI 编码任务
    on Jun 30, 2026
  6. added a commit that references this issue on Jul 1, 2026
    e0af149
  7. added and removed
    ai:pr-readyAI-created PR is ready for review | AI 生成的 PR 已等待评审
    on Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:pluginOpenClaw & Hermestypes:bugSomething isn't working | 功能异常

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions