@indigoai-us/hq-cloud 6.18.44-alpha.1 → 6.18.44-alpha.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/dist/bin/sync-runner-watch-loop.d.ts +39 -0
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +134 -14
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner.test.js +606 -1
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/journal-snapshot-memory-helpers.d.ts +3 -1
- package/dist/journal-snapshot-memory-helpers.d.ts.map +1 -1
- package/dist/journal-snapshot-memory-helpers.js +103 -17
- package/dist/journal-snapshot-memory-helpers.js.map +1 -1
- package/dist/journal-snapshot-memory.test.js +10 -2
- package/dist/journal-snapshot-memory.test.js.map +1 -1
- package/dist/sync/push-receiver.d.ts.map +1 -1
- package/dist/sync/push-receiver.js +11 -6
- package/dist/sync/push-receiver.js.map +1 -1
- package/dist/sync/push-receiver.test.js +56 -1
- package/dist/sync/push-receiver.test.js.map +1 -1
- package/package.json +1 -1
|
@@ -38,6 +38,20 @@ export declare const REALTIME_WORKER_OCCUPANCY_CAP = 2;
|
|
|
38
38
|
export declare const REALTIME_LARGE_UPLOAD_THRESHOLD_BYTES: number;
|
|
39
39
|
export declare function setRealtimeAdmissionDeadlineMsForTesting(ms: number | undefined): void;
|
|
40
40
|
export declare function setRealtimeDrainBurstMsForTesting(ms: number | undefined): void;
|
|
41
|
+
/**
|
|
42
|
+
* Retry delay for a watcher push or pull refused at the admission deadline.
|
|
43
|
+
* The refusal is a deferral, not a pass failure, so it does not advance the
|
|
44
|
+
* route's failure backoff. Each retry can wait up to the deadline again,
|
|
45
|
+
* so a long chore costs at most one attempt per deadline plus this delay.
|
|
46
|
+
*/
|
|
47
|
+
export declare const REALTIME_ADMISSION_RETRY_MS = 5000;
|
|
48
|
+
/**
|
|
49
|
+
* In-process result of a scoped drain whose only shortfall was admission
|
|
50
|
+
* deferrals: the paths are restored and a retry is scheduled. Never a
|
|
51
|
+
* process exit code (negative), so it cannot reach the menubar's exit
|
|
52
|
+
* handling, and it is not 0, so it does not count as a completed pass.
|
|
53
|
+
*/
|
|
54
|
+
export declare const SCOPED_DRAIN_DEFERRED = -1;
|
|
41
55
|
export declare class RealtimeAdmissionTimeoutError extends Error {
|
|
42
56
|
readonly retryable = true;
|
|
43
57
|
constructor(deadlineMs: number);
|
|
@@ -122,6 +136,11 @@ export declare class CooperativePassScheduler<T> {
|
|
|
122
136
|
});
|
|
123
137
|
get handoffActive(): boolean;
|
|
124
138
|
get hasActiveChore(): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* A chore owns the slot, or has lent it through a checkpoint or network
|
|
141
|
+
* hand-off and will take it back. Hand-offs only ever start from a chore.
|
|
142
|
+
*/
|
|
143
|
+
private get choreHoldsSlot();
|
|
125
144
|
get hasActiveSlowRealtime(): boolean;
|
|
126
145
|
/** Includes the running slow/fast lanes and hand-off occupants; it never changes their cap. */
|
|
127
146
|
get activeRealtimeWorkerCount(): number;
|
|
@@ -131,6 +150,26 @@ export declare class CooperativePassScheduler<T> {
|
|
|
131
150
|
private abortedError;
|
|
132
151
|
/** Realtime stays ahead of a queued full chore so retries are not buried. */
|
|
133
152
|
private enqueuePending;
|
|
153
|
+
/**
|
|
154
|
+
* Bound how long a queued realtime entry sits behind a chore, counted from
|
|
155
|
+
* the first moment a chore holds the slot while it is queued. Time spent
|
|
156
|
+
* behind other realtime work does not count against it. Idempotent while
|
|
157
|
+
* the same chore holds the slot: an entry keeps its first deadline across
|
|
158
|
+
* that chore's hand-offs. Cleared when the chore finishes.
|
|
159
|
+
*/
|
|
160
|
+
private armAdmission;
|
|
161
|
+
/**
|
|
162
|
+
* A chore has taken (or taken back) the slot. Realtime queued while it
|
|
163
|
+
* was lent, or behind other realtime, would otherwise wait for the chore's
|
|
164
|
+
* next checkpoint with no bound.
|
|
165
|
+
*/
|
|
166
|
+
private armQueuedRealtime;
|
|
167
|
+
/**
|
|
168
|
+
* No chore holds the slot any more. Queued realtime now waits only behind
|
|
169
|
+
* other realtime, which does not count against the deadline; the next
|
|
170
|
+
* chore to take the slot arms a fresh one.
|
|
171
|
+
*/
|
|
172
|
+
private disarmQueuedRealtime;
|
|
134
173
|
private clearAdmission;
|
|
135
174
|
private dropPending;
|
|
136
175
|
private expireAdmission;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-runner-watch-loop.d.ts","sourceRoot":"","sources":["../../src/bin/sync-runner-watch-loop.ts"],"names":[],"mappings":"AAmCA,OAAO,EAML,KAAK,UAAU,EAEf,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAUL,WAAW,EAYZ,MAAM,eAAe,CAAC;AAevB,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AASlC,OAAO,EACL,UAAU,EA0CX,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EAEL,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,eAAe,EAIrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAahD,OAAO,KAAK,EACV,yBAAyB,EACzB,SAAS,EAET,cAAc,EACd,iBAAiB,EAElB,MAAM,kBAAkB,CAAC;AAI1B,+EAA+E;AAC/E,eAAO,MAAM,mCAAmC,OAAQ,CAAC;AACzD,yEAAyE;AACzE,eAAO,MAAM,uBAAuB,QAAiB,CAAC;AACtD;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,QACI,CAAC;AAChD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,QAAiC,CAAC;AACtE;;;;;;GAM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CAAC,CAAC;AAwC5D;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,QAAQ,GAAG,WAAW,GAC3B,KAAK,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CASvC;AAED;;;;;;;GAOG;AACH,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,SAAS,EACzC,gBAAgB,EAAE,MAAM,GACvB,MAAM,GAAG,SAAS,CAQpB;AAWD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oCAAoC,CAClD,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAIT;AAeD,wBAAgB,0CAA0C,CACxD,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAET;AA8ED,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CAwsIjB"}
|
|
@@ -84,6 +84,20 @@ function realtimeAdmissionDeadlineMs() {
|
|
|
84
84
|
function realtimeDrainBurstMs() {
|
|
85
85
|
return realtimeDrainBurstMsForTest ?? REALTIME_DRAIN_BURST_MS;
|
|
86
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Retry delay for a watcher push or pull refused at the admission deadline.
|
|
89
|
+
* The refusal is a deferral, not a pass failure, so it does not advance the
|
|
90
|
+
* route's failure backoff. Each retry can wait up to the deadline again,
|
|
91
|
+
* so a long chore costs at most one attempt per deadline plus this delay.
|
|
92
|
+
*/
|
|
93
|
+
export const REALTIME_ADMISSION_RETRY_MS = 5_000;
|
|
94
|
+
/**
|
|
95
|
+
* In-process result of a scoped drain whose only shortfall was admission
|
|
96
|
+
* deferrals: the paths are restored and a retry is scheduled. Never a
|
|
97
|
+
* process exit code (negative), so it cannot reach the menubar's exit
|
|
98
|
+
* handling, and it is not 0, so it does not count as a completed pass.
|
|
99
|
+
*/
|
|
100
|
+
export const SCOPED_DRAIN_DEFERRED = -1;
|
|
87
101
|
export class RealtimeAdmissionTimeoutError extends Error {
|
|
88
102
|
retryable = true;
|
|
89
103
|
constructor(deadlineMs) {
|
|
@@ -227,6 +241,13 @@ export class CooperativePassScheduler {
|
|
|
227
241
|
get hasActiveChore() {
|
|
228
242
|
return this.active?.workClass === "chore";
|
|
229
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* A chore owns the slot, or has lent it through a checkpoint or network
|
|
246
|
+
* hand-off and will take it back. Hand-offs only ever start from a chore.
|
|
247
|
+
*/
|
|
248
|
+
get choreHoldsSlot() {
|
|
249
|
+
return this.hasActiveChore || this._handoffActive || this.detachedChore !== null;
|
|
250
|
+
}
|
|
230
251
|
get hasActiveSlowRealtime() {
|
|
231
252
|
return this.active?.workClass === "realtime" && this.active.lane === "slow";
|
|
232
253
|
}
|
|
@@ -297,12 +318,8 @@ export class CooperativePassScheduler {
|
|
|
297
318
|
resolve,
|
|
298
319
|
reject,
|
|
299
320
|
};
|
|
300
|
-
if (workClass === "realtime" && this.
|
|
301
|
-
|
|
302
|
-
entry.admissionTimer = setTimeout(() => {
|
|
303
|
-
this.expireAdmission(entry, deadlineMs);
|
|
304
|
-
}, deadlineMs);
|
|
305
|
-
entry.admissionTimer.unref?.();
|
|
321
|
+
if (workClass === "realtime" && this.choreHoldsSlot) {
|
|
322
|
+
this.armAdmission(entry);
|
|
306
323
|
}
|
|
307
324
|
if (signal) {
|
|
308
325
|
const onAbort = () => {
|
|
@@ -351,6 +368,44 @@ export class CooperativePassScheduler {
|
|
|
351
368
|
}
|
|
352
369
|
this.pending.push(entry);
|
|
353
370
|
}
|
|
371
|
+
/**
|
|
372
|
+
* Bound how long a queued realtime entry sits behind a chore, counted from
|
|
373
|
+
* the first moment a chore holds the slot while it is queued. Time spent
|
|
374
|
+
* behind other realtime work does not count against it. Idempotent while
|
|
375
|
+
* the same chore holds the slot: an entry keeps its first deadline across
|
|
376
|
+
* that chore's hand-offs. Cleared when the chore finishes.
|
|
377
|
+
*/
|
|
378
|
+
armAdmission(entry) {
|
|
379
|
+
if (entry.workClass !== "realtime" || entry.admissionTimer !== undefined)
|
|
380
|
+
return;
|
|
381
|
+
const deadlineMs = realtimeAdmissionDeadlineMs();
|
|
382
|
+
entry.admissionTimer = setTimeout(() => {
|
|
383
|
+
this.expireAdmission(entry, deadlineMs);
|
|
384
|
+
}, deadlineMs);
|
|
385
|
+
entry.admissionTimer.unref?.();
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* A chore has taken (or taken back) the slot. Realtime queued while it
|
|
389
|
+
* was lent, or behind other realtime, would otherwise wait for the chore's
|
|
390
|
+
* next checkpoint with no bound.
|
|
391
|
+
*/
|
|
392
|
+
armQueuedRealtime() {
|
|
393
|
+
for (const entry of this.pending)
|
|
394
|
+
this.armAdmission(entry);
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* No chore holds the slot any more. Queued realtime now waits only behind
|
|
398
|
+
* other realtime, which does not count against the deadline; the next
|
|
399
|
+
* chore to take the slot arms a fresh one.
|
|
400
|
+
*/
|
|
401
|
+
disarmQueuedRealtime() {
|
|
402
|
+
for (const entry of this.pending) {
|
|
403
|
+
if (entry.admissionTimer === undefined)
|
|
404
|
+
continue;
|
|
405
|
+
clearTimeout(entry.admissionTimer);
|
|
406
|
+
entry.admissionTimer = undefined;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
354
409
|
clearAdmission(entry) {
|
|
355
410
|
if (entry.admissionTimer !== undefined) {
|
|
356
411
|
clearTimeout(entry.admissionTimer);
|
|
@@ -431,6 +486,8 @@ export class CooperativePassScheduler {
|
|
|
431
486
|
start(entry) {
|
|
432
487
|
this.clearAdmission(entry);
|
|
433
488
|
this.active = entry;
|
|
489
|
+
if (entry.workClass === "chore")
|
|
490
|
+
this.armQueuedRealtime();
|
|
434
491
|
let current;
|
|
435
492
|
try {
|
|
436
493
|
current = this.execute(entry);
|
|
@@ -456,6 +513,8 @@ export class CooperativePassScheduler {
|
|
|
456
513
|
complete(entry) {
|
|
457
514
|
if (this.active === entry)
|
|
458
515
|
this.active = null;
|
|
516
|
+
if (entry.workClass === "chore" && !this.choreHoldsSlot)
|
|
517
|
+
this.disarmQueuedRealtime();
|
|
459
518
|
this.drain();
|
|
460
519
|
}
|
|
461
520
|
startFastRealtime(entry) {
|
|
@@ -608,8 +667,10 @@ export class CooperativePassScheduler {
|
|
|
608
667
|
this.handoffDeferredAt = null;
|
|
609
668
|
this.handoffBacklog = null;
|
|
610
669
|
this.detachedChore = null;
|
|
611
|
-
if (!this.stopped)
|
|
670
|
+
if (!this.stopped) {
|
|
612
671
|
this.active = entry;
|
|
672
|
+
this.armQueuedRealtime();
|
|
673
|
+
}
|
|
613
674
|
this.options.caps?.resumeAfterHandoff();
|
|
614
675
|
const resolveRelease = this.resolveNetworkTransferRelease;
|
|
615
676
|
const realtimeRan = this.handoffAdmitted;
|
|
@@ -832,8 +893,10 @@ export class CooperativePassScheduler {
|
|
|
832
893
|
this._handoffActive = false;
|
|
833
894
|
this.handoffDeferredAt = null;
|
|
834
895
|
this.handoffBacklog = null;
|
|
835
|
-
if (!this.stopped)
|
|
896
|
+
if (!this.stopped) {
|
|
836
897
|
this.active = entry;
|
|
898
|
+
this.armQueuedRealtime();
|
|
899
|
+
}
|
|
837
900
|
this.options.caps?.resumeAfterHandoff();
|
|
838
901
|
}
|
|
839
902
|
return this.handoffAdmitted;
|
|
@@ -2094,7 +2157,16 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2094
2157
|
const execution = {
|
|
2095
2158
|
run: async (slice) => {
|
|
2096
2159
|
telemetry?.mark("conflict");
|
|
2097
|
-
|
|
2160
|
+
let result;
|
|
2161
|
+
try {
|
|
2162
|
+
result = await task(slice, telemetry, true);
|
|
2163
|
+
}
|
|
2164
|
+
catch (error) {
|
|
2165
|
+
if (error instanceof RealtimeAdmissionTimeoutError) {
|
|
2166
|
+
execution.admissionTimeout = error;
|
|
2167
|
+
}
|
|
2168
|
+
throw error;
|
|
2169
|
+
}
|
|
2098
2170
|
telemetry?.mark("commit");
|
|
2099
2171
|
return result;
|
|
2100
2172
|
},
|
|
@@ -2117,12 +2189,19 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2117
2189
|
: "retryable";
|
|
2118
2190
|
telemetry.finish(outcomeLabel, realtimeTelemetryReason(outcome.paths));
|
|
2119
2191
|
}
|
|
2192
|
+
const admissionTimeout = execution.result === undefined &&
|
|
2193
|
+
execution.admissionTimeout !== undefined &&
|
|
2194
|
+
outcome.paths.length > 0 &&
|
|
2195
|
+
outcome.paths.every((path) => path.status === "retryable")
|
|
2196
|
+
? execution.admissionTimeout
|
|
2197
|
+
: undefined;
|
|
2120
2198
|
return {
|
|
2121
2199
|
result: execution.result ?? (allRefused ? 0 : 1),
|
|
2122
2200
|
accepted,
|
|
2123
2201
|
coordinatorRefusedPaths: normalizeCoordinatorPaths(outcome.paths
|
|
2124
2202
|
.filter((path) => path.status === "refused")
|
|
2125
2203
|
.map((path) => path.path)),
|
|
2204
|
+
...(admissionTimeout ? { admissionTimeout } : {}),
|
|
2126
2205
|
};
|
|
2127
2206
|
}
|
|
2128
2207
|
catch (error) {
|
|
@@ -3439,6 +3518,16 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
3439
3518
|
emitScopedPushFailureTelemetry?.(event);
|
|
3440
3519
|
}
|
|
3441
3520
|
};
|
|
3521
|
+
/**
|
|
3522
|
+
* The push never ran: a chore held the slot past the admission deadline.
|
|
3523
|
+
* Put the paths back and retry without counting a failure, so the route
|
|
3524
|
+
* backoff, the scoped-push-failure line and its telemetry stay for real
|
|
3525
|
+
* pass failures.
|
|
3526
|
+
*/
|
|
3527
|
+
const deferPushAfterAdmissionTimeout = (group, routeId) => {
|
|
3528
|
+
restorePendingWatcherPaths(group.paths, watcherBatchGeneration, group.changes);
|
|
3529
|
+
scheduleRoutePushRetry(routeId, REALTIME_ADMISSION_RETRY_MS);
|
|
3530
|
+
};
|
|
3442
3531
|
if (watcherDrainRunsPush && grouped) {
|
|
3443
3532
|
for (const group of grouped.values()) {
|
|
3444
3533
|
// Paused workspaces: drop the scoped push without uploading or
|
|
@@ -3536,6 +3625,9 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
3536
3625
|
}
|
|
3537
3626
|
}
|
|
3538
3627
|
}
|
|
3628
|
+
else if ("admissionTimeout" in execution && execution.admissionTimeout) {
|
|
3629
|
+
deferPushAfterAdmissionTimeout(group, routeId);
|
|
3630
|
+
}
|
|
3539
3631
|
else if (pushExit === UNRESOLVED_COMPANY_EXIT) {
|
|
3540
3632
|
routePushFailureBackoff.succeeded(routeId);
|
|
3541
3633
|
clearRoutePushRetry(routeId);
|
|
@@ -3554,6 +3646,10 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
3554
3646
|
}
|
|
3555
3647
|
}
|
|
3556
3648
|
catch (err) {
|
|
3649
|
+
if (err instanceof RealtimeAdmissionTimeoutError) {
|
|
3650
|
+
deferPushAfterAdmissionTimeout(group, routeId);
|
|
3651
|
+
continue;
|
|
3652
|
+
}
|
|
3557
3653
|
recordPushFailure(group.route, 1, pushFailureText(1, group.route, err));
|
|
3558
3654
|
restorePendingWatcherPaths(group.paths, watcherBatchGeneration, group.changes);
|
|
3559
3655
|
}
|
|
@@ -3568,6 +3664,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
3568
3664
|
// falls back to the unscoped drain shape.
|
|
3569
3665
|
if (grouped) {
|
|
3570
3666
|
let worstExit = 0;
|
|
3667
|
+
let deferred = false;
|
|
3571
3668
|
let ranPersonalDrain = false;
|
|
3572
3669
|
for (const group of grouped.values()) {
|
|
3573
3670
|
// Paused workspaces sync in NO direction while Off.
|
|
@@ -3598,12 +3695,25 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
3598
3695
|
const slicePaths = slice.paths.map((path) => path.canonicalPath);
|
|
3599
3696
|
return runGuarded(buildTargetedPullArgv(group.route, passArgv, slicePaths, exactFileUpserts.filter((relativePath) => slicePaths.includes(relativePath))), undefined, lane, "realtime", false, slice.signal, false, telemetry, coordinatorFenced);
|
|
3600
3697
|
})
|
|
3601
|
-
:
|
|
3698
|
+
: await runGuarded(pullArgv, undefined, lane, "realtime").then((result) => ({ result, accepted: true }), (error) => {
|
|
3699
|
+
if (error instanceof RealtimeAdmissionTimeoutError) {
|
|
3700
|
+
return { accepted: false, admissionTimeout: error };
|
|
3701
|
+
}
|
|
3702
|
+
throw error;
|
|
3703
|
+
});
|
|
3704
|
+
if ("admissionTimeout" in execution && execution.admissionTimeout) {
|
|
3705
|
+
// The pull never ran. Keep its paths and retry, without the
|
|
3706
|
+
// pass-failure handling the shared exit code would get.
|
|
3707
|
+
restorePendingWatcherPaths(group.paths, watcherBatchGeneration, group.changes);
|
|
3708
|
+
scheduleRoutePushRetry(`pull:${routeKey(group.route)}`, REALTIME_ADMISSION_RETRY_MS);
|
|
3709
|
+
deferred = true;
|
|
3710
|
+
continue;
|
|
3711
|
+
}
|
|
3602
3712
|
const exit = scopedRouteDrainExit(execution);
|
|
3603
3713
|
if (exit !== 0 && worstExit === 0)
|
|
3604
3714
|
worstExit = exit;
|
|
3605
3715
|
}
|
|
3606
|
-
return worstExit;
|
|
3716
|
+
return worstExit === 0 && deferred ? SCOPED_DRAIN_DEFERRED : worstExit;
|
|
3607
3717
|
}
|
|
3608
3718
|
// An idle poll has no sound path scope. It also must not turn into an
|
|
3609
3719
|
// unlabelled all-vault pull: scheduled reconciles and the explicit safety
|
|
@@ -3834,7 +3944,8 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
3834
3944
|
continue;
|
|
3835
3945
|
const generation = ++nextWatcherBatchGeneration;
|
|
3836
3946
|
void runScopedDrain(lane, generation, true).then((exit) => {
|
|
3837
|
-
|
|
3947
|
+
// A deferral already restored its paths and scheduled a retry.
|
|
3948
|
+
if (exit === 0 || exit === SCOPED_DRAIN_DEFERRED)
|
|
3838
3949
|
return;
|
|
3839
3950
|
restorePendingWatcherPaths(lane.paths, generation);
|
|
3840
3951
|
interruptWait();
|
|
@@ -3855,7 +3966,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
3855
3966
|
// the same dirty signal as the compatibility drain.
|
|
3856
3967
|
realtimeState.scheduler?.signal("watcher");
|
|
3857
3968
|
void runScopedDrain(lanes.fast, generation, true, true).then((exit) => {
|
|
3858
|
-
if (exit === 0)
|
|
3969
|
+
if (exit === 0 || exit === SCOPED_DRAIN_DEFERRED)
|
|
3859
3970
|
return;
|
|
3860
3971
|
restorePendingWatcherPaths(lanes.fast.paths, generation);
|
|
3861
3972
|
interruptWait();
|
|
@@ -4015,6 +4126,10 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
4015
4126
|
return withScopeContentHashesFile(route, events, slicePaths, (contentHashesFile) => runGuarded(buildTargetedPullArgv(route, passArgv, slicePaths, exactFileUpserts, contentHashesFile), undefined, lane, "realtime", lane === "fast", slice.signal, false, telemetry, coordinatorFenced, receiverSignal));
|
|
4016
4127
|
});
|
|
4017
4128
|
const pathCount = events.length;
|
|
4129
|
+
// Rethrow the typed refusal so the receiver keeps the lease and
|
|
4130
|
+
// retries the whole batch, instead of bisecting a "failed" pull.
|
|
4131
|
+
if (execution.admissionTimeout)
|
|
4132
|
+
throw execution.admissionTimeout;
|
|
4018
4133
|
const exitCode = passExitCode(execution.result);
|
|
4019
4134
|
if (shouldAcknowledgeParallelUnresolvedCompany(execution.accepted, exitCode)) {
|
|
4020
4135
|
if (!unresolvedReceiverMessagesWereRedelivered(events, receiveCountsByPath)) {
|
|
@@ -4748,7 +4863,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
4748
4863
|
const catchupBatch = workingBatch;
|
|
4749
4864
|
const catchupGeneration = pending.generation;
|
|
4750
4865
|
void runScopedDrain(catchupBatch, catchupGeneration, true).then((exit) => {
|
|
4751
|
-
if (exit === 0)
|
|
4866
|
+
if (exit === 0 || exit === SCOPED_DRAIN_DEFERRED)
|
|
4752
4867
|
return;
|
|
4753
4868
|
restorePendingWatcherPaths(catchupBatch.paths, catchupGeneration);
|
|
4754
4869
|
interruptWait();
|
|
@@ -4841,6 +4956,11 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
4841
4956
|
// Keep the watcher alive while preserving the one-shot non-zero code.
|
|
4842
4957
|
process.stderr.write("hq-sync-runner: watch pass skipped — unresolved company target; retrying next poll\n");
|
|
4843
4958
|
}
|
|
4959
|
+
else if (exitCode === SCOPED_DRAIN_DEFERRED) {
|
|
4960
|
+
// Realtime admission deferred part of the scoped drain behind a
|
|
4961
|
+
// chore. The paths are restored and a retry is scheduled; nothing
|
|
4962
|
+
// failed, so nothing is reported.
|
|
4963
|
+
}
|
|
4844
4964
|
else if (exitCode !== 0) {
|
|
4845
4965
|
// A scoped company-resolution or per-pass failure is isolated to that
|
|
4846
4966
|
// pass. The error was emitted by the runner; terminating the daemon
|