agentscope-ai / agentscope-ai/AgentTeams

v1.1.2 K8s 模式下无法给 Manager 添加自定义插件(openclaw plugins enable / 改模板 / spec.config 均失败) || v1.1.2 Unable to add custom plug-ins to Manager in K8s mode (openclaw plugins enable/template change/spec.config all failed)

Đang mở
#938 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:worker-runtime
Ngôn ngữ chính
Go
Star
5.6k
Fork
692
Merge trung bình
5 ngày 4 giờ
Pull request đã merge (30 ngày)
23

Mô tả

## 环境

- HiClaw 版本: v1.1.2
- 部署方式: Docker Compose (K8s mode, `HICLAW_RUNTIME=k8s`)
- Manager 容器: hiclaw-manager
- OpenClaw 版本: 2026.4.14

## 问题描述

在 HiClaw v1.1.2 K8s 模式下,尝试了所有已知方式给 Manager 添加自定义插件(active-memory),均失败。

v1.1.2 release notes 提到的 `fix(legacy): preserve user plugin customizations on Manager config push` (`mergeUserPluginConfig`) 未能解决此问题。

---

## 测试 1:`openclaw plugins enable`(方案 B)

### 步骤

```bash
docker exec -it hiclaw-manager bash
openclaw plugins enable active-memory
```

### 结果:失败

**问题 1: symlink 被打破**

`openclaw plugins enable` 将 `.openclaw/openclaw.json` 从 symlink 替换为 regular file:
- 操作前: `lrwxrwxrwx .openclaw/openclaw.json -> workspace/openclaw.json`
- 操作后: `-rw------- .openclaw/openclaw.json` (regular file, 8664 bytes)

**问题 2: Gateway 读的是另一个文件**

```
OPENCLAW_CONFIG_PATH=/root/manager-workspace/openclaw.json (Gateway 读取此文件)
```

- `.openclaw/openclaw.json`: 8664 bytes, **有** active-memory
- `workspace/openclaw.json`: 8499 bytes, **没有** active-memory

`openclaw plugins enable` 写到了 Gateway 不读的文件。

**问题 3: `mergeUserPluginConfig` 未生效**

重启 Manager 容器触发 Controller reconcile 后:
- workspace 配置被重新生成 (8499 → 9082 bytes)
- **但 plugins 部分没有 active-memory**

```json
{
"entries": {
"matrix": { "enabled": true },
"memory-core": { "enabled": true }
}
}
```

active-memory 没有被 merge 进来。

---

## 测试 2:修改 Manager 模板(方案 A)

### 步骤

1. 修改 Manager 容器内 `/opt/hiclaw/configs/manager-openclaw.json.tmpl`
2. 在 `plugins.entries` 中添加 `"active-memory": { "enabled": true }`
3. 重启 Manager 容器触发 Controller reconcile

### 结果:失败

**原因:Controller 不使用 Manager 容器内的模板。**

- Controller 容器内有自己的缓存:`/tmp/manager-openclaw-fixed.json`
- reconcile 时,Controller 用自己的缓存模板生成配置,完全无视 Manager 容器内的模板修改

---

## 测试 3:修改 Manager CR `spec.config`(K8s API)

### 步骤

1. 通过 K8s API 获取 Manager CR:`GET /apis/hiclaw.io/v1beta1/namespaces/default/managers/default`
2. 发现 `spec.config: {}`(空对象)
3. 通过 PATCH 和 PUT 将 active-memory 插件配置写入 `spec.config`
4. API 返回成功

### 结果:失败

**原因:Controller 不接受 `spec.config` 字段的修改。**

- PATCH/PUT 返回成功,但 Controller reconcile 后 `spec.config` 立刻被重置回 `{}`

---

## 测试 4:`hiclaw apply manager`

### 结果:不支持

`hiclaw apply` 命令只有 `worker` 子命令,没有 `manager` 子命令。

---

## 四个位置的插件配置对比(测试 1 后)

| 位置 | 有 active-memory? | 说明 |
|------|-------------------|------|
| `.openclaw/openclaw.json` | ✅ 有 | `openclaw plugins enable` 写入处,但 Gateway 不读 |
| `workspace/openclaw.json` | ❌ 没有 | Gateway 实际读取 (`OPENCLAW_CONFIG_PATH`) |
| MinIO (`hiclaw-storage/manager/openclaw.json`) | ❌ 没有 | `mc mirror --exclude .openclaw/**` 不同步 `.openclaw/` |
| 模板 (`manager-openclaw.json.tmpl`) | ❌ 没有 | Controller 不使用 Manager 内的模板 |

---

## 汇总

| 方案 | 失败原因 |
|------|----------|
| `openclaw plugins enable` | 写入路径与 Gateway 读取路径不一致,symlink 被打破 |
| 修改 Manager 模板 | Controller 不使用 Manager 内的模板,使用自己的缓存 |
| 修改 Manager CR `spec.config` | Controller reconcile 时重置 `spec.config` 为空 |
| `hiclaw apply manager` | 命令不支持 Manager |
| `mergeUserPluginConfig` (v1.1.2) | 实测未在 reconcile 时保留用户插件配置 |

