fix: track message.updated for mining#6
Open
fengjikui wants to merge 2 commits into
Open
Conversation
Author
|
Self-review against anomalyco/opencode at 7c76bd6 found that the current runtime triggers chat.message and then publishes message.updated for the same user message, while assistant lifecycle updates publish additional message.updated events. Commit 1758a6c now counts only user-message updates and deduplicates the compatibility hook by message ID, using output.message.id when the optional input messageID is absent. Validation: full suite (22 tests), build, lint, Prettier, npm pack dry-run, and git diff --check. |
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
message.updatedevents in the plugineventhook so MemPalace marks active sessions as dirtychat.messagecompatibility hookmessage.updatedas the primary message activity signalRoot cause
OpenCode publishes message activity through the
eventhook asmessage.updated, but the plugin only incremented its per-session message counter from achat.messagehook. In the affected flow, relying onchat.messagealone leftstateManager.hasPendingMessages(sessionID)false onsession.idle, so conversation mining was skipped after normal chat activity. Current OpenCode can also emitchat.messageandmessage.updatedfor the same user message, so the two signals are deduplicated by message ID.Fixes #4.
Validation
npm test -- --runInBand src/index.test.ts -t 'tracks OpenCode message.updated'failed with zeromine()callsnpm test -- --runInBand(22 tests)npm run buildnpm run lintnpx prettier --check src/index.ts src/index.test.ts README.mdgit diff --checknpm pack --dry-run --json