pi-better-background-tasks 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/runtime.ts +9 -0
package/package.json
CHANGED
package/src/runtime.ts
CHANGED
|
@@ -305,6 +305,15 @@ async function notifyTerminal(
|
|
|
305
305
|
if (meta.callback === false || meta.callbackSentAt || meta.callbackSuppressedAt) return;
|
|
306
306
|
const latest = readMeta(meta.id) ?? meta;
|
|
307
307
|
if (latest.callback === false || latest.callbackSentAt || latest.callbackSuppressedAt) return;
|
|
308
|
+
// Cancellation is an explicit action by the agent or user, so a completion
|
|
309
|
+
// wakeup would be noise. Record the suppression durably so the session_start
|
|
310
|
+
// replay path never fires a callback for a cancelled task either.
|
|
311
|
+
if (latest.status === "cancelled") {
|
|
312
|
+
latest.callbackSuppressedAt = Date.now();
|
|
313
|
+
latest.callbackSuppressedReason = "task was cancelled; no completion callback is needed";
|
|
314
|
+
writeMeta(latest);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
308
317
|
const label = latest.name ? `${latest.name} (${latest.id})` : latest.id;
|
|
309
318
|
getCallbackBatcher(pi).enqueue({
|
|
310
319
|
source: "background-task",
|