Skip to content

fix(hermes-plugin): suppress repeated context recall - #6423

Draft
ehz0ah wants to merge 1 commit into
volcengine:mainfrom
ehz0ah:fix/hermes-recall-dedup-turns
Draft

ehz0ah wants to merge 1 commit into
volcengine:mainfrom
ehz0ah:fix/hermes-recall-dedup-turns

Conversation

@ehz0ah

@ehz0ah ehz0ah commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Description

Hermes context-mode recall passes a session ID, but it did not pass OpenViking's cross-turn deduplication window. The generic context endpoint therefore used its dedup_turns=0 default even though the server recall preset uses five turns.

This change makes the Hermes plugin use that existing server capability. Context-mode recall now suppresses content-bearing memories served within the last five session turns by default. Users can set memory.openviking.recall_dedup_turns from 0 through 100, or use OPENVIKING_RECALL_DEDUP_TURNS. A value of 0 disables suppression.

Source evidence:

A source-pinned experiment confirmed that a five-turn window suppresses two recent content-bearing URIs while retaining an expired entry, a URI-only entry, and an entry from before session rotation. No external implementation code was copied.

Human Involvement

  • A human participated in the implementation or review loop
  • This PR was generated entirely by AI agents without human participation in the loop

Related Issue

External evidence: vectorize-io/hindsight#5925

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Add the bounded recall_dedup_turns Hermes plugin setting with a default of 5.
  • Send the setting only on context-mode recall requests.
  • Document YAML, environment, disable, and scope behavior.
  • Cover default, disabled, and custom request values through the real plugin entrypoint.

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Validation results:

  • Complete Hermes plugin suite: 430 passed, 0 failed across 14 files on the exact PR head.
  • Focused gateway recall suite: 28 passed, including default 5, disabled 0, and custom 8 payload cases.
  • Source-pinned evidence probe: 18 assertions passed and the output remained byte-identical.
  • UV_SYSTEM_CERTS=true uvx ruff check examples/hermes-plugin/__init__.py examples/hermes-plugin/tests/test_gateway_recall.py --ignore I001,B018
  • UV_SYSTEM_CERTS=true uvx ruff format --check --range=124:1-196:1 examples/hermes-plugin/tests/test_gateway_recall.py
  • git diff --check upstream/main...HEAD

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Not applicable.

Additional Notes

This affects only recall with recall_compress: server or auto. The default off path is unchanged. The change adds no storage format, migration, or new deduplication mechanism.

A whole-file Ruff format check for examples/hermes-plugin/__init__.py is not included because that file has pre-existing formatting differences outside this change. The changed test range and lint checks pass. Mypy was not run because the plugin's documented validation path is the external Hermes loader and complete provider suite.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant