@averyyy/pi-coding-agent 0.84.4-piclient.1 → 0.84.4-piclient.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.
@@ -102,6 +102,16 @@ function getPiServerFailurePhase(message) {
102
102
  }
103
103
  return undefined;
104
104
  }
105
+ function getPiServerFailureRetryable(message) {
106
+ for (const diagnostic of message.diagnostics ?? []) {
107
+ if (diagnostic.type !== "pi_server_failure")
108
+ continue;
109
+ const retryable = diagnostic.details?.retryable;
110
+ if (typeof retryable === "boolean")
111
+ return retryable;
112
+ }
113
+ return undefined;
114
+ }
105
115
  function toolTextContent(content) {
106
116
  return content
107
117
  .filter((part) => part.type === "text")
@@ -2637,6 +2647,9 @@ export class AgentSession {
2637
2647
  * Check if an error is retryable. Provider error text is retryable by default,
2638
2648
  * except usage/quota/balance limits and session or context failures.
2639
2649
  * Context overflow errors are NOT retryable (handled by compaction instead).
2650
+ * Pi-server diagnostics may mark recovery/history failures as non-retryable;
2651
+ * transient session_init/tree_sync outages stay retryable so the next attempt
2652
+ * re-runs the whole stream path.
2640
2653
  */
2641
2654
  _isRetryableError(message) {
2642
2655
  // Context overflow is handled by compaction, not retry.
@@ -2644,9 +2657,14 @@ export class AgentSession {
2644
2657
  return false;
2645
2658
  if (this._isPostAssistantPiServerSyncFailure(message))
2646
2659
  return false;
2647
- const piServerPhase = getPiServerFailurePhase(message);
2648
- if (piServerPhase && piServerPhase !== "provider_stream")
2660
+ const piServerRetryable = getPiServerFailureRetryable(message);
2661
+ if (piServerRetryable === false)
2649
2662
  return false;
2663
+ if (piServerRetryable !== true) {
2664
+ const piServerPhase = getPiServerFailurePhase(message);
2665
+ if (piServerPhase && piServerPhase !== "provider_stream")
2666
+ return false;
2667
+ }
2650
2668
  return isRetryableAssistantError(message);
2651
2669
  }
2652
2670
  /**