@zhushanwen/pi-retry-rules

Retryable error rules for Pi — message_end rewrite triggers the native retry loop for throttling-class provider errors, with configurable rules (builtin baseline ⊕ remote overlay ⊕ user custom) and ReDoS-guarded matching.

Packages

Package details

extensionskill

Install @zhushanwen/pi-retry-rules from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@zhushanwen/pi-retry-rules
Package
@zhushanwen/pi-retry-rules
Version
0.2.2
Published
Nov 5, 2026
Downloads
433/mo · 237/wk
Author
zhushanwen321
License
MIT
Types
extension, skill
Size
37.4 KB
Dependencies
2 dependencies · 1 peer
Pi manifest JSON
{
  "skills": [
    "./skills"
  ],
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@zhushanwen/pi-retry-rules

Retryable error rules for Pi: rewrites finalized stopReason=error assistant messages via the official message_end hook (appending a [taiji-retry: marker) so that throttling-class provider errors hit pi-ai's native retryable word list and the native retry loop (auto_retry events, exponential backoff, failed-attempt omission) takes over.

  • Decision pipeline: two-tier order — non_retryable verdict rules exclude first (per source), then same-verdict rules by source priority custom > remote > builtin, first match wins.
  • Matching channels: regex against errorMessage (ReDoS-guarded) + JSON-snippet dot-path extraction ("${status}: ${body-json}" openai-compat form).
  • Config file: <agentDir>/config/retry-rules-ext-config.json (mtime hot reload; written by the taiji runtime — single data source, this extension is a pure consumer).
  • Disable path: no dedicated switch — turn off pi's native retry settings (enabled=false / maxRetries=0); the native gate is checked before the retryable-word-list verdict, so rewrites never trigger retries when disabled.
  • Semantic SSOT: packages/shared/src/retry-rules.ts (this bundle carries a mirrored copy with behavior-lock tests).