Skip to content

fix(recall): scope hook deduplication to the host run - #1019

Merged
rwmjhb merged 1 commit into
CortexReach:masterfrom
igs-rogenlo:fix/recall-dedup-run-identity
Nov 7, 2026
Merged

rwmjhb merged 1 commit into
CortexReach:masterfrom
igs-rogenlo:fix/recall-dedup-run-identity

Conversation

@igs-rogenlo

Copy link
Copy Markdown
Contributor

Problem

An identical user prompt in the same session can skip auto-recall on a later host run. before_prompt_build carries session and run identity in ctx, without an event timestamp. The existing fallback key retains the session and prompt but ignores ctx.runId, so the later request exits before retrieval can see new or changed memories.

This is a focused follow-up to the non-blocking repeated-prompt/run-identity finding recorded on merged PR #919.

Change

Include the host run ID in the structured dedup key, and reuse the existing sha256Hex helper for prompt-derived identity instead of retaining full prompt text in the Set. Duplicate handlers within one run still collapse; changed prompts in the same run still reach retrieval. Regenerate dist/index.js from the source.

Legacy callers without a run ID retain the prior session/event fallback. This patch does not introduce a result cache or claim to distinguish requests when the host supplies no stable invocation identity. The separate per-memory repetition policy remains unchanged.

Validation

  • On current master c0e2c7a3a8b5780b6133ddfd9e2f426bf0ea1b6c, the registered-hook regression suite has four passing controls and one failure: the second run receives no memory context. The new case uses the valid autoRecallMinRepeated: 1 setting to keep the unrelated repetition window from confounding the assertion.
  • With the fix, the registration/dedup suite, auto-recall timeout suite, per-agent recall suite and reflection-bypass suite pass: 38 tests, zero failures. Coverage includes repeated dispatch within a run, identical prompts across runs, distinct prompts in one run, legacy duplicate-handler behavior, timeout handling and agent filtering.
  • npm run build and git diff --check pass. A fresh independent P0–P2 review of the source, regenerated dist and regression completed scoped-clean with no actionable findings.

These tests invoke the actual registered plugin hooks with synthetic retrieval/embedding dependencies. They do not claim real Gateway, provider, channel or natural-conversation acceptance. No stored-data migration or configuration change is required.

@rwmjhb rwmjhb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed ebc8198 through the orchestrator. Approved: adding run identity to the structured dedup key addresses identical prompts in separate runs while preserving duplicate suppression within a run. Targeted and full-suite verification passed.

Integration follow-up: confirm that supported hosts populate ctx.runId consistently across duplicate dispatches and change it between independent runs. When runId is absent, identical timestamp-free events still share a key; the synthetic regression does not establish the real-host contract. Automated build verification was skipped.

@rwmjhb
rwmjhb merged commit a2bd519 into CortexReach:master Nov 7, 2026
1 check passed
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.

2 participants