🐛 fix(userMemories): missing cancel webhook api for cascading cancellation#13742
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## canary #13742 +/- ##
=========================================
Coverage 66.56% 66.56%
=========================================
Files 2020 2020
Lines 171174 171203 +29
Branches 16641 20675 +4034
=========================================
+ Hits 113941 113964 +23
- Misses 57109 57115 +6
Partials 124 124
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bab5349d3d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| metadata: nextMetadata, | ||
| status: AsyncTaskStatus.Error, | ||
| }); |
There was a problem hiding this comment.
Keep cancelled tasks terminal during in-flight completions
This handler writes status: Error once, but topic workers that were already running still call incrementUserMemoryExtractionProgress in src/server/services/memory/userMemory/extract.ts, which unconditionally rewrites status to processing or success. If cancellation arrives mid-topic, the task can leave the cancelled state and look active/completed again, so cancellation is not durable.
Useful? React with 👍 / 👎.
| const asyncTaskModel = new AsyncTaskModel(db, task.userId); | ||
| await asyncTaskModel.update(task.id, { | ||
| error: new AsyncTaskError( | ||
| AsyncTaskErrorType.TaskCancelled, |
There was a problem hiding this comment.
Reject cancellation for tasks that are already finished
The route updates any matching task to TaskCancelled without first verifying it is still pending/processing. A delayed or retried cancel webhook can therefore overwrite a previously success (or already failed) task into cancelled, which corrupts task history and misreports state to clients.
Useful? React with 👍 / 👎.
💻 Change Type
🔗 Related Issue
🔀 Description of Change
🧪 How to Test
📸 Screenshots / Videos
📝 Additional Information