Skip to content

fix: register retry + resetRegistration + isOwnedByAgent fail-closed (#448)#15

Closed
jlin53882 wants to merge 5 commits intofix/issue-448-v2from
fix/pr522-3-bugs
Closed

fix: register retry + resetRegistration + isOwnedByAgent fail-closed (#448)#15
jlin53882 wants to merge 5 commits intofix/issue-448-v2from
fix/pr522-3-bugs

Conversation

@jlin53882
Copy link
Copy Markdown
Owner

fix: register retry + resetRegistration + isOwnedByAgent fail-closed (CortexReach#448)

修復 PR CortexReach#522 的 3 個問題:

  1. Bug 1: register() 失敗後同一 API instance 可重試

    • _registeredApis 從 WeakSet 改為 Map
    • try-catch 包住初始化,.set(api, true) 在成功後才執行
    • catch block 不呼叫 .set(),允許失敗後重試
  2. Bug 2: resetRegistration() 真正清除狀態

    • WeakSet 無法 clear,改用 Map 後可呼叫 .clear()
    • 新增 _getRegisteredApisForTest() 供測試用
  3. Bug 3: isOwnedByAgent malformed itemKind fail-closed

    • type=memory-reflection-item 時,只有 invariant/derived 合法
    • 非法的 itemKind(如 weird-kind、空字串、數字等)→ return false
    • 修復 main derived 會洩漏給 sub-agent 的問題

新增測試:

  • test/isOwnedByAgent.test.mjs (19 tests)
  • test/register-reset.test.mjs (17 tests)

Tony-ooo and others added 5 commits April 6, 2026 21:54
Add 'skills' field to openclaw.plugin.json to enable OpenClaw automatically discover skills in plugin directory

- openclaw.plugin.json: add "skills": ["./skills"] configuration
- skills/lesson/SKILL.md: add metadata config dependency declaration
…required (OpenClaw 2026.4.5 compat) (CortexReach#541)

* fix: remove duplicate memory_compact tool registration in index.ts

memory_compact was registered twice when enableManagementTools is true:
once via registerAllMemoryTools() → registerMemoryCompactTool() in
src/tools.ts, and again in a standalone block in index.ts (lines
2116–2202). OpenClaw 2026.4.5 now throws on duplicate tool name
registration, causing plugin initialization failure.

The standalone block in index.ts is the stale duplicate — the canonical
implementation lives in src/tools.ts and is already wired through
registerAllMemoryTools().

* fix: remove redundant required: ["embedding"] from configSchema root

OpenClaw 2026.4.5 changed how config values are passed to the AJV
validator during framework-level validation. The root-level
required: ["embedding"] constraint fails because the config object
reaching the validator may not have the embedding key at the time of
framework validation (timing/default-handling change).

This constraint was always redundant: the plugin's own
parsePluginConfig() already validates embedding.apiKey presence at
load time, and embedding.required: ["apiKey"] in the sub-schema
still catches misconfiguration.

---------

Co-authored-by: Max Eschbach <maxeschbach@macbookair.local>
* fix: parse autoRecallTimeoutMs in parsePluginConfig with 3000ms default

* fix: raise parsePluginConfig autoRecallTimeoutMs default from 3000 to 5000ms
…ortexReach#448)

修復 PR CortexReach#522 的 3 個問題:

1. Bug 1: register() 失敗後同一 API instance 可重試
   - _registeredApis 從 WeakSet 改為 Map
   - try-catch 包住初始化,.set(api, true) 在成功後才執行
   - catch block 不呼叫 .set(),允許失敗後重試

2. Bug 2: resetRegistration() 真正清除狀態
   - WeakSet 無法 clear,改用 Map 後可呼叫 .clear()
   - 新增 _getRegisteredApisForTest() 供測試用

3. Bug 3: isOwnedByAgent malformed itemKind fail-closed
   - type=memory-reflection-item 時,只有 invariant/derived 合法
   - 非法的 itemKind(如 weird-kind、空字串、數字等)→ return false
   - 修復 main derived 會洩漏給 sub-agent 的問題

新增測試:
- test/isOwnedByAgent.test.mjs (19 tests)
- test/register-reset.test.mjs (17 tests)
@jlin53882 jlin53882 closed this Apr 10, 2026
@jlin53882 jlin53882 deleted the fix/pr522-3-bugs branch April 10, 2026 08:15
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.

4 participants