pomerado 0.4.0-canary.607 → 0.4.0-canary.608

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
@@ -1130,6 +1130,9 @@
1130
1130
 
1131
1131
  ### Fixes
1132
1132
 
1133
+ - A Guardian review whose provider can't decrypt an encrypted item the request sent back now fails at once, and its build ends without waiting out the review outage budget. A provider can return a compaction of the review's conversation partway through a response, then refuse every later request that carries it with `invalid_encrypted_content`. Sending the same item again fails the same way, but the adapter read the refusal as an outage, so the host reviewed again with backoff and the minter resubmitted until reviews had been unavailable for the whole budget. The adapter now fails such a review `InputTooLarge`, as it does a request over the model's context window, so it is never retried as an outage and the attempt ends with its `review_unavailable` host failure.
1134
+ - Every failed Guardian review's `failureDetail` now carries the provider's finite fields, such as its `providerCode` and `httpStatus`, a review in a conversation kept across reviews and a publication review included. Those two keep no error text, which may echo the request. A build the host ends `review_unavailable` after an execution or publication review adds a diagnostic with `phase` `review`, `reason` `review_unavailable`, the review's failure `code`, and the provider's `providerCode` and `httpStatus` when it gave them, so its outcome says why. A question or task update review that ends a build so keeps its own diagnostic, as before.
1135
+ - No exported type or signature changes, and `pomerado.hostProtocol` stays 1. `unreadableEncryptedItem` in `pomerado/core/models/model-failure` says whether a failure is that refusal. A host that maps `InputTooLarge` needs no change, and one that reads an outcome's diagnostics by phase sees one more `review` entry.
1133
1136
  - A sign-in's recorded rejection marker now counts when it shows in the sign-in's own frame on another host of the site, such as a login form in an iframe from the site's identity subdomain. The host types a login into any https frame on the site, but `autofillMarkerVisible` read only frames on the screen's exact origin or a configured sign-in origin. So the site's error for a wrong phone number or password read as no marker: the host refused the rejection report as `no_rejection_marker`, asked the owner for no correction, and the check before the next send let the same rejected value go out again. The check now also reads an https frame on the site's registrable domain, as `hostOnSiteSource` reads it. A frame off the site, such as an ad, a chat widget or a captcha vendor's, is still never read, and neither is a plain http frame or any frame once the tab leaves the screen's origin.
1134
1137
  - No exported type or signature changes, and `pomerado.hostProtocol` stays 1. A host that calls `autofillMarkerVisible` needs no change. The device approval number read keeps its frames as before.
1135
1138
 
@@ -17,7 +17,7 @@ import { Agent, AgentsError, MaxTurnsExceededError, Runner, tool, Usage } from "
17
17
  import { Effect, Exit, identity } from "effect";
18
18
  import { reviewFollowUpRounds, ReviewFailure } from "./review.js";
19
19
  import { withTenantPolicy } from "./upstream-policy.js";
20
- import { modelFailureMetadata, modelCauseMetadata, overContextWindow, } from "../models/model-failure.js";
20
+ import { modelFailureMetadata, modelCauseMetadata, overContextWindow, unreadableEncryptedItem, } from "../models/model-failure.js";
21
21
  export { nativeExecutionEnvironment } from "./execution-policy.js";
22
22
  // After the upstream policy, whose Outcome Policy asks for a one-sentence rationale, so the model
23
23
  // reads this replacement after the rule it replaces.
