tam0w
tam0w2w ago

DeleteByOrder not working

Facing an issue with the convex-agent, I think the docs are kinda outdated for deleting messages. I've tried using deletebyorder, but it just only deletes one message, not the ones after that, not till the end of the thread? Am I using it correctly to delete messages? I want to delete all messages after a certain message, the use case is: a user edits a message in the conversation, I delete all the messages in the thread including that, and then resend the updated message in the thread const result = await ctx.runMutation( components.agent.messages.deleteByOrder, { threadId: threadId as any, startOrder: messageOrder, endOrder: messageOrder + 63, } );
console.log(messageOrder, result) This is what I got in my log when I did my editMessage mutation, which deletes here ^ and then sends a message 27/11/2025, 10:01:53 am [CONVEX M(messages:editMessage)] [LOG] 1 { isDone: true, lastOrder: 1, lastStepOrder: 1 }
No description
5 Replies
tam0w
tam0wOP2w ago
After editing the message with index 1, and using that as a startOrder, it only deletes that and not the messages after that, like index 2.. (index 3 message is my edited message being sent again)
No description
tam0w
tam0wOP2w ago
Bump
ian
ian7d ago
Hey there! FYI in the future if you file an issue on GitHub it's easier to track. I just released a new version that should fix this issue. Can you check if it fixed in @convex-dev/agent@0.3.2?
tam0w
tam0wOP7d ago
Thanks @ian , I'll keep that in mind. In the future if I do come across a bug like this would you prefer I just create a PR also? I don't mind
ian
ian6d ago
Yes PRs welcome too! Sorry you ran into that bug - the existing test was dumb and was only checking within one order for the bounded case

Did you find this page helpful?