fix(memos-local-plugin): episode lifecycle and noise filtering#1607
Open
Starfie1d1272 wants to merge 1 commit intoMemTensor:mainfrom
Open
fix(memos-local-plugin): episode lifecycle and noise filtering#1607Starfie1d1272 wants to merge 1 commit intoMemTensor:mainfrom
Starfie1d1272 wants to merge 1 commit intoMemTensor:mainfrom
Conversation
Three related fixes: - Remove adapter-initiated episode.open in initialize() — the orchestrator creates episodes on first real turn, avoiding empty orphan episodes. - Check traceIds before deciding idle-timeout disposition — episodes with content get finalized (completed), truly empty episodes get abandoned (skipped). Previously all were abandoned regardless of content. - Check rTask in abandon() — episodes that already received async reward scoring keep closeReason: "finalized" instead of being overwritten to "abandoned". Sync closeReason in reward.ts updateMeta(). - Filter Hermes auto-skill evaluation prompts from traces — strip the distinctive "Review the conversation above..." block from both assistant_content and user_content before writing turn.end, and skip turn.start prefetch for these prompts to avoid creating orphan traces.
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.
Summary
Three related fixes targeting episode lifecycle correctness and trace noise reduction.
1. Remove adapter-initiated episode pre-creation
File:
__init__.pyinitialize()was callingepisode.opento pre-create an episode before any real turn. The orchestrator'sturn.startalready creates a proper episode on the first real turn viaopenEpisodeIfNeeded(), so every Hermes session produced 2 episodes — one empty orphan always abandoned.Fix: Remove the premature
episode.opencall.2. Finalize idle-timeout episodes that have content
Files:
memory-core.ts,episode-manager.ts,reward.tsautoFinalizeStaleTasks()was unconditionally callingabandon()even when the episode had real conversation turns. Idle timeout != meaningless conversation.abandon()was always settingcloseReason: "abandoned"even when async reward scoring had already completed (rTaskwas set).reward.tsupdateMeta()was not syncingcloseReasonafter writingrTask.Fix: Check
traceIdsto decide finalize vs abandon. CheckrTaskinabandon()to preserve "finalized" status. SynccloseReasonin reward'supdateMeta().3. Filter Hermes auto-skill evaluation prompts
File:
__init__.pyHermes injects a structured auto-skill eval prompt ("Review the conversation above and consider whether a skill should be saved or updated...") at task end. This system-level scaffolding was captured as conversation content, polluting memory search indices and downstream skill generation.
Fix: Strip auto-skill eval blocks from both
assistant_contentanduser_contentin_turn_end(). Skipturn.startprefetch for these prompts to avoid creating orphan traces.🤖 Generated with Claude Code