@monotykamary/pi-retry 0.3.1 → 0.3.2
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/retry.ts +9 -8
package/package.json
CHANGED
package/retry.ts
CHANGED
|
@@ -313,7 +313,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
313
313
|
// GUARDS (three layers):
|
|
314
314
|
// 1. _continueInProgress mutex — prevents concurrent calls from racing
|
|
315
315
|
// 2. isStreaming pre-flight — detects user-initiated runs before prompt()
|
|
316
|
-
// 3.
|
|
316
|
+
// 3. .catch() on prompt() — final safety net, swallows rejected promises
|
|
317
317
|
async function triggerInvisibleContinue() {
|
|
318
318
|
if (!_agent) return;
|
|
319
319
|
|
|
@@ -329,13 +329,14 @@ export default function (pi: ExtensionAPI) {
|
|
|
329
329
|
// directly from the activeRun field, no TOCTOU beyond the next line).
|
|
330
330
|
if (_agent.state.isStreaming) return;
|
|
331
331
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
332
|
+
// Guard 3: .catch() swallows the "already processing" error as a
|
|
333
|
+
// last resort. This handles the remaining microtask TOCTOU gap
|
|
334
|
+
// between the isStreaming check and prompt() acquiring the lock.
|
|
335
|
+
//
|
|
336
|
+
// IMPORTANT: agent.prompt() is async, so errors become rejected
|
|
337
|
+
// Promises — a try/catch around an un-awaited call catches nothing.
|
|
338
|
+
// Must use .catch() on the returned Promise instead.
|
|
339
|
+
_agent.prompt([]).catch(() => {});
|
|
339
340
|
} finally {
|
|
340
341
|
_continueInProgress = false;
|
|
341
342
|
}
|