Skip to content

fix: skip autoRecall for heartbeat/NO_REPLY turns#148

Open
eisen0419 wants to merge 1 commit intoCortexReach:masterfrom
eisen0419:fix/issue-137-heartbeat-autorecall-skip
Open

fix: skip autoRecall for heartbeat/NO_REPLY turns#148
eisen0419 wants to merge 1 commit intoCortexReach:masterfrom
eisen0419:fix/issue-137-heartbeat-autorecall-skip

Conversation

@eisen0419
Copy link

Summary

Heartbeat / NO_REPLY turns were still triggering autoRecall injection, causing compaction-related latency spikes (minutes-long delays).

Changes

  • src/adaptive-retrieval.ts:
    • Added NO_REPLY, HEARTBEAT_OK, health_check, system_check and variants to SKIP_PATTERNS
    • Added heartbeat/healthcheck wrapper stripping in normalizeQuery() (e.g. [heartbeat] ..., heartbeat: ...)
  • test/adaptive-retrieval-skip-heartbeat.test.mjs: 9 test cases covering all heartbeat variants
  • package.json: added new test to npm test pipeline

Root cause

shouldSkipRetrieval() already had /HEARTBEAT/i but missed:

  • NO_REPLY (common heartbeat prompt)
  • HEARTBEAT_OK / heartbeat ok variants
  • health_check / system_check patterns
  • Prefixed formats like [heartbeat] NO_REPLY or heartbeat: NO_REPLY

Test plan

  • All 9 new heartbeat skip tests pass
  • Verify existing tests still pass (note: smart-extractor-branches.mjs has a pre-existing failure unrelated to this change)

Closes #137

Add NO_REPLY, HEARTBEAT_OK, health_check, system_check and their
variants to SKIP_PATTERNS so heartbeat turns no longer trigger
autoRecall injection.  Also strip heartbeat/healthcheck wrapper
prefixes in normalizeQuery() before pattern matching.

Closes CortexReach#137
@eisen0419
Copy link
Author

CI failure note

The CI failure is a pre-existing issue on master, unrelated to this PR's changes.

The plugin-manifest-regression.mjs test fails because openclaw.plugin.json has version 1.1.0-beta.4 while package.json has 1.1.0-beta.5:

AssertionError [ERR_ASSERTION]: openclaw.plugin.json version should stay aligned with package.json
+ '1.1.0-beta.4'
- '1.1.0-beta.5'

This version mismatch exists on the current master branch and affects all PRs based on it.

@AliceLJY
Copy link
Collaborator

Review: fix: skip autoRecall for heartbeat/NO_REPLY turns

Verdict: Fix-then-merge — one blocking item before merge.


✅ What's working

  • All 9 new unit tests pass (adaptive-retrieval-skip-heartbeat.test.mjs)
  • New test file is correctly wired into npm test pipeline
  • normalizeQuery() + SKIP_PATTERNS two-layer design is clean: strip wrapper prefix first, then pattern-match the residual
  • The existing unanchored /HEARTBEAT/i acts as a safety net for compound strings; the new anchored patterns complement it without conflicting
  • Dynamic test (simulated via Discord): 3/4 heartbeat-style messages correctly skipped recall

🔴 Blocking (please fix before merge)

No negative test cases. The test suite has 9 "should skip" cases but zero "should NOT skip" cases. Without negative coverage, a future regex change could silently over-match real user messages and no test would catch it.

Suggested additions to adaptive-retrieval-skip-heartbeat.test.mjs:

// These should NOT be skipped
assert.equal(shouldSkipRetrieval("I got no reply from the server"), false);
assert.equal(shouldSkipRetrieval("noreply@example.com"), false);
assert.equal(shouldSkipRetrieval("system check required before deployment"), false);
assert.equal(shouldSkipRetrieval("my health check results came back"), false);

🟡 Non-blocking notes

  1. no reply (space variant) not coveredno[_-]?reply matches no_reply/no-reply but not no reply. In practice this falls through to the 15-char length filter so it won't cause latency, but worth a comment noting the intentional gap.

  2. Pre-existing CI failureplugin-manifest-regression fails due to openclaw.plugin.json (v1.1.0-beta.4) vs package.json (v1.1.0-beta.5) version mismatch on master. Unrelated to this PR; should be fixed on master separately.

  3. Merge order — PRs fix: respect framework-level memorySearch.enabled switch in autoRecall #141 and fix: relax autoRecall skip on first turn of fresh session #123 both touch shouldSkipRetrieval() logic. Suggest merging this one first as it's the most self-contained.


Good catch on the HEARTBEAT_OK / health_check gaps — the original /HEARTBEAT/i was clearly not enough. Surgical fix, proportional to the problem.

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.

Heartbeat / NO_REPLY turns may still trigger autoRecall injection and cause compaction-related latency

2 participants