Repository navigation
fix(minimax-bot-team): write the state that forgets a chat before its transcript is cleared - #139
Merged
MyPrototypeWhat merged 1 commit intoNov 16, 2026
Conversation
… transcript is cleared This answers the first point of issue MiniMax-AI#136. Deleting a chat cleared the transcript first and saved the state afterwards. When the state write failed, the transcript was already gone: the chat stayed in the sidebar and its messages were lost for good, with no way to get them back. The state that no longer lists the chat now goes to disk first, and the transcript is cleared only after that write succeeded. A failed write leaves the chat and its messages exactly as they were, and the caller can simply try again - the same order the official minimax-bot package uses since MiniMax-AI#135. The test that covers it travels with the package, so it can be run against the package itself: node --test plugins/antianqi/minimax-bot-team/tests/chat-delete-atomicity.test.mjs It replaces state.json with a directory of the same name, so every write to it fails, and then checks that the messages are still on disk, that the live state still knows the chat, and that after the state file is put back and the store is restarted the chat and its messages are still there. The second test checks that a delete that succeeds does clear the transcript and forget the chat. Checks: the test passes against the package (2/2), the upstream validator reports 0 errors and 1 warning for this package (ENTRY_STDOUT - the stdout in question is the memory helper's own output channel), and npm run check passes 92/92. Version 1.0.1.
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.
Addresses the minimax-bot-team half of #136 (point 1: chat messages are cleared even when saving state fails).
What was wrong
Store.deleteChat()cleared the transcript first and saved the state afterwards:When the state write failed, the transcript was already gone. The chat stayed in the
sidebar, but its messages were lost for good - nothing could get them back.
What changed
miniapp/node/store.mjswrites the state that no longer lists the chat first, and clearsthe transcript only after that write succeeded:
A failed state write now leaves both the chat and its messages exactly as they were,
and the caller can try again. This is the same order the official minimax-bot package
uses since #135.
The test
The package carries the test that covers it, so it can be run against the package
itself:
It follows the steps of the report: it appends messages to an existing chat, replaces
state.jsonwith a directory of the same name so every write to it fails (EISDIR,the same injection), calls
deleteChat, and then checks thatStoreis initialized, the chat and itsmessages are still there.
A second test checks that a delete that succeeds does clear the transcript and forget
the chat.
The test was falsified before it was shipped: with the old order put back into the
package it fails with
the messages are still on disk(1 pass, 1 fail); with the fixit passes 2/2.
Version
1.0.1 - the manifest, package.json, the plugin id module and both READMEs carry it.
Checks
node --test plugins/antianqi/minimax-bot-team/tests/chat-delete-atomicity.test.mjs- 2/2npm run validate- this package: 0 errors, 1 warning (ENTRY_STDOUTinminiapp/node/memory-bridge.mjs, the helper's own output channel - unchanged from1.0.0)
npm run check- 92/92The second point of #136 (mmx-octopus) is a different package and a different pull
request.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.