@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/retry.ts +9 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monotykamary/pi-retry",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Extension suite for pi coding agent that handles 400/413 errors and connection errors with automatic retry",
5
5
  "type": "module",
6
6
  "author": "Tom X Nguyen",
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. try/catch — final safety net, swallows the error gracefully
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
- try {
333
- _agent.prompt([]);
334
- } catch {
335
- // Guard 3: catch the "already processing" error as a last resort.
336
- // This handles the remaining microtask TOCTOU gap between the
337
- // isStreaming check and prompt() acquiring the lock.
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
  }