deepline 0.1.301 → 0.1.302
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/dist/bundling-sources/sdk/src/client.ts +8 -0
- package/dist/bundling-sources/sdk/src/errors.ts +57 -15
- package/dist/bundling-sources/sdk/src/http.ts +82 -5
- package/dist/bundling-sources/sdk/src/index.ts +4 -0
- package/dist/bundling-sources/sdk/src/play.ts +29 -1
- package/dist/bundling-sources/sdk/src/release.ts +5 -3
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +120 -14
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +10 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +59 -11
- package/dist/bundling-sources/shared_libs/play-runtime/execution-ledger-store.ts +3 -3
- package/dist/bundling-sources/shared_libs/play-runtime/execution-plan.ts +0 -15
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +136 -36
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +17 -12
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +210 -5
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +4 -0
- package/dist/bundling-sources/shared_libs/plays/artifact-contract-version.ts +6 -0
- package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +4 -0
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +159 -12
- package/dist/bundling-sources/shared_libs/plays/contracts.ts +69 -1
- package/dist/bundling-sources/shared_libs/tool-execution-error.ts +428 -0
- package/dist/cli/index.js +501 -179
- package/dist/cli/index.mjs +501 -179
- package/dist/index.d.mts +39 -18
- package/dist/index.d.ts +39 -18
- package/dist/index.js +394 -59
- package/dist/index.mjs +391 -59
- package/dist/plays/bundle-play-file.d.mts +4 -2
- package/dist/plays/bundle-play-file.d.ts +4 -2
- package/dist/plays/bundle-play-file.mjs +116 -19
- package/dist/{compiler-manifest-BjopNIqx.d.mts → tool-execution-error-9mH4i-mJ.d.mts} +79 -1
- package/dist/{compiler-manifest-BjopNIqx.d.ts → tool-execution-error-9mH4i-mJ.d.ts} +79 -1
- package/package.json +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/completed-receipt-cache.ts +0 -166
|
@@ -59,6 +59,7 @@ import {
|
|
|
59
59
|
workReceiptFailureKindFromCode,
|
|
60
60
|
type WorkReceiptFailureKind,
|
|
61
61
|
} from './work-receipts';
|
|
62
|
+
import type { ToolExecutionFailureV1 } from '../tool-execution-error';
|
|
62
63
|
import {
|
|
63
64
|
sanitizePostgresJsonValue,
|
|
64
65
|
stringifyPostgresJson,
|
|
@@ -216,6 +217,7 @@ async function forceFailRuntimeWorkReceiptForRuntimeTestFault(
|
|
|
216
217
|
SET status = $2::smallint,
|
|
217
218
|
output = NULL,
|
|
218
219
|
error = $3,
|
|
220
|
+
error_payload = NULL,
|
|
219
221
|
failure_kind = $5::smallint,
|
|
220
222
|
lease_id = NULL,
|
|
221
223
|
lease_owner_run_id = NULL,
|
|
@@ -230,6 +232,7 @@ async function forceFailRuntimeWorkReceiptForRuntimeTestFault(
|
|
|
230
232
|
status,
|
|
231
233
|
output,
|
|
232
234
|
error,
|
|
235
|
+
error_payload,
|
|
233
236
|
failure_kind,
|
|
234
237
|
run_id,
|
|
235
238
|
lease_id,
|
|
@@ -238,7 +241,7 @@ async function forceFailRuntimeWorkReceiptForRuntimeTestFault(
|
|
|
238
241
|
lease_expires_at,
|
|
239
242
|
updated_at
|
|
240
243
|
)
|
|
241
|
-
SELECT k, status, output, error, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at
|
|
244
|
+
SELECT k, status, output, error, error_payload, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at
|
|
242
245
|
FROM failed
|
|
243
246
|
`,
|
|
244
247
|
[
|
|
@@ -299,9 +302,11 @@ const RUNTIME_WORK_RECEIPT_LEASE_COLUMNS = [
|
|
|
299
302
|
'lease_expires_at',
|
|
300
303
|
] as const;
|
|
301
304
|
const RUNTIME_WORK_RECEIPT_FAILURE_KIND_COLUMN = 'failure_kind';
|
|
305
|
+
const RUNTIME_WORK_RECEIPT_ERROR_PAYLOAD_COLUMN = 'error_payload';
|
|
302
306
|
const RUNTIME_WORK_RECEIPT_SELF_HEAL_COLUMNS = [
|
|
303
307
|
...RUNTIME_WORK_RECEIPT_LEASE_COLUMNS,
|
|
304
308
|
RUNTIME_WORK_RECEIPT_FAILURE_KIND_COLUMN,
|
|
309
|
+
RUNTIME_WORK_RECEIPT_ERROR_PAYLOAD_COLUMN,
|
|
305
310
|
] as const;
|
|
306
311
|
const RUNTIME_SHEET_ATTEMPT_COLUMNS = [
|
|
307
312
|
'_attempt_id',
|
|
@@ -2168,6 +2173,10 @@ function mapRuntimeWorkReceiptRow(raw: Record<string, unknown>): WorkReceipt {
|
|
|
2168
2173
|
status: receiptStatusFromCode(raw.status),
|
|
2169
2174
|
output: raw.output == null ? null : raw.output,
|
|
2170
2175
|
error: raw.error == null ? null : String(raw.error),
|
|
2176
|
+
errorPayload:
|
|
2177
|
+
raw.error_payload != null && typeof raw.error_payload === 'object'
|
|
2178
|
+
? (raw.error_payload as WorkReceipt['errorPayload'])
|
|
2179
|
+
: null,
|
|
2171
2180
|
failureKind: workReceiptFailureKindFromCode(raw.failure_kind),
|
|
2172
2181
|
runId: raw.run_id == null ? null : String(raw.run_id),
|
|
2173
2182
|
leaseId: raw.lease_id == null ? null : String(raw.lease_id),
|
|
@@ -2260,6 +2269,7 @@ async function ensureRuntimeWorkReceiptTable(
|
|
|
2260
2269
|
status smallint NOT NULL DEFAULT 0,
|
|
2261
2270
|
output jsonb,
|
|
2262
2271
|
error text,
|
|
2272
|
+
error_payload jsonb,
|
|
2263
2273
|
failure_kind smallint NOT NULL DEFAULT 0,
|
|
2264
2274
|
run_id text,
|
|
2265
2275
|
lease_id text,
|
|
@@ -2295,7 +2305,9 @@ async function ensureRuntimeWorkReceiptTable(
|
|
|
2295
2305
|
? 'integer'
|
|
2296
2306
|
: column === RUNTIME_WORK_RECEIPT_FAILURE_KIND_COLUMN
|
|
2297
2307
|
? 'smallint NOT NULL DEFAULT 0'
|
|
2298
|
-
:
|
|
2308
|
+
: column === RUNTIME_WORK_RECEIPT_ERROR_PAYLOAD_COLUMN
|
|
2309
|
+
? 'jsonb'
|
|
2310
|
+
: 'text';
|
|
2299
2311
|
return `ADD COLUMN IF NOT EXISTS ${column} ${type}`;
|
|
2300
2312
|
})
|
|
2301
2313
|
.join(',\n ')}
|
|
@@ -4064,6 +4076,7 @@ async function readRuntimeWorkReceipt(
|
|
|
4064
4076
|
status,
|
|
4065
4077
|
output,
|
|
4066
4078
|
error,
|
|
4079
|
+
error_payload,
|
|
4067
4080
|
failure_kind,
|
|
4068
4081
|
run_id,
|
|
4069
4082
|
lease_id,
|
|
@@ -4123,6 +4136,7 @@ export async function getRuntimeWorkReceipts(
|
|
|
4123
4136
|
receipts.status,
|
|
4124
4137
|
receipts.output,
|
|
4125
4138
|
receipts.error,
|
|
4139
|
+
receipts.error_payload,
|
|
4126
4140
|
receipts.failure_kind,
|
|
4127
4141
|
receipts.run_id,
|
|
4128
4142
|
receipts.lease_id,
|
|
@@ -4222,7 +4236,6 @@ export async function claimRuntimeWorkReceipt(
|
|
|
4222
4236
|
ON CONFLICT (k) DO UPDATE
|
|
4223
4237
|
SET status = $4::smallint,
|
|
4224
4238
|
output = NULL,
|
|
4225
|
-
failure_kind = 0,
|
|
4226
4239
|
run_id = $3,
|
|
4227
4240
|
lease_id = $6,
|
|
4228
4241
|
lease_owner_run_id = CASE WHEN $6::text IS NULL THEN NULL ELSE $3 END,
|
|
@@ -4232,6 +4245,8 @@ export async function claimRuntimeWorkReceipt(
|
|
|
4232
4245
|
ELSE now() + ($7::double precision * interval '1 millisecond')
|
|
4233
4246
|
END,
|
|
4234
4247
|
error = NULL,
|
|
4248
|
+
error_payload = NULL,
|
|
4249
|
+
failure_kind = 0,
|
|
4235
4250
|
updated_at = now()
|
|
4236
4251
|
WHERE ${workReceiptClaimConflictPredicateSql({
|
|
4237
4252
|
receiptTable: workReceiptTable(session),
|
|
@@ -4246,6 +4261,7 @@ export async function claimRuntimeWorkReceipt(
|
|
|
4246
4261
|
status,
|
|
4247
4262
|
output,
|
|
4248
4263
|
error,
|
|
4264
|
+
error_payload,
|
|
4249
4265
|
failure_kind,
|
|
4250
4266
|
run_id,
|
|
4251
4267
|
lease_id,
|
|
@@ -4258,6 +4274,7 @@ export async function claimRuntimeWorkReceipt(
|
|
|
4258
4274
|
status,
|
|
4259
4275
|
output,
|
|
4260
4276
|
error,
|
|
4277
|
+
error_payload,
|
|
4261
4278
|
failure_kind,
|
|
4262
4279
|
run_id,
|
|
4263
4280
|
lease_id,
|
|
@@ -4458,11 +4475,10 @@ export async function claimRuntimeWorkReceipts(
|
|
|
4458
4475
|
END,
|
|
4459
4476
|
now()
|
|
4460
4477
|
FROM input_keys
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
run_id = $4::text,
|
|
4478
|
+
ON CONFLICT (k) DO UPDATE
|
|
4479
|
+
SET status = $5::smallint,
|
|
4480
|
+
output = NULL,
|
|
4481
|
+
run_id = $4::text,
|
|
4466
4482
|
lease_id = EXCLUDED.lease_id,
|
|
4467
4483
|
lease_owner_run_id = CASE
|
|
4468
4484
|
WHEN EXCLUDED.lease_id IS NULL THEN NULL
|
|
@@ -4474,6 +4490,8 @@ export async function claimRuntimeWorkReceipts(
|
|
|
4474
4490
|
END,
|
|
4475
4491
|
lease_expires_at = EXCLUDED.lease_expires_at,
|
|
4476
4492
|
error = NULL,
|
|
4493
|
+
error_payload = NULL,
|
|
4494
|
+
failure_kind = 0,
|
|
4477
4495
|
updated_at = now()
|
|
4478
4496
|
WHERE ${workReceiptClaimConflictPredicateSql({
|
|
4479
4497
|
receiptTable: workReceiptTable(session),
|
|
@@ -4488,6 +4506,7 @@ export async function claimRuntimeWorkReceipts(
|
|
|
4488
4506
|
status,
|
|
4489
4507
|
output,
|
|
4490
4508
|
error,
|
|
4509
|
+
error_payload,
|
|
4491
4510
|
failure_kind,
|
|
4492
4511
|
run_id,
|
|
4493
4512
|
lease_id,
|
|
@@ -4501,6 +4520,7 @@ export async function claimRuntimeWorkReceipts(
|
|
|
4501
4520
|
receipts.status,
|
|
4502
4521
|
receipts.output,
|
|
4503
4522
|
receipts.error,
|
|
4523
|
+
receipts.error_payload,
|
|
4504
4524
|
receipts.failure_kind,
|
|
4505
4525
|
receipts.run_id,
|
|
4506
4526
|
receipts.lease_id,
|
|
@@ -4525,6 +4545,7 @@ export async function claimRuntimeWorkReceipts(
|
|
|
4525
4545
|
claimed.status,
|
|
4526
4546
|
claimed.output,
|
|
4527
4547
|
claimed.error,
|
|
4548
|
+
claimed.error_payload,
|
|
4528
4549
|
claimed.failure_kind,
|
|
4529
4550
|
claimed.run_id,
|
|
4530
4551
|
claimed.lease_id,
|
|
@@ -4541,6 +4562,7 @@ export async function claimRuntimeWorkReceipts(
|
|
|
4541
4562
|
status,
|
|
4542
4563
|
output,
|
|
4543
4564
|
error,
|
|
4565
|
+
error_payload,
|
|
4544
4566
|
failure_kind,
|
|
4545
4567
|
run_id,
|
|
4546
4568
|
lease_id,
|
|
@@ -4556,6 +4578,7 @@ export async function claimRuntimeWorkReceipts(
|
|
|
4556
4578
|
status,
|
|
4557
4579
|
output,
|
|
4558
4580
|
error,
|
|
4581
|
+
error_payload,
|
|
4559
4582
|
failure_kind,
|
|
4560
4583
|
run_id,
|
|
4561
4584
|
lease_id,
|
|
@@ -4629,6 +4652,9 @@ export async function markRuntimeWorkReceiptRunning(
|
|
|
4629
4652
|
WITH running AS (
|
|
4630
4653
|
UPDATE ${workReceiptTable(session)}
|
|
4631
4654
|
SET status = $2::smallint,
|
|
4655
|
+
error = NULL,
|
|
4656
|
+
error_payload = NULL,
|
|
4657
|
+
failure_kind = 0,
|
|
4632
4658
|
lease_expires_at = CASE
|
|
4633
4659
|
WHEN lease_id IS NULL THEN NULL
|
|
4634
4660
|
ELSE now() + ($6::double precision * interval '1 millisecond')
|
|
@@ -4645,6 +4671,7 @@ export async function markRuntimeWorkReceiptRunning(
|
|
|
4645
4671
|
status,
|
|
4646
4672
|
output,
|
|
4647
4673
|
error,
|
|
4674
|
+
error_payload,
|
|
4648
4675
|
failure_kind,
|
|
4649
4676
|
run_id,
|
|
4650
4677
|
lease_id,
|
|
@@ -4653,7 +4680,7 @@ export async function markRuntimeWorkReceiptRunning(
|
|
|
4653
4680
|
lease_expires_at,
|
|
4654
4681
|
updated_at
|
|
4655
4682
|
)
|
|
4656
|
-
SELECT k, status, output, error, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at
|
|
4683
|
+
SELECT k, status, output, error, error_payload, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at
|
|
4657
4684
|
FROM running
|
|
4658
4685
|
`,
|
|
4659
4686
|
[
|
|
@@ -4716,6 +4743,9 @@ export async function markRuntimeWorkReceiptsRunning(
|
|
|
4716
4743
|
running AS (
|
|
4717
4744
|
UPDATE ${workReceiptTable(session)} AS target
|
|
4718
4745
|
SET status = $5::smallint,
|
|
4746
|
+
error = NULL,
|
|
4747
|
+
error_payload = NULL,
|
|
4748
|
+
failure_kind = 0,
|
|
4719
4749
|
lease_expires_at = CASE
|
|
4720
4750
|
WHEN target.lease_id IS NULL THEN NULL
|
|
4721
4751
|
ELSE now() + ($6::double precision * interval '1 millisecond')
|
|
@@ -4733,6 +4763,7 @@ export async function markRuntimeWorkReceiptsRunning(
|
|
|
4733
4763
|
target.status,
|
|
4734
4764
|
target.output,
|
|
4735
4765
|
target.error,
|
|
4766
|
+
target.error_payload,
|
|
4736
4767
|
target.failure_kind,
|
|
4737
4768
|
target.run_id,
|
|
4738
4769
|
target.lease_id,
|
|
@@ -4747,6 +4778,7 @@ export async function markRuntimeWorkReceiptsRunning(
|
|
|
4747
4778
|
running.status,
|
|
4748
4779
|
running.output,
|
|
4749
4780
|
running.error,
|
|
4781
|
+
running.error_payload,
|
|
4750
4782
|
running.failure_kind,
|
|
4751
4783
|
running.run_id,
|
|
4752
4784
|
running.lease_id,
|
|
@@ -4762,6 +4794,7 @@ export async function markRuntimeWorkReceiptsRunning(
|
|
|
4762
4794
|
returned.status,
|
|
4763
4795
|
returned.output,
|
|
4764
4796
|
returned.error,
|
|
4797
|
+
returned.error_payload,
|
|
4765
4798
|
returned.failure_kind,
|
|
4766
4799
|
returned.run_id,
|
|
4767
4800
|
returned.lease_id,
|
|
@@ -4836,6 +4869,9 @@ export async function markRuntimeWorkReceiptsQueued(
|
|
|
4836
4869
|
queued AS (
|
|
4837
4870
|
UPDATE ${workReceiptTable(session)} AS target
|
|
4838
4871
|
SET status = $5::smallint,
|
|
4872
|
+
error = NULL,
|
|
4873
|
+
error_payload = NULL,
|
|
4874
|
+
failure_kind = 0,
|
|
4839
4875
|
lease_expires_at = CASE
|
|
4840
4876
|
WHEN target.lease_id IS NULL THEN NULL
|
|
4841
4877
|
ELSE now() + ($6::double precision * interval '1 millisecond')
|
|
@@ -4853,6 +4889,7 @@ export async function markRuntimeWorkReceiptsQueued(
|
|
|
4853
4889
|
target.status,
|
|
4854
4890
|
target.output,
|
|
4855
4891
|
target.error,
|
|
4892
|
+
target.error_payload,
|
|
4856
4893
|
target.failure_kind,
|
|
4857
4894
|
target.run_id,
|
|
4858
4895
|
target.lease_id,
|
|
@@ -4867,6 +4904,7 @@ export async function markRuntimeWorkReceiptsQueued(
|
|
|
4867
4904
|
queued.status,
|
|
4868
4905
|
queued.output,
|
|
4869
4906
|
queued.error,
|
|
4907
|
+
queued.error_payload,
|
|
4870
4908
|
queued.failure_kind,
|
|
4871
4909
|
queued.run_id,
|
|
4872
4910
|
queued.lease_id,
|
|
@@ -4882,6 +4920,7 @@ export async function markRuntimeWorkReceiptsQueued(
|
|
|
4882
4920
|
returned.status,
|
|
4883
4921
|
returned.output,
|
|
4884
4922
|
returned.error,
|
|
4923
|
+
returned.error_payload,
|
|
4885
4924
|
returned.failure_kind,
|
|
4886
4925
|
returned.run_id,
|
|
4887
4926
|
returned.lease_id,
|
|
@@ -4960,6 +4999,11 @@ export async function completeRuntimeWorkReceipt(
|
|
|
4960
4999
|
})
|
|
4961
5000
|
) {
|
|
4962
5001
|
const error = runtimeTestFaultError('receipt_complete_write_fail');
|
|
5002
|
+
// Tool receipts are immutable completed facts. A failed publication is an
|
|
5003
|
+
// execution failure, never a cached failed receipt.
|
|
5004
|
+
if (input.leaseId === COMPLETED_RECEIPT_CACHE_INSERT_LEASE_ID) {
|
|
5005
|
+
throw error;
|
|
5006
|
+
}
|
|
4963
5007
|
const failed = await failRuntimeWorkReceipt(context, {
|
|
4964
5008
|
playName: input.playName,
|
|
4965
5009
|
runId: input.runId,
|
|
@@ -4999,13 +5043,28 @@ export async function completeRuntimeWorkReceipt(
|
|
|
4999
5043
|
Record<string, unknown>
|
|
5000
5044
|
>(
|
|
5001
5045
|
`
|
|
5002
|
-
INSERT INTO ${workReceiptTable(session)} (
|
|
5003
|
-
k, status, output, error, failure_kind, run_id, updated_at
|
|
5046
|
+
INSERT INTO ${workReceiptTable(session)} AS receipt (
|
|
5047
|
+
k, status, output, error, error_payload, failure_kind, run_id, updated_at
|
|
5004
5048
|
) VALUES (
|
|
5005
|
-
decode($1, 'hex'), $2::smallint, $3::jsonb, NULL, 0, $4, now()
|
|
5049
|
+
decode($1, 'hex'), $2::smallint, $3::jsonb, NULL, NULL, 0, $4, now()
|
|
5006
5050
|
)
|
|
5007
|
-
ON CONFLICT (k) DO
|
|
5008
|
-
|
|
5051
|
+
ON CONFLICT (k) DO UPDATE
|
|
5052
|
+
SET status = EXCLUDED.status,
|
|
5053
|
+
output = EXCLUDED.output,
|
|
5054
|
+
error = NULL,
|
|
5055
|
+
error_payload = NULL,
|
|
5056
|
+
failure_kind = 0,
|
|
5057
|
+
run_id = EXCLUDED.run_id,
|
|
5058
|
+
lease_id = NULL,
|
|
5059
|
+
lease_owner_run_id = NULL,
|
|
5060
|
+
lease_owner_attempt = NULL,
|
|
5061
|
+
lease_expires_at = NULL,
|
|
5062
|
+
updated_at = now()
|
|
5063
|
+
WHERE receipt.status NOT IN (
|
|
5064
|
+
${RECEIPT_STATUS_COMPLETED}::smallint,
|
|
5065
|
+
${RECEIPT_STATUS_SKIPPED}::smallint
|
|
5066
|
+
)
|
|
5067
|
+
RETURNING convert_from(k, 'UTF8') AS k, status, output, error, error_payload,
|
|
5009
5068
|
failure_kind, run_id, lease_id, lease_owner_run_id,
|
|
5010
5069
|
lease_owner_attempt, lease_expires_at, updated_at
|
|
5011
5070
|
`,
|
|
@@ -5020,7 +5079,7 @@ export async function completeRuntimeWorkReceipt(
|
|
|
5020
5079
|
const { rows: winnerRows } = await client.query<
|
|
5021
5080
|
Record<string, unknown>
|
|
5022
5081
|
>(
|
|
5023
|
-
`SELECT convert_from(k, 'UTF8') AS k, status, output, error,
|
|
5082
|
+
`SELECT convert_from(k, 'UTF8') AS k, status, output, error, error_payload,
|
|
5024
5083
|
failure_kind, run_id, lease_id, lease_owner_run_id,
|
|
5025
5084
|
lease_owner_attempt, lease_expires_at, updated_at
|
|
5026
5085
|
FROM ${workReceiptTable(session)}
|
|
@@ -5039,6 +5098,7 @@ export async function completeRuntimeWorkReceipt(
|
|
|
5039
5098
|
SET status = $2::smallint,
|
|
5040
5099
|
output = $3::jsonb,
|
|
5041
5100
|
error = NULL,
|
|
5101
|
+
error_payload = NULL,
|
|
5042
5102
|
failure_kind = 0,
|
|
5043
5103
|
run_id = $4,
|
|
5044
5104
|
lease_id = NULL,
|
|
@@ -5057,6 +5117,7 @@ export async function completeRuntimeWorkReceipt(
|
|
|
5057
5117
|
status,
|
|
5058
5118
|
CASE WHEN $7::boolean THEN output ELSE NULL::jsonb END AS output,
|
|
5059
5119
|
error,
|
|
5120
|
+
error_payload,
|
|
5060
5121
|
failure_kind,
|
|
5061
5122
|
run_id,
|
|
5062
5123
|
lease_id,
|
|
@@ -5070,6 +5131,7 @@ export async function completeRuntimeWorkReceipt(
|
|
|
5070
5131
|
status,
|
|
5071
5132
|
CASE WHEN $7::boolean THEN output ELSE NULL::jsonb END AS output,
|
|
5072
5133
|
error,
|
|
5134
|
+
error_payload,
|
|
5073
5135
|
failure_kind,
|
|
5074
5136
|
run_id,
|
|
5075
5137
|
lease_id,
|
|
@@ -5086,9 +5148,9 @@ export async function completeRuntimeWorkReceipt(
|
|
|
5086
5148
|
ownerRunIdSql: '$4',
|
|
5087
5149
|
})}
|
|
5088
5150
|
)
|
|
5089
|
-
SELECT k, status, output, error, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM completed
|
|
5151
|
+
SELECT k, status, output, error, error_payload, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM completed
|
|
5090
5152
|
UNION ALL
|
|
5091
|
-
SELECT k, status, output, error, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM replay
|
|
5153
|
+
SELECT k, status, output, error, error_payload, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM replay
|
|
5092
5154
|
`,
|
|
5093
5155
|
[
|
|
5094
5156
|
workReceiptKeyHex(input.key),
|
|
@@ -5128,7 +5190,16 @@ export async function completeRuntimeWorkReceipts(
|
|
|
5128
5190
|
name: 'receipt_complete_write_fail',
|
|
5129
5191
|
})
|
|
5130
5192
|
) {
|
|
5131
|
-
const
|
|
5193
|
+
const faultedIndex = receipts.findIndex(
|
|
5194
|
+
(receipt) => receipt.leaseId !== COMPLETED_RECEIPT_CACHE_INSERT_LEASE_ID,
|
|
5195
|
+
);
|
|
5196
|
+
if (faultedIndex < 0) {
|
|
5197
|
+
throw runtimeTestFaultError('receipt_complete_write_fail');
|
|
5198
|
+
}
|
|
5199
|
+
const faultedReceipt = receipts[faultedIndex];
|
|
5200
|
+
const siblingReceipts = receipts.filter(
|
|
5201
|
+
(_receipt, index) => index !== faultedIndex,
|
|
5202
|
+
);
|
|
5132
5203
|
let siblingError: unknown = null;
|
|
5133
5204
|
if (siblingReceipts.length > 0) {
|
|
5134
5205
|
try {
|
|
@@ -5142,24 +5213,24 @@ export async function completeRuntimeWorkReceipts(
|
|
|
5142
5213
|
}
|
|
5143
5214
|
}
|
|
5144
5215
|
const error = runtimeTestFaultError('receipt_complete_write_fail');
|
|
5145
|
-
if (
|
|
5216
|
+
if (faultedReceipt) {
|
|
5146
5217
|
const failed = await failRuntimeWorkReceipt(context, {
|
|
5147
5218
|
playName: input.playName,
|
|
5148
|
-
runId:
|
|
5149
|
-
key:
|
|
5150
|
-
leaseId:
|
|
5219
|
+
runId: faultedReceipt.runId,
|
|
5220
|
+
key: faultedReceipt.key,
|
|
5221
|
+
leaseId: faultedReceipt.leaseId,
|
|
5151
5222
|
error: error.message,
|
|
5152
5223
|
failureKind: 'repairable',
|
|
5153
|
-
runAttempt:
|
|
5224
|
+
runAttempt: faultedReceipt.runAttempt,
|
|
5154
5225
|
});
|
|
5155
5226
|
if (!failed) {
|
|
5156
5227
|
await forceFailRuntimeWorkReceiptForRuntimeTestFault(context, {
|
|
5157
5228
|
playName: input.playName,
|
|
5158
|
-
runId:
|
|
5159
|
-
key:
|
|
5229
|
+
runId: faultedReceipt.runId,
|
|
5230
|
+
key: faultedReceipt.key,
|
|
5160
5231
|
error: error.message,
|
|
5161
5232
|
failureKind: 'repairable',
|
|
5162
|
-
runAttempt:
|
|
5233
|
+
runAttempt: faultedReceipt.runAttempt,
|
|
5163
5234
|
});
|
|
5164
5235
|
}
|
|
5165
5236
|
}
|
|
@@ -5238,6 +5309,7 @@ export async function completeRuntimeWorkReceipts(
|
|
|
5238
5309
|
SET status = $6::smallint,
|
|
5239
5310
|
output = inputs.output,
|
|
5240
5311
|
error = NULL,
|
|
5312
|
+
error_payload = NULL,
|
|
5241
5313
|
failure_kind = 0,
|
|
5242
5314
|
run_id = inputs.run_id,
|
|
5243
5315
|
lease_id = NULL,
|
|
@@ -5257,6 +5329,7 @@ export async function completeRuntimeWorkReceipts(
|
|
|
5257
5329
|
target.status,
|
|
5258
5330
|
CASE WHEN $7::boolean THEN target.output ELSE NULL::jsonb END AS output,
|
|
5259
5331
|
target.error,
|
|
5332
|
+
target.error_payload,
|
|
5260
5333
|
target.failure_kind,
|
|
5261
5334
|
target.run_id,
|
|
5262
5335
|
target.lease_id,
|
|
@@ -5271,6 +5344,7 @@ export async function completeRuntimeWorkReceipts(
|
|
|
5271
5344
|
target.status,
|
|
5272
5345
|
CASE WHEN $7::boolean THEN target.output ELSE NULL::jsonb END AS output,
|
|
5273
5346
|
target.error,
|
|
5347
|
+
target.error_payload,
|
|
5274
5348
|
target.failure_kind,
|
|
5275
5349
|
target.run_id,
|
|
5276
5350
|
target.lease_id,
|
|
@@ -5290,15 +5364,16 @@ export async function completeRuntimeWorkReceipts(
|
|
|
5290
5364
|
})}
|
|
5291
5365
|
),
|
|
5292
5366
|
resolved AS (
|
|
5293
|
-
SELECT ord, k, status, output, error, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM completed
|
|
5367
|
+
SELECT ord, k, status, output, error, error_payload, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM completed
|
|
5294
5368
|
UNION ALL
|
|
5295
|
-
SELECT ord, k, status, output, error, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM replay
|
|
5369
|
+
SELECT ord, k, status, output, error, error_payload, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM replay
|
|
5296
5370
|
),
|
|
5297
5371
|
returned AS (
|
|
5298
5372
|
SELECT resolved.k,
|
|
5299
5373
|
resolved.status,
|
|
5300
5374
|
resolved.output,
|
|
5301
5375
|
resolved.error,
|
|
5376
|
+
resolved.error_payload,
|
|
5302
5377
|
resolved.failure_kind,
|
|
5303
5378
|
resolved.run_id,
|
|
5304
5379
|
resolved.lease_id,
|
|
@@ -5314,6 +5389,7 @@ export async function completeRuntimeWorkReceipts(
|
|
|
5314
5389
|
returned.status,
|
|
5315
5390
|
returned.output,
|
|
5316
5391
|
returned.error,
|
|
5392
|
+
returned.error_payload,
|
|
5317
5393
|
returned.failure_kind,
|
|
5318
5394
|
returned.run_id,
|
|
5319
5395
|
returned.lease_id,
|
|
@@ -5356,6 +5432,7 @@ export async function failRuntimeWorkReceipt(
|
|
|
5356
5432
|
runAttempt?: number | null;
|
|
5357
5433
|
leaseId?: string | null;
|
|
5358
5434
|
error: string;
|
|
5435
|
+
errorPayload?: ToolExecutionFailureV1 | null;
|
|
5359
5436
|
failureKind?: WorkReceiptFailureKind | null;
|
|
5360
5437
|
},
|
|
5361
5438
|
): Promise<WorkReceipt | null> {
|
|
@@ -5376,6 +5453,7 @@ export async function failRuntimeWorkReceipt(
|
|
|
5376
5453
|
SET status = $2::smallint,
|
|
5377
5454
|
output = NULL,
|
|
5378
5455
|
error = $3,
|
|
5456
|
+
error_payload = $8::jsonb,
|
|
5379
5457
|
failure_kind = $6::smallint,
|
|
5380
5458
|
run_id = $4,
|
|
5381
5459
|
lease_id = NULL,
|
|
@@ -5394,6 +5472,7 @@ export async function failRuntimeWorkReceipt(
|
|
|
5394
5472
|
status,
|
|
5395
5473
|
output,
|
|
5396
5474
|
error,
|
|
5475
|
+
error_payload,
|
|
5397
5476
|
failure_kind,
|
|
5398
5477
|
run_id,
|
|
5399
5478
|
lease_id,
|
|
@@ -5407,6 +5486,7 @@ export async function failRuntimeWorkReceipt(
|
|
|
5407
5486
|
status,
|
|
5408
5487
|
output,
|
|
5409
5488
|
error,
|
|
5489
|
+
error_payload,
|
|
5410
5490
|
failure_kind,
|
|
5411
5491
|
run_id,
|
|
5412
5492
|
lease_id,
|
|
@@ -5423,9 +5503,9 @@ export async function failRuntimeWorkReceipt(
|
|
|
5423
5503
|
ownerRunIdSql: '$4',
|
|
5424
5504
|
})}
|
|
5425
5505
|
)
|
|
5426
|
-
SELECT k, status, output, error, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM failed
|
|
5506
|
+
SELECT k, status, output, error, error_payload, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM failed
|
|
5427
5507
|
UNION ALL
|
|
5428
|
-
SELECT k, status, output, error, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM replay
|
|
5508
|
+
SELECT k, status, output, error, error_payload, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM replay
|
|
5429
5509
|
`,
|
|
5430
5510
|
[
|
|
5431
5511
|
workReceiptKeyHex(input.key),
|
|
@@ -5435,6 +5515,7 @@ export async function failRuntimeWorkReceipt(
|
|
|
5435
5515
|
leaseId,
|
|
5436
5516
|
workReceiptFailureKindCode(input.failureKind),
|
|
5437
5517
|
runAttempt,
|
|
5518
|
+
input.errorPayload ? JSON.stringify(input.errorPayload) : null,
|
|
5438
5519
|
],
|
|
5439
5520
|
);
|
|
5440
5521
|
return rows[0] ? mapRuntimeWorkReceiptRow(rows[0]) : null;
|
|
@@ -5469,6 +5550,7 @@ export async function releaseRuntimeWorkReceipt(
|
|
|
5469
5550
|
SET status = $2::smallint,
|
|
5470
5551
|
output = NULL,
|
|
5471
5552
|
error = NULL,
|
|
5553
|
+
error_payload = NULL,
|
|
5472
5554
|
failure_kind = 0,
|
|
5473
5555
|
run_id = $3,
|
|
5474
5556
|
lease_id = NULL,
|
|
@@ -5487,6 +5569,7 @@ export async function releaseRuntimeWorkReceipt(
|
|
|
5487
5569
|
status,
|
|
5488
5570
|
output,
|
|
5489
5571
|
error,
|
|
5572
|
+
error_payload,
|
|
5490
5573
|
failure_kind,
|
|
5491
5574
|
run_id,
|
|
5492
5575
|
lease_id,
|
|
@@ -5495,7 +5578,7 @@ export async function releaseRuntimeWorkReceipt(
|
|
|
5495
5578
|
lease_expires_at,
|
|
5496
5579
|
updated_at
|
|
5497
5580
|
)
|
|
5498
|
-
SELECT k, status, output, error, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM released
|
|
5581
|
+
SELECT k, status, output, error, error_payload, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM released
|
|
5499
5582
|
`,
|
|
5500
5583
|
[
|
|
5501
5584
|
workReceiptKeyHex(input.key),
|
|
@@ -5518,6 +5601,7 @@ export async function failRuntimeWorkReceipts(
|
|
|
5518
5601
|
runId: string;
|
|
5519
5602
|
key: string;
|
|
5520
5603
|
error: string;
|
|
5604
|
+
errorPayload?: ToolExecutionFailureV1 | null;
|
|
5521
5605
|
failureKind?: WorkReceiptFailureKind | null;
|
|
5522
5606
|
leaseId?: string | null;
|
|
5523
5607
|
runAttempt?: number | null;
|
|
@@ -5542,6 +5626,7 @@ export async function failRuntimeWorkReceipts(
|
|
|
5542
5626
|
lease_values.lease_id,
|
|
5543
5627
|
attempt_values.run_attempt,
|
|
5544
5628
|
error_values.error,
|
|
5629
|
+
payload_values.error_payload::jsonb,
|
|
5545
5630
|
failure_kind_values.failure_kind,
|
|
5546
5631
|
key_values.ord
|
|
5547
5632
|
FROM unnest($1::text[]) WITH ORDINALITY AS key_values(key_hex, ord)
|
|
@@ -5555,12 +5640,15 @@ export async function failRuntimeWorkReceipts(
|
|
|
5555
5640
|
ON error_values.ord = key_values.ord
|
|
5556
5641
|
JOIN unnest($6::smallint[]) WITH ORDINALITY AS failure_kind_values(failure_kind, ord)
|
|
5557
5642
|
ON failure_kind_values.ord = key_values.ord
|
|
5643
|
+
JOIN unnest($7::text[]) WITH ORDINALITY AS payload_values(error_payload, ord)
|
|
5644
|
+
ON payload_values.ord = key_values.ord
|
|
5558
5645
|
),
|
|
5559
5646
|
failed AS (
|
|
5560
5647
|
UPDATE ${workReceiptTable(session)} AS target
|
|
5561
|
-
SET status = $
|
|
5648
|
+
SET status = $8::smallint,
|
|
5562
5649
|
output = NULL,
|
|
5563
5650
|
error = inputs.error,
|
|
5651
|
+
error_payload = inputs.error_payload,
|
|
5564
5652
|
failure_kind = inputs.failure_kind,
|
|
5565
5653
|
run_id = inputs.run_id,
|
|
5566
5654
|
lease_id = NULL,
|
|
@@ -5580,6 +5668,7 @@ export async function failRuntimeWorkReceipts(
|
|
|
5580
5668
|
target.status,
|
|
5581
5669
|
target.output,
|
|
5582
5670
|
target.error,
|
|
5671
|
+
target.error_payload,
|
|
5583
5672
|
target.failure_kind,
|
|
5584
5673
|
target.run_id,
|
|
5585
5674
|
target.lease_id,
|
|
@@ -5594,6 +5683,7 @@ export async function failRuntimeWorkReceipts(
|
|
|
5594
5683
|
target.status,
|
|
5595
5684
|
target.output,
|
|
5596
5685
|
target.error,
|
|
5686
|
+
target.error_payload,
|
|
5597
5687
|
target.failure_kind,
|
|
5598
5688
|
target.run_id,
|
|
5599
5689
|
target.lease_id,
|
|
@@ -5608,20 +5698,21 @@ export async function failRuntimeWorkReceipts(
|
|
|
5608
5698
|
WHERE NOT EXISTS (SELECT 1 FROM failed WHERE failed.ord = inputs.ord)
|
|
5609
5699
|
AND ${workReceiptTerminalReplayPredicateSql({
|
|
5610
5700
|
receiptTable: 'target',
|
|
5611
|
-
terminalStatusSql: '$
|
|
5701
|
+
terminalStatusSql: '$8',
|
|
5612
5702
|
ownerRunIdSql: 'inputs.run_id',
|
|
5613
5703
|
})}
|
|
5614
5704
|
),
|
|
5615
5705
|
resolved AS (
|
|
5616
|
-
SELECT ord, k, status, output, error, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM failed
|
|
5706
|
+
SELECT ord, k, status, output, error, error_payload, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM failed
|
|
5617
5707
|
UNION ALL
|
|
5618
|
-
SELECT ord, k, status, output, error, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM replay
|
|
5708
|
+
SELECT ord, k, status, output, error, error_payload, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM replay
|
|
5619
5709
|
),
|
|
5620
5710
|
returned AS (
|
|
5621
5711
|
SELECT resolved.k,
|
|
5622
5712
|
resolved.status,
|
|
5623
5713
|
resolved.output,
|
|
5624
5714
|
resolved.error,
|
|
5715
|
+
resolved.error_payload,
|
|
5625
5716
|
resolved.failure_kind,
|
|
5626
5717
|
resolved.run_id,
|
|
5627
5718
|
resolved.lease_id,
|
|
@@ -5637,6 +5728,7 @@ export async function failRuntimeWorkReceipts(
|
|
|
5637
5728
|
returned.status,
|
|
5638
5729
|
returned.output,
|
|
5639
5730
|
returned.error,
|
|
5731
|
+
returned.error_payload,
|
|
5640
5732
|
returned.failure_kind,
|
|
5641
5733
|
returned.run_id,
|
|
5642
5734
|
returned.lease_id,
|
|
@@ -5658,6 +5750,9 @@ export async function failRuntimeWorkReceipts(
|
|
|
5658
5750
|
receipts.map((receipt) =>
|
|
5659
5751
|
workReceiptFailureKindCode(receipt.failureKind),
|
|
5660
5752
|
),
|
|
5753
|
+
receipts.map((receipt) =>
|
|
5754
|
+
receipt.errorPayload ? JSON.stringify(receipt.errorPayload) : null,
|
|
5755
|
+
),
|
|
5661
5756
|
RECEIPT_STATUS_FAILED,
|
|
5662
5757
|
],
|
|
5663
5758
|
);
|
|
@@ -5718,6 +5813,7 @@ export async function heartbeatRuntimeWorkReceipts(
|
|
|
5718
5813
|
target.status,
|
|
5719
5814
|
target.output,
|
|
5720
5815
|
target.error,
|
|
5816
|
+
target.error_payload,
|
|
5721
5817
|
target.failure_kind,
|
|
5722
5818
|
target.run_id,
|
|
5723
5819
|
target.lease_id,
|
|
@@ -5732,6 +5828,7 @@ export async function heartbeatRuntimeWorkReceipts(
|
|
|
5732
5828
|
renewed.status,
|
|
5733
5829
|
renewed.output,
|
|
5734
5830
|
renewed.error,
|
|
5831
|
+
renewed.error_payload,
|
|
5735
5832
|
renewed.failure_kind,
|
|
5736
5833
|
renewed.run_id,
|
|
5737
5834
|
renewed.lease_id,
|
|
@@ -5747,6 +5844,7 @@ export async function heartbeatRuntimeWorkReceipts(
|
|
|
5747
5844
|
returned.status,
|
|
5748
5845
|
returned.output,
|
|
5749
5846
|
returned.error,
|
|
5847
|
+
returned.error_payload,
|
|
5750
5848
|
returned.failure_kind,
|
|
5751
5849
|
returned.run_id,
|
|
5752
5850
|
returned.lease_id,
|
|
@@ -5800,6 +5898,7 @@ export async function skipRuntimeWorkReceipt(
|
|
|
5800
5898
|
SET status = $2::smallint,
|
|
5801
5899
|
output = $3::jsonb,
|
|
5802
5900
|
error = NULL,
|
|
5901
|
+
error_payload = NULL,
|
|
5803
5902
|
failure_kind = 0,
|
|
5804
5903
|
run_id = $4,
|
|
5805
5904
|
lease_id = NULL,
|
|
@@ -5818,6 +5917,7 @@ export async function skipRuntimeWorkReceipt(
|
|
|
5818
5917
|
status,
|
|
5819
5918
|
output,
|
|
5820
5919
|
error,
|
|
5920
|
+
error_payload,
|
|
5821
5921
|
failure_kind,
|
|
5822
5922
|
run_id,
|
|
5823
5923
|
lease_id,
|
|
@@ -5826,7 +5926,7 @@ export async function skipRuntimeWorkReceipt(
|
|
|
5826
5926
|
lease_expires_at,
|
|
5827
5927
|
updated_at
|
|
5828
5928
|
)
|
|
5829
|
-
SELECT k, status, output, error, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM skipped
|
|
5929
|
+
SELECT k, status, output, error, error_payload, failure_kind, run_id, lease_id, lease_owner_run_id, lease_owner_attempt, lease_expires_at, updated_at FROM skipped
|
|
5830
5930
|
`,
|
|
5831
5931
|
[
|
|
5832
5932
|
workReceiptKeyHex(input.key),
|