afterTurn: store messages with actual roles and skip heartbeat messages#1340
Merged
Mijamind719 merged 1 commit intovolcengine:mainfrom Apr 9, 2026
Merged
afterTurn: store messages with actual roles and skip heartbeat messages#1340Mijamind719 merged 1 commit intovolcengine:mainfrom
Mijamind719 merged 1 commit intovolcengine:mainfrom
Conversation
- Store messages with their actual roles (user/assistant) instead of merging all into a single user message - Map toolResult to user role, merge adjacent same-role messages - Sanitize <relevant-memories> only from user content, not assistant - Add extractSingleMessageText helper in text-utils - Skip heartbeat messages via isHeartbeat flag and content detection Made-with: Cursor
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
Mijamind719
approved these changes
Apr 9, 2026
zeattacker
pushed a commit
to zeattacker/OpenViking
that referenced
this pull request
Apr 10, 2026
…gine#1340 hand-merged) Cherry-picked upstream 68e4d89 with manual conflict resolution against our prior plugin commit acbb7f9 (pinned context injection, recall refactor). Three changes from volcengine#1340: 1. Role-preserving message storage (the main feature): Instead of collapsing entire turns into a single 'user' addSessionMessage call, iterate turnMessages and group adjacent same-role messages by actual role (user/assistant). Sends one addSessionMessage per group, preserving conversation structure for OpenViking. Replaces the previous join-everything-as-user logic. 2. Heartbeat filters (defense in depth, not replacement): - Session-level: 'if (afterTurnParams.isHeartbeat) return;' early-return when the calling code flags the whole turn as a heartbeat. - Per-message: HEARTBEAT_RE = /\bHEARTBEAT(?:\.md|_OK)\b/ drops individual heartbeat messages within a turn. These are narrow (uppercase HEARTBEAT only) and complement — not replace — our broader server-side trivial filter at openviking/session/session.py _is_trivial_session, which catches lowercase heartbeat/health_check/ping for ANY ingest path (CLI, eval, future clients), not just the plugin. 3. extractSingleMessageText helper in text-utils.ts (additive). Hand-merge decisions vs upstream: - Imports collision: kept both extractLastAssistantText (ours) and extractSingleMessageText (volcengine#1340). - Backoff guard order: heartbeat early-return placed BEFORE the consecutive- failure backoff guard so heartbeats never increment failure counters. - addSessionMessage call arity fix: volcengine#1340's loop calls 5-arg form (id, role, content, agentId, createdAt) which would put agentId in our parts? slot. Updated to 6-arg form (id, role, content, undefined, agentId, createdAt) matching client.ts signature. - Inline commit block at the end of volcengine#1340: dropped. Our architecture routes commits through doCommitOVSession (separate function with alignment + drift detection hooks). Reintroducing the inline commit would conflict with that routing. Co-Authored-By: claude-flow <ruv@ruv.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Made-with: Cursor
Description
Related Issue
Type of Change
Changes Made
Testing
Checklist
Screenshots (if applicable)
Additional Notes