Skip to content

feat(memos-local-openclaw): support profile-aware OpenClaw paths#1225

Open
Larkspur-Wang wants to merge 1 commit intoMemTensor:openclaw-local-plugin-20260324from
Larkspur-Wang:feat/openclaw-profile-aware-plugin
Open

feat(memos-local-openclaw): support profile-aware OpenClaw paths#1225
Larkspur-Wang wants to merge 1 commit intoMemTensor:openclaw-local-plugin-20260324from
Larkspur-Wang:feat/openclaw-profile-aware-plugin

Conversation

@Larkspur-Wang
Copy link

Background | 背景

Closes #1224

memos-local-openclaw still falls back to ~/.openclaw in several runtime paths, which breaks instance isolation when OpenClaw is started with --profile.

memos-local-openclaw 在若干运行时路径上仍然会回退到 ~/.openclaw,这会破坏 OpenClaw 使用 --profile 启动时的实例隔离。

This can cause the plugin to read or write config, viewer data, migration sources, and fallback model settings from the default instance instead of the active profile instance.

这会导致插件从默认实例而不是当前 profile 实例读取或写入配置、viewer 数据、migration 数据源,以及 fallback model 配置。

Changes | 改动

  • add profile-aware OpenClaw path helpers

  • make viewer config read/write use the active instance state dir

  • make viewer migration scan use the active instance state dir

  • make OpenClaw fallback model config load from the active instance state dir

  • pass stateDir through the summarizer call chain

  • keep default behavior unchanged when no explicit profile state dir is provided

  • 增加 profile-aware 的 OpenClaw 路径辅助函数

  • 让 viewer 的配置读写使用当前实例的 stateDir

  • 让 viewer 的 migration 扫描使用当前实例的 stateDir

  • 让 OpenClaw fallback model 配置从当前实例的 stateDir 加载

  • 在 summarizer 调用链中透传 stateDir

  • 在未提供显式 profile stateDir 时保持默认行为不变

Tests | 测试

  • npm run build
  • npm test -- tests/profile-paths.test.ts tests/plugin-impl-access.test.ts tests/shutdown-lifecycle.test.ts

Scope | 范围说明

  • no schema changes

  • no recall algorithm changes

  • no embedding algorithm changes

  • no install-script or README changes in this PR

  • 不涉及 schema 变更

  • 不涉及 recall 算法变更

  • 不涉及 embedding 算法变更

  • 本 PR 不包含安装脚本或 README 修改

@CaralHsi CaralHsi deleted the branch MemTensor:openclaw-local-plugin-20260324 March 16, 2026 08:29
@CaralHsi CaralHsi closed this Mar 16, 2026
@CaralHsi CaralHsi reopened this Mar 23, 2026
@CaralHsi CaralHsi changed the base branch from dev-20260309-v2.0.9 to dev-20260323-v2.0.11 March 23, 2026 07:24
@hijzy hijzy changed the base branch from dev-20260323-v2.0.11 to openclaw-local-plugin-20260324 March 24, 2026 11:50
@hijzy
Copy link
Collaborator

hijzy commented Mar 24, 2026

PR Review

This PR enables OpenClaw profile support by making all paths to openclaw.json and the OpenClaw home directory respect the stateDir parameter instead of hardcoded ~/.openclaw. It introduces two new utility functions getOpenClawHome() and getOpenClawConfigPath() in config.ts, then propagates stateDir through Summarizer, loadOpenClawFallbackConfig(), buildSkillConfigChain(), ViewerServer, and the recall engine. A comprehensive test file (profile-paths.test.ts) validates that profile-specific config is loaded correctly.

The approach is clean and consistent — the change is mostly mechanical propagation of an existing parameter. The test coverage is good. This is an important feature for multi-profile/multi-instance deployments.

此 PR 通过引入 getOpenClawHome()getOpenClawConfigPath() 两个工具函数,使所有 OpenClaw 配置路径遵循 stateDir 参数而非硬编码的 ~/.openclaw,支持多 profile/多实例部署。改动贯穿多个模块但都是机械性参数传递,附带完整单元测试。实现干净一致。

  • Safety: ✅ Safe
  • Mergeable: ✅ Yes
  • Confidence: 5/5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants