deepline 0.1.156 → 0.1.158

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.
@@ -5,6 +5,9 @@ export type StepProgramDatasetOptions = {
5
5
  row: Record<string, unknown>,
6
6
  index: number,
7
7
  ) => boolean | Promise<boolean>;
8
+ recompute?: boolean;
9
+ recomputeOnError?: boolean;
10
+ staleAfterSeconds?: number;
8
11
  };
9
12
 
10
13
  export type StepProgramDatasetColumnRunInput<Value = unknown> = {
@@ -124,6 +127,13 @@ export class StepProgramDatasetBuilder<
124
127
  ...this.program.steps,
125
128
  {
126
129
  name,
130
+ ...(normalized.options?.recompute === true ? { recompute: true } : {}),
131
+ ...(normalized.options?.recomputeOnError === true
132
+ ? { recomputeOnError: true }
133
+ : {}),
134
+ ...(typeof normalized.options?.staleAfterSeconds === 'number'
135
+ ? { staleAfterSeconds: normalized.options.staleAfterSeconds }
136
+ : {}),
127
137
  resolver: this.applyDerivationOptions(
128
138
  normalized.resolver,
129
139
  normalized.options,
@@ -6,10 +6,12 @@ import {
6
6
 
7
7
  export const TOOL_EXECUTE_TRANSIENT_HTTP_MAX_ATTEMPTS = 2;
8
8
  export const TOOL_EXECUTE_RATE_LIMIT_MAX_ATTEMPTS = 8;
9
+ export const TOOL_EXECUTE_BARE_RATE_LIMIT_MAX_ATTEMPTS = 2;
9
10
  export const TOOL_EXECUTE_TRANSPORT_MAX_ATTEMPTS = 3;
10
11
  export const TOOL_EXECUTE_TRANSPORT_RETRY_DELAY_MS = 1_000;
11
12
  export const TOOL_EXECUTE_RETRY_DELAY_FALLBACK_MS = 1_000;
12
13
  export const TOOL_EXECUTE_RETRY_DELAY_MAX_MS = 5_000;
14
+ export const TOOL_EXECUTE_BARE_RATE_LIMIT_BACKPRESSURE_MS = 60_000;
13
15
 
14
16
  export type ToolExecuteHttpRetryDecision = {
15
17
  retryable: boolean;
@@ -43,6 +45,7 @@ export type ToolExecuteHttpFailureAttemptTracker = {
43
45
  function decideToolExecuteHttpRetry(input: {
44
46
  status: number;
45
47
  hardBillingFailure?: boolean;
48
+ hasRetryAfterHeader?: boolean;
46
49
  transientHttpRetrySafe?: boolean;
47
50
  }): ToolExecuteHttpRetryDecision {
48
51
  if (input.status === 429) {
@@ -53,6 +56,13 @@ function decideToolExecuteHttpRetry(input: {
53
56
  reason: 'hard_billing_error',
54
57
  };
55
58
  }
59
+ if (!input.hasRetryAfterHeader) {
60
+ return {
61
+ retryable: true,
62
+ attemptCap: TOOL_EXECUTE_BARE_RATE_LIMIT_MAX_ATTEMPTS,
63
+ reason: 'rate_limit',
64
+ };
65
+ }
56
66
  return {
57
67
  retryable: true,
58
68
  attemptCap: TOOL_EXECUTE_RATE_LIMIT_MAX_ATTEMPTS,
@@ -96,6 +106,7 @@ export function createToolExecuteHttpFailureAttemptTracker(): ToolExecuteHttpFai
96
106
  next(input) {
97
107
  const decision = decideToolExecuteHttpRetry({
98
108
  status: input.status,
109
+ hasRetryAfterHeader: true,
99
110
  transientHttpRetrySafe: input.transientHttpRetrySafe === true,
100
111
  });
101
112
  attemptsByReason[decision.reason] += 1;
@@ -130,8 +141,12 @@ export function classifyToolExecuteHttpFailure(input: {
130
141
  nowMs?: number;
131
142
  }): ToolExecuteHttpFailureOutcome {
132
143
  const transientHttpRetrySafe = input.transientHttpRetrySafe === true;
144
+ const hasRetryAfterHeader =
145
+ typeof input.retryAfterHeader === 'string' &&
146
+ input.retryAfterHeader.trim().length > 0;
133
147
  const initialRetryDecision = decideToolExecuteHttpRetry({
134
148
  status: input.status,
149
+ hasRetryAfterHeader,
135
150
  transientHttpRetrySafe,
136
151
  });
137
152
  const error = normalizeToolHttpErrorMessage({
@@ -144,6 +159,7 @@ export function classifyToolExecuteHttpFailure(input: {
144
159
  const retryDecision = decideToolExecuteHttpRetry({
145
160
  status: input.status,
146
161
  hardBillingFailure: isHardBillingToolHttpError(error),
162
+ hasRetryAfterHeader,
147
163
  transientHttpRetrySafe,
148
164
  });
149
165
  const shouldRetry =
@@ -176,10 +192,10 @@ export function classifyToolExecuteHttpFailure(input: {
176
192
  : 'settle_row_failure',
177
193
  retryDelayMs,
178
194
  backpressureDelayMs:
179
- input.status === 429
180
- ? retryAfterMs > 0
195
+ input.status === 429 && retryDecision.reason !== 'hard_billing_error'
196
+ ? hasRetryAfterHeader && retryAfterMs > 0
181
197
  ? retryAfterMs
182
- : TOOL_EXECUTE_RETRY_DELAY_FALLBACK_MS
198
+ : TOOL_EXECUTE_BARE_RATE_LIMIT_BACKPRESSURE_MS
183
199
  : null,
184
200
  chargeRetryBudget: shouldRetry,
185
201
  };