@monotykamary/pi-retry 0.3.4 → 0.3.5

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 +1 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monotykamary/pi-retry",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
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
@@ -363,30 +363,10 @@ export default function (pi: ExtensionAPI) {
363
363
  // waited. agent.state.isStreaming is authoritative.
364
364
  if (_agent.state.isStreaming) return;
365
365
 
366
- // Remove the error assistant message from the transcript so the LLM
367
- // can retry from the same context. (The session's _prepareRetry does
368
- // the same thing for built-in retries.)
369
- //
370
- // IMPORTANT: We must strip BEFORE calling prompt([]) — if prompt
371
- // starts successfully, the LLM sees the context without the error
372
- // and generates a fresh response. If prompt fails (swallowed by
373
- // .catch()), we restore the message so the agent state stays
374
- // consistent.
375
- const messages = _agent.state.messages;
376
- const hadErrorAssistant = messages.length > 0 && messages[messages.length - 1].role === "assistant";
377
- if (hadErrorAssistant) {
378
- _agent.state.messages = messages.slice(0, -1);
379
- }
380
-
381
366
  // Guard 4: .catch() swallows the "already processing" error as a
382
367
  // last resort. agent.prompt() is async, so errors become rejected
383
368
  // Promises — a try/catch around an un-awaited call catches nothing.
384
- // If prompt failed, restore the stripped error message.
385
- _agent.prompt([]).catch(() => {
386
- if (hadErrorAssistant) {
387
- _agent.state.messages = messages;
388
- }
389
- });
369
+ _agent.prompt([]).catch(() => {});
390
370
  } finally {
391
371
  _continueInProgress = false;
392
372
  }