Skip to content

feat: add configurable auto-recall timeout with safer default#316

Open
AliceLJY wants to merge 9 commits intoCortexReach:masterfrom
AliceLJY:feat/configurable-auto-recall-timeout
Open

feat: add configurable auto-recall timeout with safer default#316
AliceLJY wants to merge 9 commits intoCortexReach:masterfrom
AliceLJY:feat/configurable-auto-recall-timeout

Conversation

@AliceLJY
Copy link
Collaborator

Summary

  • Add autoRecallTimeoutMs config option to control auto-recall startup timeout (default 8000ms)
  • Wrap orchestrateDynamicRecall in Promise.race with the configurable timeout
  • On timeout, log a warning and skip memory injection gracefully (no agent startup stall)

Problem

After the orchestrateDynamicRecall refactor, the before_agent_start hook had no timeout guard — slow embedding API calls could stall agent startup indefinitely. The previous beta.9 had a hard-coded 3000ms timeout which was too aggressive for remote embedding setups; the current main lost the timeout entirely.

Usage

{
  "autoRecallTimeoutMs": 12000
}

No change needed for existing users — default is 8000ms, up from the old 3000ms.

Changes

1 file changed, 17 insertions(+), 1 deletion(-)

  • index.ts: Add autoRecallTimeoutMs to PluginConfig, add DEFAULT_AUTO_RECALL_TIMEOUT_MS constant, wrap recall pipeline in Promise.race timeout, parse config value in config resolver

Related

Closes #314 — thanks @chinaboard for the detailed report.

Test plan

  • All 37 existing tests pass
  • Verify default 8000ms timeout applies when autoRecallTimeoutMs is not set
  • Verify custom timeout (e.g. 12000) is respected
  • Verify timeout triggers graceful skip with warning log, not a crash

🤖 Generated with Claude Code

furedericca-lab and others added 9 commits March 8, 2026 10:43
…focus-note-handoff

feat(refactor): rework reflection handoff note and drop legacy combined rows
…command-hook-lifecycle

fix(reflection): restore /new-/reset trigger reliability after startup hook reset
Co-authored-by: furedericca <263020793+furedericca-lab@users.noreply.github.com>
Co-authored-by: furedericca <263020793+furedericca-lab@users.noreply.github.com>
The auto-recall pipeline in before_agent_start had no timeout guard
after the orchestrateDynamicRecall refactor, meaning slow embedding API
calls could stall agent startup indefinitely.

- Add autoRecallTimeoutMs config option (default 8000ms)
- Wrap orchestrateDynamicRecall in Promise.race with configurable timeout
- On timeout, log warning and skip injection gracefully

Closes CortexReach#314

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
"minimum": 1,
"maximum": 100,
"default": 10,
"description": "Per normalized text key, keep only the most recent N entries before Auto-Recall final trimming."

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index.ts parses autoRecallTimeoutMs, but openclaw.plugin.json still has additionalProperties: false and does not declare this key anywhere in configSchema/uiHints. As a result, normal config validation and settings-driven discovery will reject or hide the new option, so the feature is not actually configurable for users.

if (isRedundant) {
api.logger.debug?.(
`memory-lancedb-pro: skipping redundant memory ${r.entry.id.slice(0, 8)} (last seen at turn ${lastTurn}, current turn ${currentTurn}, min ${minRepeated})`,
const result = await Promise.race([

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Promise.race() only abandons the awaited result; it does not cancel orchestrateDynamicRecall(). That helper mutates per-session repeated-injection state before/after loadCandidates(), so a timed-out recall can still finish later in the background and mark rows as “already injected” even though nothing was added to the prompt for this turn.

{
"name": "memory-lancedb-pro",
"version": "1.1.0-beta.4",
"version": "1.1.0-beta.5",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch is still carrying an old package snapshot. Current master is already at 1.1.0-beta.9, so keeping beta.5 here means the PR is effectively built on a stale base and will roll version metadata backwards unless it is rebased/refreshed first.

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.

[Enhancement] auto-recall 3000ms timeout is too aggressive and should be configurable

3 participants