---

## 请求

1. `mergeUserPluginConfig` 在 v1.1.2 中是否已实际启用?它的设计意图是什么?
2. Manager CR 的 `spec.config` 字段是否计划支持用户自定义配置?
3. 在 K8s 模式下,给 Manager 添加自定义插件的**推荐方式**是什么?

---
## Environment

- HiClaw version: v1.1.2
- Deployment method: Docker Compose (K8s mode, `HICLAW_RUNTIME=k8s`)
- Manager container: hiclaw-manager
- OpenClaw version: 2026.4.14

## Problem description

In HiClaw v1.1.2 K8s mode, all known methods were tried to add a custom plug-in (active-memory) to the Manager, but all failed.

The `fix(legacy): preserve user plugin customizations on Manager config push` (`mergeUserPluginConfig`) mentioned in the v1.1.2 release notes failed to resolve this issue.

---

## Test 1: `openclaw plugins enable` (Option B)

### Steps

```bash
docker exec -it hiclaw-manager bash
openclaw plugins enable active-memory
```

### Result: Failure

**Issue 1: symlink is broken**

`openclaw plugins enable` replaces `.openclaw/openclaw.json` from symlink to regular file:
- Before operation: `lrwxrwxrwx .openclaw/openclaw.json -> workspace/openclaw.json`
- After operation: `-rw------- .openclaw/openclaw.json` (regular file, 8664 bytes)

**Problem 2: Gateway reads another file**

```
OPENCLAW_CONFIG_PATH=/root/manager-workspace/openclaw.json (Gateway reads this file)
```

- `.openclaw/openclaw.json`: 8664 bytes, **has** active-memory
- `workspace/openclaw.json`: 8499 bytes, **no** active-memory

`openclaw plugins enable` writes to a file that Gateway cannot read.

**Question 3: `mergeUserPluginConfig` does not take effect**

After restarting the Manager container to trigger Controller reconciliation:
- workspace configuration is regenerated (8499 → 9082 bytes)
- **But there is no active-memory in the plugins section**

```json
{
"entries": {
"matrix": { "enabled": true },
"memory-core": { "enabled": true }
}
}
```

active-memory is not merged in.

---

## Test 2: Modify the Manager template (Option A)

### Steps

1. Modify `/opt/hiclaw/configs/manager-openclaw.json.tmpl` in the Manager container
2. Add `"active-memory": { "enabled": true }` in `plugins.entries`
3. Restart the Manager container to trigger Controller reconciliation

### Result: Failure

**Cause: Controller does not use templates within the Manager container. **

- The Controller container has its own cache: `/tmp/manager-openclaw-fixed.json`
- When reconciling, the Controller uses its own cached template to generate the configuration, completely ignoring the template modifications in the Manager container.

---

## Test 3: Modify Manager CR `spec.config` (K8s API)

### Steps

1. Obtain Manager CR through K8s API: `GET /apis/hiclaw.io/v1beta1/namespaces/default/managers/default`
2. Found `spec.config: {}` (empty object)
3. Write the active-memory plug-in configuration into `spec.config` through PATCH and PUT
4. API returns success

### Result: Failure

**Cause: Controller does not accept modifications to the `spec.config` field. **

- PATCH/PUT returns successfully, but `spec.config` is immediately reset back to `{}` after Controller reconcile

---

## Test 4: `hiclaw apply manager`

### Result: Not supported

The `hiclaw apply` command only has the `worker` subcommand and no `manager` subcommand.

---

## Comparison of plug-in configurations in four locations (after test 1)

| Location | Is there active-memory? | Description |
|------|-------------------|------|
| `.openclaw/openclaw.json` | ✅ There is | `openclaw plugins enable` written, but Gateway does not read |
| `workspace/openclaw.json` | ❌ None | Gateway actually reads (`OPENCLAW_CONFIG_PATH`) |
| MinIO (`hiclaw-storage/manager/openclaw.json`) | ❌ none | `mc mirror --exclude .openclaw/**` out of sync `.openclaw/` |
| Templates (`manager-openclaw.json.tmpl`) | ❌ None | Controller does not use templates within Manager |

---

## Summary

| Solution | Reason for failure |
|------|----------|
| `openclaw plugins enable` | The write path is inconsistent with the Gateway read path, and the symlink is broken |
| Modify Manager template | Controller does not use the template in Manager, but uses its own cache |
| Modify Manager CR `spec.config` | Reset `spec.config` to empty when Controller reconcile |
| `hiclaw apply manager` | Command not supported Manager |
| `mergeUserPluginConfig` (v1.1.2) | Actual measurement does not preserve user plug-in configuration during reconcile |

---

## Request

1. Is `mergeUserPluginConfig` actually enabled in v1.1.2? What is its design intent?
2. Is the `spec.config` field of Manager CR planned to support user-defined configuration?
3. In K8s mode, what is the **recommended way** to add custom plug-ins to Manager?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.