@@ -652,35 +652,34 @@ const reviewerWithPolicy = (shared, options, cacheFallback) => ({
652
652
  ? "TurnLimitExceeded"
653
653
  : callStalled
654
654
  ? "ModelCallStalled"
655
- : overContextWindow(finite)
655
+ : overContextWindow(finite) || unreadableEncryptedItem(finite)
656
656
  ? "InputTooLarge"
657
657
  : "Unavailable";
658
658
  quotaExhausted =
659
659
  providerQuotaExhausted(error) || finite.code === "insufficient_quota";
660
- reviewComputationDetail =
661
- !turn.session && turn.pending.publication === undefined
662
- ? failureDetail(quotaExhausted ? "model_quota_exhausted" : "guardian_dependency_failed", {
663
- operation: "runner.run",
664
- phase: "review_computation",
665
- // A private kind's error text may echo its request or output.
666
- ...(privateKind ? {} : { error }),
667
- context: {
668
- kind: finite.kind,
669
- code: finite.code,
670
- httpStatus: finite.httpStatus,
671
- causeCode: finite.causeCode,
672
- providerCode: finite.providerCode,
673
- requestId: finite.requestId,
674
- },
675
- })
676
- : undefined;
660
+ // Every review names the provider's finite fields, such as its code and HTTP
661
+ // status. A private kind's error text may echo its request or output, and so may
662
+ // a session's or a publication's, so only other reviews keep the error itself.
663
+ reviewComputationDetail = failureDetail(quotaExhausted ? "model_quota_exhausted" : "guardian_dependency_failed", {
664
+ operation: "runner.run",
665
+ phase: "review_computation",
666
+ ...(privateKind || turn.session || turn.pending.publication !== undefined
667
+ ? {}
668
+ : { error }),
669
+ context: {
670
+ kind: finite.kind,
671
+ code: finite.code,
672
+ httpStatus: finite.httpStatus,
673
+ causeCode: finite.causeCode,
674
+ providerCode: finite.providerCode,
675
+ requestId: finite.requestId,
676
+ },
677
+ });
677
678
  return new ReviewFailure({
678
679
  code: failureCode,
679
680
  reviewPhase: "review_computation",
680
681
  ...(quotaExhausted ? { modelQuotaExhausted: true } : {}),
681
- ...(reviewComputationDetail === undefined
682
- ? {}
683
- : { failureDetail: reviewComputationDetail }),
682
+ failureDetail: reviewComputationDetail,
684
683
  });
685
684
  },
686
685
  }), { signal });
