@indigoai-us/hq-cloud 6.18.15 → 6.18.16-alpha.1
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 +4 -1
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +117 -17
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner-watch-loop.test.js +211 -3
- package/dist/bin/sync-runner-watch-loop.test.js.map +1 -1
- package/dist/bin/sync-runner.d.ts +12 -1
- package/dist/bin/sync-runner.d.ts.map +1 -1
- package/dist/bin/sync-runner.js +32 -14
- package/dist/bin/sync-runner.js.map +1 -1
- package/dist/bin/sync-runner.test.js +59 -4
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/qmd-reindex.d.ts +30 -10
- package/dist/qmd-reindex.d.ts.map +1 -1
- package/dist/qmd-reindex.js +148 -41
- package/dist/qmd-reindex.js.map +1 -1
- package/dist/qmd-reindex.test.js +191 -78
- package/dist/qmd-reindex.test.js.map +1 -1
- package/dist/sync/event-sync.d.ts +2 -0
- package/dist/sync/event-sync.d.ts.map +1 -1
- package/dist/sync/event-sync.js +15 -1
- package/dist/sync/event-sync.js.map +1 -1
- package/dist/sync/event-sync.test.js +32 -0
- package/dist/sync/event-sync.test.js.map +1 -1
- package/dist/sync/push-receiver.d.ts +21 -1
- package/dist/sync/push-receiver.d.ts.map +1 -1
- package/dist/sync/push-receiver.js +166 -8
- package/dist/sync/push-receiver.js.map +1 -1
- package/dist/sync/push-receiver.test.js +258 -1
- package/dist/sync/push-receiver.test.js.map +1 -1
- package/dist/sync/receiver-last-delivery.d.ts +22 -0
- package/dist/sync/receiver-last-delivery.d.ts.map +1 -0
- package/dist/sync/receiver-last-delivery.js +139 -0
- package/dist/sync/receiver-last-delivery.js.map +1 -0
- package/dist/sync/receiver-last-delivery.test.d.ts +2 -0
- package/dist/sync/receiver-last-delivery.test.d.ts.map +1 -0
- package/dist/sync/receiver-last-delivery.test.js +110 -0
- package/dist/sync/receiver-last-delivery.test.js.map +1 -0
- package/dist/sync/sync-contract.d.ts.map +1 -1
- package/dist/sync/sync-contract.js +1 -0
- package/dist/sync/sync-contract.js.map +1 -1
- package/dist/sync-contract.json +2 -1
- package/dist/watch-owner-lease.d.ts +2 -0
- package/dist/watch-owner-lease.d.ts.map +1 -1
- package/dist/watch-owner-lease.js +3 -2
- package/dist/watch-owner-lease.js.map +1 -1
- package/dist/watch-owner-lease.test.js +22 -4
- package/dist/watch-owner-lease.test.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type TreeChange, type TreeChangeBatch } from "../watcher.js";
|
|
2
2
|
import { readJournal } from "../journal.js";
|
|
3
|
+
import { ReceiverDispatchError } from "../sync/push-receiver.js";
|
|
3
4
|
import { type FeatureSwitch } from "../sync/feature-flags.js";
|
|
4
5
|
import { HeapCensus } from "./sync-runner-heap-telemetry.js";
|
|
5
6
|
import { FullPassCapController } from "../sync/full-pass-caps.js";
|
|
@@ -7,6 +8,7 @@ import { type RealtimeTelemetryReason } from "../sync/realtime-telemetry.js";
|
|
|
7
8
|
import { type PathWorkOutcome } from "../sync/sync-work.js";
|
|
8
9
|
import type { TelemetryClaims } from "../telemetry-events.js";
|
|
9
10
|
import type { JournalEntry } from "../types.js";
|
|
11
|
+
import { type WatchRoute } from "./sync-runner-watch-routes.js";
|
|
10
12
|
import type { CooperativePassCheckpoint, Direction, RunnerLoopDeps, RunnerPassOutcome } from "./sync-runner.js";
|
|
11
13
|
/** Maximum time shutdown waits for event-sync startup before abandoning it. */
|
|
12
14
|
export declare const EVENT_SYNC_STARTUP_SHUTDOWN_WAIT_MS = 5000;
|
|
@@ -349,7 +351,7 @@ export interface WatchLoopRuntime {
|
|
|
349
351
|
runPassWithOperationLockAlreadyHeld: (passArgv: string[], checkpoint?: CooperativePassCheckpoint, onJournalsReady?: () => void, onAppliedUpserts?: (upserts: ReadonlyArray<{
|
|
350
352
|
relativePath: string;
|
|
351
353
|
contentHash: string;
|
|
352
|
-
}>) => void, transferPriority?: "chore" | "realtime") => Promise<number | RunnerPassOutcome>;
|
|
354
|
+
}>) => void, transferPriority?: "chore" | "realtime", qmdSignal?: AbortSignal, qmdHeartbeat?: () => void, qmdHeartbeatIntervalMs?: number) => Promise<number | RunnerPassOutcome>;
|
|
353
355
|
authRequiredPassExit: number;
|
|
354
356
|
defaultGetIdTokenClaims: () => ({
|
|
355
357
|
email?: string;
|
|
@@ -388,6 +390,7 @@ export declare function publishedContentHashFromJournalEntry(entry: Readonly<Jou
|
|
|
388
390
|
*/
|
|
389
391
|
export declare function shouldQuarantineWatcherDeleteIntents(expandedEntries: number, journalEntries: number): boolean;
|
|
390
392
|
export declare function shouldAcknowledgeParallelUnresolvedCompany(accepted: boolean, exitCode: number): boolean;
|
|
393
|
+
export declare function targetedReceiverDispatchError(outcome: number | RunnerPassOutcome, accepted: boolean, authRequiredExitCode: number, route: WatchRoute): ReceiverDispatchError;
|
|
391
394
|
export declare function runOneShotWithOperationLock(argv: string[], parsed: ParsedLoopArgs, deps: RunnerLoopDeps, runtime: WatchLoopRuntime): Promise<number>;
|
|
392
395
|
export declare function runWatchLoop(argv: string[], parsed: ParsedLoopArgs, deps: RunnerLoopDeps, runtime: WatchLoopRuntime): Promise<number>;
|
|
393
396
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-runner-watch-loop.d.ts","sourceRoot":"","sources":["../../src/bin/sync-runner-watch-loop.ts"],"names":[],"mappings":"AAwBA,OAAO,EAML,KAAK,UAAU,EAEf,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAUL,WAAW,EASZ,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"sync-runner-watch-loop.d.ts","sourceRoot":"","sources":["../../src/bin/sync-runner-watch-loop.ts"],"names":[],"mappings":"AAwB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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;AAmBD,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,MAAM,GAAG,iBAAiB,EACnC,QAAQ,EAAE,OAAO,EACjB,oBAAoB,EAAE,MAAM,EAC5B,KAAK,EAAE,UAAU,GAChB,qBAAqB,CAwBvB;AAmCD,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,CA2xHjB"}
|
|
@@ -18,6 +18,7 @@ import { recoverHqRootLocalState } from "../hq-root-recovery.js";
|
|
|
18
18
|
import { clearLocalDeleteIntent, getStateDir, markLocalDeleteIntent, PERSONAL_VAULT_JOURNAL_SLUG, openJournalStoreSession, openJournalStoreSessionAsync, listJournalSlugs, listJournals, maintainAreaJournalSlice, disposeScopedJournalStores, releaseScopedJournalStore, releaseCachedAreaJournalMigrations, journalCacheCensusSizes, emitJournalCacheMetric, journalRows, readJournalScoped, writeJournal, } from "../journal.js";
|
|
19
19
|
import { isPersonalVaultDeletionExcluded } from "../personal-vault.js";
|
|
20
20
|
import { NoopPushReceiver, ReceiverDispatchError, isReceiverTransportFailure, } from "../sync/push-receiver.js";
|
|
21
|
+
import { appendReceiverLastDeliveryEntry, clearReceiverLastDeliveryEntries, readReceiverLastDeliveryEntries, receiverLastDeliveryFilePath, } from "../sync/receiver-last-delivery.js";
|
|
21
22
|
import { CONTENT_HASH_PATTERN } from "../sync/push-event.js";
|
|
22
23
|
import { resolveEventSync, startEventSync as defaultStartEventSync, } from "../sync/event-sync.js";
|
|
23
24
|
import { resolveAreaStorageEnabled, resolveEffectiveParallelSyncRollout, resolveParallelSyncRollout, } from "../sync/feature-flags.js";
|
|
@@ -1330,7 +1331,7 @@ function unresolvedReceiverMessagesWereRedelivered(events, receiveCountsByPath)
|
|
|
1330
1331
|
receiveCounts.every((count) => count !== undefined && Number.isFinite(count) && count >= 2);
|
|
1331
1332
|
});
|
|
1332
1333
|
}
|
|
1333
|
-
function targetedReceiverDispatchError(outcome, accepted, authRequiredExitCode) {
|
|
1334
|
+
export function targetedReceiverDispatchError(outcome, accepted, authRequiredExitCode, route) {
|
|
1334
1335
|
const exitCode = passExitCode(outcome);
|
|
1335
1336
|
const result = typeof outcome === "number" ? undefined : outcome.result;
|
|
1336
1337
|
const diagnostics = [
|
|
@@ -1340,11 +1341,12 @@ function targetedReceiverDispatchError(outcome, accepted, authRequiredExitCode)
|
|
|
1340
1341
|
];
|
|
1341
1342
|
const failureReason = `targeted pull failed with exit code ${exitCode}, accepted=${accepted}` +
|
|
1342
1343
|
(diagnostics.length === 0 ? "" : `: ${[...new Set(diagnostics)].join("; ")}`);
|
|
1343
|
-
const isTransportFailure =
|
|
1344
|
+
const isTransportFailure = !accepted ||
|
|
1345
|
+
exitCode === authRequiredExitCode ||
|
|
1344
1346
|
exitCode === TRANSIENT_NETWORK_EXIT ||
|
|
1345
1347
|
(result?.transient?.length ?? 0) > 0 ||
|
|
1346
1348
|
isReceiverTransportFailure(failureReason);
|
|
1347
|
-
return new ReceiverDispatchError(isTransportFailure ? "transport" : "path-specific", failureReason);
|
|
1349
|
+
return new ReceiverDispatchError(isTransportFailure ? "transport" : "path-specific", failureReason, routeKey(route), exitCode, accepted);
|
|
1348
1350
|
}
|
|
1349
1351
|
/**
|
|
1350
1352
|
* Exit code for one scoped/catch-up route. A 404 company route returns
|
|
@@ -1388,8 +1390,18 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
1388
1390
|
((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
1389
1391
|
const stdout = deps.stdout ?? process.stdout;
|
|
1390
1392
|
const idleHeartbeatIntervalMs = deps.idleHeartbeatIntervalMs ?? WATCH_IDLE_HEARTBEAT_INTERVAL_MS;
|
|
1393
|
+
const writeMaintenanceProgress = () => {
|
|
1394
|
+
stdout.write(JSON.stringify({
|
|
1395
|
+
type: "maintenance-progress",
|
|
1396
|
+
company: "watch",
|
|
1397
|
+
bytesProcessed: 0,
|
|
1398
|
+
totalBytes: 0,
|
|
1399
|
+
}) + "\n");
|
|
1400
|
+
};
|
|
1391
1401
|
const monotonicNow = deps.monotonicNow ?? (() => performance.now());
|
|
1392
1402
|
const runPass = deps.runPass ?? runtime.runPassWithOperationLockAlreadyHeld;
|
|
1403
|
+
const qmdShutdownController = new AbortController();
|
|
1404
|
+
const runPassSupportsQmdLifecycle = deps.runPass === undefined || deps.runPassSupportsQmdLifecycle === true;
|
|
1393
1405
|
const runPassSupportsCooperativeCheckpoint = deps.runPass === undefined || deps.runPassSupportsCooperativeCheckpoint === true;
|
|
1394
1406
|
const pollIdx = argv.indexOf("--poll-remote-ms");
|
|
1395
1407
|
// An explicit --poll-remote-ms pins a fixed interval (menubar/CLI still set
|
|
@@ -1597,13 +1609,20 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
1597
1609
|
}
|
|
1598
1610
|
};
|
|
1599
1611
|
const invokePass = () => {
|
|
1600
|
-
if (!runPassSupportsCooperativeCheckpoint)
|
|
1601
|
-
|
|
1612
|
+
if (!runPassSupportsCooperativeCheckpoint) {
|
|
1613
|
+
if (!runPassSupportsQmdLifecycle)
|
|
1614
|
+
return runPass(passArgvForRun);
|
|
1615
|
+
return runPass(passArgvForRun, undefined, undefined, undefined, undefined, qmdShutdownController.signal, writeMaintenanceProgress, idleHeartbeatIntervalMs);
|
|
1616
|
+
}
|
|
1602
1617
|
// This callback is emitted by the production runner after journal
|
|
1603
1618
|
// repair/seed and before fanout. It starts ingress early, but never
|
|
1604
1619
|
// admits a second durable writer: queued realtime still waits for the
|
|
1605
1620
|
// existing scheduler's cooperative hand-off checkpoint.
|
|
1606
|
-
|
|
1621
|
+
const onJournalsReady = () => activateEventPushSurfaces();
|
|
1622
|
+
if (!runPassSupportsQmdLifecycle) {
|
|
1623
|
+
return runPass(passArgvForRun, checkpoint, onJournalsReady, recordDurableAppliedUpserts, workClass);
|
|
1624
|
+
}
|
|
1625
|
+
return runPass(passArgvForRun, checkpoint, onJournalsReady, recordDurableAppliedUpserts, workClass, qmdShutdownController.signal, writeMaintenanceProgress, idleHeartbeatIntervalMs);
|
|
1607
1626
|
};
|
|
1608
1627
|
// Observe the heap at pass boundaries — a gated checkpoint immediately before
|
|
1609
1628
|
// admitting a pass and immediately after it returns. A pass that runs a long
|
|
@@ -1796,18 +1815,14 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
1796
1815
|
resolveInterruptWait = null;
|
|
1797
1816
|
resolve?.();
|
|
1798
1817
|
};
|
|
1818
|
+
let reportWatcherLiveness = () => undefined;
|
|
1799
1819
|
const waitForNextPass = async (delayMs) => {
|
|
1800
1820
|
if (interruptGeneration !== observedInterruptGeneration) {
|
|
1801
1821
|
observedInterruptGeneration = interruptGeneration;
|
|
1802
1822
|
return;
|
|
1803
1823
|
}
|
|
1804
1824
|
const heartbeatTimer = setInterval(() => {
|
|
1805
|
-
|
|
1806
|
-
type: "maintenance-progress",
|
|
1807
|
-
company: "watch",
|
|
1808
|
-
bytesProcessed: 0,
|
|
1809
|
-
totalBytes: 0,
|
|
1810
|
-
}) + "\n");
|
|
1825
|
+
writeMaintenanceProgress();
|
|
1811
1826
|
reportWatcherLiveness();
|
|
1812
1827
|
}, idleHeartbeatIntervalMs);
|
|
1813
1828
|
heartbeatTimer.unref?.();
|
|
@@ -2108,7 +2123,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2108
2123
|
* liveness heartbeat as well so an operator can distinguish a live watcher
|
|
2109
2124
|
* from a long-running poll-only process without inspecting /proc.
|
|
2110
2125
|
*/
|
|
2111
|
-
|
|
2126
|
+
reportWatcherLiveness = () => {
|
|
2112
2127
|
if (!eventPush || stopped)
|
|
2113
2128
|
return;
|
|
2114
2129
|
reattemptWatcherDiscoveryIfDue();
|
|
@@ -3305,6 +3320,80 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
3305
3320
|
}
|
|
3306
3321
|
return worstExit;
|
|
3307
3322
|
};
|
|
3323
|
+
const receiverRecoveryRoutesPending = new Set();
|
|
3324
|
+
let receiverRecoveryReadWarningEmitted = false;
|
|
3325
|
+
const runReceiverLastDeliveryDrain = () => {
|
|
3326
|
+
let snapshot;
|
|
3327
|
+
try {
|
|
3328
|
+
snapshot = readReceiverLastDeliveryEntries(receiverLastDeliveryFilePath(getStateDir()));
|
|
3329
|
+
}
|
|
3330
|
+
catch {
|
|
3331
|
+
if (!receiverRecoveryReadWarningEmitted) {
|
|
3332
|
+
receiverRecoveryReadWarningEmitted = true;
|
|
3333
|
+
process.stderr.write("hq-sync-runner: receiver last-delivery recovery state unreadable; entries retained\n");
|
|
3334
|
+
}
|
|
3335
|
+
return;
|
|
3336
|
+
}
|
|
3337
|
+
if (snapshot.length === 0)
|
|
3338
|
+
return;
|
|
3339
|
+
const routes = new Map();
|
|
3340
|
+
const skipCompanies = resolveSkipCompanies();
|
|
3341
|
+
for (const entry of snapshot) {
|
|
3342
|
+
const route = routeChangeToTarget(entry.relativePath);
|
|
3343
|
+
if (route === null ||
|
|
3344
|
+
routeKey(route) !== entry.route ||
|
|
3345
|
+
!isWatchRouteSelected(route, watchRouteSelection) ||
|
|
3346
|
+
(route.kind === "company" && skipCompanies.has(route.slug.toLowerCase()))) {
|
|
3347
|
+
continue;
|
|
3348
|
+
}
|
|
3349
|
+
const key = routeKey(route);
|
|
3350
|
+
const group = routes.get(key) ?? { route, entries: [] };
|
|
3351
|
+
group.entries.push(entry);
|
|
3352
|
+
routes.set(key, group);
|
|
3353
|
+
}
|
|
3354
|
+
const clearCompletedEntries = (route, entries) => {
|
|
3355
|
+
const cleared = clearReceiverLastDeliveryEntries(receiverLastDeliveryFilePath(getStateDir()), entries);
|
|
3356
|
+
if (!cleared.ok) {
|
|
3357
|
+
process.stderr.write(`hq-sync-runner: receiver recovery state for ${routeKey(route)} could not be cleared; entries retained\n`);
|
|
3358
|
+
}
|
|
3359
|
+
};
|
|
3360
|
+
if (parallelCoordinatorEnabled) {
|
|
3361
|
+
for (const [key, { route, entries }] of routes) {
|
|
3362
|
+
if (receiverRecoveryRoutesPending.has(key))
|
|
3363
|
+
continue;
|
|
3364
|
+
receiverRecoveryRoutesPending.add(key);
|
|
3365
|
+
enqueueChore("backlog", () => runGuarded(buildRoutePullArgv(route, passArgv)), (execution) => {
|
|
3366
|
+
receiverRecoveryRoutesPending.delete(key);
|
|
3367
|
+
const exit = execution.accepted ? passExitCode(execution.result) : 1;
|
|
3368
|
+
if (exit === 0) {
|
|
3369
|
+
clearCompletedEntries(route, entries);
|
|
3370
|
+
return;
|
|
3371
|
+
}
|
|
3372
|
+
process.stderr.write(`hq-sync-runner: receiver recovery route ${key} failed (exit=${exit}); entry retained\n`);
|
|
3373
|
+
interruptWait();
|
|
3374
|
+
});
|
|
3375
|
+
}
|
|
3376
|
+
return;
|
|
3377
|
+
}
|
|
3378
|
+
if (routes.size === 0)
|
|
3379
|
+
return;
|
|
3380
|
+
return (async () => {
|
|
3381
|
+
for (const [key, { route, entries }] of routes) {
|
|
3382
|
+
try {
|
|
3383
|
+
const result = await runGuarded(buildRoutePullArgv(route, passArgv));
|
|
3384
|
+
const exit = passExitCode(result);
|
|
3385
|
+
if (exit === 0) {
|
|
3386
|
+
clearCompletedEntries(route, entries);
|
|
3387
|
+
continue;
|
|
3388
|
+
}
|
|
3389
|
+
process.stderr.write(`hq-sync-runner: receiver recovery route ${key} failed (exit=${exit}); entry retained\n`);
|
|
3390
|
+
}
|
|
3391
|
+
catch (error) {
|
|
3392
|
+
process.stderr.write(`hq-sync-runner: receiver recovery route ${key} failed (${describeError(error)}); entry retained\n`);
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
})();
|
|
3396
|
+
};
|
|
3308
3397
|
let receiver = null;
|
|
3309
3398
|
let receiverHasQueuedWork = false;
|
|
3310
3399
|
const warnUnresolvedReceiverCompany = (route, pathCount) => {
|
|
@@ -3594,13 +3683,13 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
3594
3683
|
const exitCode = passExitCode(execution.result);
|
|
3595
3684
|
if (shouldAcknowledgeParallelUnresolvedCompany(execution.accepted, exitCode)) {
|
|
3596
3685
|
if (!unresolvedReceiverMessagesWereRedelivered(events, receiveCountsByPath)) {
|
|
3597
|
-
throw targetedReceiverDispatchError(execution.result, execution.accepted, runtime.authRequiredPassExit);
|
|
3686
|
+
throw targetedReceiverDispatchError(execution.result, execution.accepted, runtime.authRequiredPassExit, route);
|
|
3598
3687
|
}
|
|
3599
3688
|
warnUnresolvedReceiverCompany(route, pathCount);
|
|
3600
3689
|
continue;
|
|
3601
3690
|
}
|
|
3602
3691
|
if (!execution.accepted || exitCode !== 0) {
|
|
3603
|
-
throw targetedReceiverDispatchError(execution.result, execution.accepted, runtime.authRequiredPassExit);
|
|
3692
|
+
throw targetedReceiverDispatchError(execution.result, execution.accepted, runtime.authRequiredPassExit, route);
|
|
3604
3693
|
}
|
|
3605
3694
|
}
|
|
3606
3695
|
};
|
|
@@ -3657,13 +3746,13 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
3657
3746
|
const exitCode = passExitCode(result);
|
|
3658
3747
|
if (exitCode === UNRESOLVED_COMPANY_EXIT) {
|
|
3659
3748
|
if (!unresolvedReceiverMessagesWereRedelivered(routeEvents, receiveCountsByPath)) {
|
|
3660
|
-
throw targetedReceiverDispatchError(result, true, runtime.authRequiredPassExit);
|
|
3749
|
+
throw targetedReceiverDispatchError(result, true, runtime.authRequiredPassExit, route);
|
|
3661
3750
|
}
|
|
3662
3751
|
warnUnresolvedReceiverCompany(route, routeEvents.length);
|
|
3663
3752
|
continue;
|
|
3664
3753
|
}
|
|
3665
3754
|
if (exitCode !== 0) {
|
|
3666
|
-
throw targetedReceiverDispatchError(result, true, runtime.authRequiredPassExit);
|
|
3755
|
+
throw targetedReceiverDispatchError(result, true, runtime.authRequiredPassExit, route);
|
|
3667
3756
|
}
|
|
3668
3757
|
}
|
|
3669
3758
|
};
|
|
@@ -3781,6 +3870,12 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
3781
3870
|
telemetryClaims: claims,
|
|
3782
3871
|
publishedContentHashStateDir: getStateDir(),
|
|
3783
3872
|
publishedContentHashLookup,
|
|
3873
|
+
recordLastDeliveryFailure: (entry) => {
|
|
3874
|
+
const stored = appendReceiverLastDeliveryEntry(receiverLastDeliveryFilePath(getStateDir()), entry);
|
|
3875
|
+
if (stored.ok)
|
|
3876
|
+
interruptWait();
|
|
3877
|
+
return stored.ok;
|
|
3878
|
+
},
|
|
3784
3879
|
onReceiveActivity,
|
|
3785
3880
|
});
|
|
3786
3881
|
if (!handles)
|
|
@@ -3812,6 +3907,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
3812
3907
|
if (stopped)
|
|
3813
3908
|
return shutdownPromise ?? Promise.resolve();
|
|
3814
3909
|
stopped = true;
|
|
3910
|
+
qmdShutdownController.abort();
|
|
3815
3911
|
eventSyncShutdownDeadlineMs =
|
|
3816
3912
|
Date.now() + EVENT_SYNC_STARTUP_SHUTDOWN_WAIT_MS;
|
|
3817
3913
|
resolveStoppedQueue();
|
|
@@ -4004,6 +4100,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
4004
4100
|
if (recycleRequested !== null)
|
|
4005
4101
|
return;
|
|
4006
4102
|
recycleRequested = record;
|
|
4103
|
+
qmdShutdownController.abort();
|
|
4007
4104
|
// Additive, non-error NDJSON protocol event for the desktop supervisor.
|
|
4008
4105
|
stdout.write(`${JSON.stringify({ type: "heap-recycle", ...record })}\n`);
|
|
4009
4106
|
// Compact numeric line, worded to match none of hq-desktop-app's fatal
|
|
@@ -4316,6 +4413,9 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
4316
4413
|
// every bridge below.
|
|
4317
4414
|
releaseWatcherJournalStores();
|
|
4318
4415
|
const exitCode = passExitCode(result);
|
|
4416
|
+
const receiverRecoveryDrain = runReceiverLastDeliveryDrain();
|
|
4417
|
+
if (receiverRecoveryDrain)
|
|
4418
|
+
await receiverRecoveryDrain;
|
|
4319
4419
|
if (exitCode === runtime.authRequiredPassExit) {
|
|
4320
4420
|
// The pass already emitted auth-error. Hand the sentinel to the
|
|
4321
4421
|
// outer watch wrapper so it can park in-process (auth-wait) instead
|