pi-permission-classifier 0.5.1 → 0.5.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/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
5
5
  this project adheres to
6
6
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.5.2] - 2026-09-25
9
+
10
+ ### Fixed
11
+
12
+ - A provider error from the judge model (for example an HTTP 429 or 503)
13
+ now defers with reason `call-failed` instead of `no-tool-call`. The
14
+ circuit breaker counts it, so repeated errors open the breaker instead
15
+ of calling the failing API on every ask. The provider's error text is
16
+ written to the `classifier.model_reply` debug entry.
17
+
8
18
  ## [0.5.1] - 2026-09-19
9
19
 
10
20
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-permission-classifier",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Auto-classifier Authorizer chain link for pi-permission-system: a light model reviews each ask and returns allow, deny, or defer",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -130,8 +130,8 @@ export type ModelCallDeferReason =
130
130
  * The full result of a model review: the verdict plus the observability the
131
131
  * decision trail records. `deferReason` is set iff the verdict is `defer`;
132
132
  * `rawReply` carries the tool-call arguments as JSON when a tool call arrived,
133
- * or the assistant text on a `no-tool-call` defer (absent on a timeout/throw
134
- * before any reply).
133
+ * the assistant text on a `no-tool-call` defer, or the provider error text on
134
+ * a `call-failed` error reply (absent on a timeout/throw before any reply).
135
135
  */
136
136
  export interface ReviewOutcome {
137
137
  verdict: AuthorizerVerdict;
@@ -185,6 +185,17 @@ export async function reviewAsk(inputs: ReviewAskInputs): Promise<ReviewOutcome>
185
185
  latencyMs: Date.now() - startedAt,
186
186
  };
187
187
  }
188
+ // pi-ai also resolves (not rejects) on a provider error such as an
189
+ // HTTP 429 or 503: the reply has no content and carries the error text.
190
+ // Report it as `call-failed` so the breaker counts it.
191
+ if (reply.stopReason === "error") {
192
+ return {
193
+ verdict: { kind: "defer" },
194
+ deferReason: "call-failed",
195
+ latencyMs: Date.now() - startedAt,
196
+ rawReply: reply.errorMessage,
197
+ };
198
+ }
188
199
  return readToolCallOutcome(reply, Date.now() - startedAt);
189
200
  } catch {
190
201
  return {