@@ -175,8 +175,8 @@ export declare class ReviewFailure extends ReviewFailure_base<{
175
175
  | "ModelCallStalled"
176
176
  /**
177
177
  * The model provider refused the review's request as over the model's input limit, its context
178
- * window. That is no outage, and the same request fails the same way, so it is never retried as
179
- * one.
178
+ * window, or because it could not decrypt an encrypted item the request sent back. That is no
179
+ * outage, and the same request fails the same way, so it is never retried as one.
180
180
  */
181
181
  | "InputTooLarge"
182
182
  /**
@@ -552,9 +552,10 @@ export interface ReviewRetry {
552
552
  }
553
553
  /**
554
554
  * Production retry for Guardian outages: provider errors and a required source read that failed.
555
- * A review that ran out of turns, whose model call stalled or whose request is over the model's
556
- * context window is not an outage, and is not started again. A decision that did not decode is
557
- * reviewed once more only when its review got no correction.
555
+ * A review that ran out of turns, whose model call stalled, or whose request is over the model's
556
+ * context window or carries an encrypted item the provider could not decrypt is not an outage, and
557
+ * is not started again. A decision that did not decode is reviewed once more only when its review
558
+ * got no correction.
558
559
  */
559
560
  export declare const guardianOutageRetry: ReviewRetry;
560
561
  export interface Reviewer {
@@ -143,9 +143,10 @@ const guardianRuntimeRecords = (diagnostics, options) => {
143
143
  };
144
144
  /**
145
145
  * Production retry for Guardian outages: provider errors and a required source read that failed.
146
- * A review that ran out of turns, whose model call stalled or whose request is over the model's
147
- * context window is not an outage, and is not started again. A decision that did not decode is
148
- * reviewed once more only when its review got no correction.
146
+ * A review that ran out of turns, whose model call stalled, or whose request is over the model's
147
+ * context window or carries an encrypted item the provider could not decrypt is not an outage, and
148
+ * is not started again. A decision that did not decode is reviewed once more only when its review
149
+ * got no correction.
149
150
  */
150
151
  export const guardianOutageRetry = {
151
152
  delays: ["2 seconds", "5 seconds", "15 seconds", "30 seconds", "60 seconds"],
@@ -2436,8 +2436,9 @@ export const runMint = (input) => Effect.scoped(Effect.gen(function* () {
2436
2436
  * backoff; the agent may resubmit while reviews have been unavailable for less than the
2437
2437
  * outage budget, and any completed review starts the budget again. A review whose evidence
2438
2438
  * could not be retained is such an outage too. Past the budget, `exhausted` ends the attempt,
2439
- * as it does at once for a request over Guardian's model input limit (`InputTooLarge`), which
2440
- * fails the same way when resubmitted.
2439
+ * as it does at once for a request the provider refused as over Guardian's model input limit,
2440
+ * or for an encrypted item it could not decrypt (`InputTooLarge`), which fails the same way
2441
+ * when resubmitted.
2441
2442
  */
2442
2443
  const reviewUnavailableRetry = (kind, exhausted) => (error) => Effect.gen(function* () {
2443
2444
  if (error.reviewFailure === "InvalidOutcome")
@@ -2469,12 +2470,22 @@ export const runMint = (input) => Effect.scoped(Effect.gen(function* () {
2469
2470
  question: "No question was created. Submit the same request_input again for a fresh question review; do not ask it in prose or invent a clarification.",
2470
2471
  update: "Nothing changed. Submit the same mint_update again for a fresh review; the task stays as it was until an update applies.",
2471
2472
  };
2472
- const reviewUnavailableFeedback = (error) => Effect.sync(() => {
2473
+ const reviewUnavailableFeedback = (error) => Effect.gen(function* () {
2473
2474
  terminal = {
2474
2475
  build: "incomplete",
2475
2476
  hostFailure: "review_unavailable",
2476
2477
  summary: "Guardian review could not complete. No review approval was obtained; recorded effects and claimed examples remain preserved.",
2477
2478
  };
2479
+ // The outcome names why: the review's failure code, and the model provider's own code and
2480
+ // HTTP status when it refused the review's request.
2481
+ const context = error.failureDetail?.context;
2482
+ yield* diagnose({
2483
+ phase: "review",
2484
+ reason: "review_unavailable",
2485
+ code: error.reviewFailure,
2486
+ providerCode: context?.["providerCode"],
2487
+ httpStatus: context?.["httpStatus"],
2488
+ });
2478
2489
  return reviewUnavailableAnswer(error, "Review did not complete; this is not a Guardian deny or escalation decision. End this attempt without publication. Do not change site code to repair review infrastructure or automatically retry execution. Preserve prior effects and claimed examples; reconcile possibly executed operations before any further effect. Missing user authority or credentials has not been established.");
2479
2490
  });
2480
2491
  /**
@@ -3150,8 +3161,8 @@ export const runMint = (input) => Effect.scoped(Effect.gen(function* () {
3150
3161
  outcome: "invalid_outcome",
3151
3162
  rationale: "Guardian returned no decision a question review allows, so it neither allowed nor reworded the explanation. Make it plain and consistent with the evidence.",
3152
3163
  };
3153
- // A spent quota, a request over the model's input limit or an outage past its
3154
- // budget still ends blocked: the caller reads the reason alone.
3164
+ // A spent quota, a request the provider refused for good (`InputTooLarge`) or an
3165
+ // outage past its budget still ends blocked: the caller reads the reason alone.
3155
3166
  if (error.code !== "ReviewUnavailable" ||
3156
3167
  error.modelOutage === "quota_exhausted" ||
3157
3168
  error.reviewFailure === "InputTooLarge" ||
@@ -27,3 +27,8 @@ export declare const modelCauseMetadata: (cause: Cause.Cause<unknown>) => ModelF
27
27
  * code. That is no outage, and the same request fails the same way.
28
28
  */
29
29
  export declare const overContextWindow: (finite: ModelFailureMetadata) => boolean;
30
+ /**
31
+ * The provider could not decrypt an encrypted item the request sent back, such as a compaction it
32
+ * returned earlier, by its own code. That is no outage, and the same request fails the same way.
33
+ */
34
+ export declare const unreadableEncryptedItem: (finite: ModelFailureMetadata) => boolean;
@@ -92,3 +92,9 @@ export const modelCauseMetadata = (cause) => {
92
92
  * code. That is no outage, and the same request fails the same way.
93
93
  */
94
94
  export const overContextWindow = (finite) => finite.code === "context_length_exceeded" || finite.providerCode === "context_length_exceeded";
95
+ /**
96
+ * The provider could not decrypt an encrypted item the request sent back, such as a compaction it
97
+ * returned earlier, by its own code. That is no outage, and the same request fails the same way.
98
+ */
99
+ export const unreadableEncryptedItem = (finite) => finite.code === "invalid_encrypted_content" ||
100
+ finite.providerCode === "invalid_encrypted_content";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pomerado",
3
- "version": "0.4.0-canary.607",
3
+ "version": "0.4.0-canary.608",
4
4
  "description": "Pomerado's integration minter and Guardian with local compute and native Playwright",
5
5
  "type": "module",
6
6
  "license": "MIT",