Skip to content

fix: complete Issue #492 protection -- per-agent exclusion + configurable serial cooldown#520

Closed
jlin53882 wants to merge 3 commits intoCortexReach:masterfrom
jlin53882:fix/issue-492-v5
Closed

fix: complete Issue #492 protection -- per-agent exclusion + configurable serial cooldown#520
jlin53882 wants to merge 3 commits intoCortexReach:masterfrom
jlin53882:fix/issue-492-v5

Conversation

@jlin53882
Copy link
Copy Markdown
Contributor

Problem

Issue #492: memoryReflection hooks in before_prompt_build synchronously execute
LanceDB queries on every user session, causing 30-50% of sessions to fail.

Solution

Per-agent exclusion mechanism via autoRecallExcludeAgents + configurable serial cooldown.

Changes

1. isAgentOrSessionExcluded helper

Supports exact/wildcard-prefix/temp:* patterns.

2. Fixed auto-recall before_prompt_build exclusion check

Removed ineffective agentId !== undefined check.

3. Added exclusion checks to both reflection before_prompt_build hooks

Priority 12 and 15 now have isInternal guard + exclusion check.

4. Three-layer guard on runMemoryReflection command hook

  • Internal session guard
  • Re-entrant guard (Symbol.for + globalThis)
  • Serial cooldown guard (now configurable)

5. serialCooldownMs now configurable (THIS COMMIT)

Added to PluginConfig interface and openclaw.plugin.json schema.
Users can now adjust via openclaw.json without code changes.

6. Added internal session guard to appendSelfImprovementNote

Consistent with agent:bootstrap hook.

7. Enhanced early-return logging with sessionKey/sessionId

openclaw.json Usage

{
  "memory-lancedb-pro": {
    "memoryReflection": {
      "serialCooldownMs": 60000
    },
    "autoRecallExcludeAgents": ["memory-distiller", "pi-", "temp:*"]
  }
}

Questions for Maintainers

  1. Is dual-purpose autoRecallExcludeAgents acceptable, or split into reflectionExcludeAgents?
  2. Is 120s default cooldown reasonable?
  3. Any concerns about globalThis + Symbol.for for lock maps?

Related to: #492
See also: Issue #514

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@jlin53882
Copy link
Copy Markdown
Contributor Author

PR #520 Changes (vs #516)

1. serialCooldownMs now configurable (THIS PR)

  • Added serialCooldownMs to PluginConfig interface (L205)
  • Added serialCooldownMs to openclaw.plugin.json schema under memoryReflection.properties
  • Changed serial guard to read from cfg.memoryReflection.serialCooldownMs (defaults to 120_000ms)
  • Users can now adjust cooldown via openclaw.json without code changes

Example in openclaw.json:
{
"memory-lancedb-pro": {
"memoryReflection": {
"serialCooldownMs": 60000
}
}
}

2. openclaw.plugin.json schema fixes (THIS PR)

  • Added autoRecallExcludeAgents to top-level schema properties (it was missing -- OpenClaw would strip it due to additionalProperties: false)
  • Added excludeAgents to memoryReflection.properties
  • These were previously only in PluginConfig TypeScript interface, not in the JSON schema

3. Previous fixes from #516

  • Removed duplicate autoRecallExcludeAgents declaration
  • Confirmed template literal is correct
  • 3-layer guard on runMemoryReflection
  • Internal session guard on appendSelfImprovementNote
  • Enhanced early-return logging

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.

1 participant