feat(ql3): gate remote cancellation delivery

This commit is contained in:
whyour committed 2026-08-19 06:55:36 +08:00
1 parent 1809fbb8d3
commit 0b5f3bcb39
14 files changed
+776 -25

No files matched your search

@@ -21,6 +21,7 @@ import {
} from '../worker-ingress/workerIngressConfig';
import type { ClusterWorkerArtifactBinding } from '../artifact/workerArtifactBinding';
import type { RemoteWorkerSecretValueProvider } from '@qinglong/runtime-core/remote-secret-delivery';
import type { ClusterRemoteWorkerCancellationDispatchObservation } from '../remote-execution/remoteWorkerCancellationDispatchControl';
export type ClusterControlProcessSignal = 'SIGINT' | 'SIGTERM';
@@ -34,10 +35,12 @@ export interface ClusterControlProcessEvent {
readonly stopResult?: ClusterControlStopResult;
readonly address?: Readonly<{ host: string; port: number }>;
readonly activation?: ClusterControlActivationAudit;
readonly cancellationDispatch?: ClusterRemoteWorkerCancellationDispatchObservation;
readonly diagnostic?: Readonly<{
scope:
| 'scheduler'
| 'cancellation-convergence'
| 'cancellation-dispatch'
| 'log-retention'
| 'database'
| 'worker-ingress';
@@ -333,6 +336,32 @@ export async function runProductionClusterControlProcess(
),
).catch(() => undefined);
},
onCancellationDispatch(observation) {
void Promise.resolve(
options.emit(
event(replicaId, {
level:
observation.status === 'blocked' ? 'error' : 'info',
event: 'cancellation_dispatch',
cancellationDispatch: observation,
}),
),
).catch(() => undefined);
},
onCancellationDispatchDiagnostic(error: unknown) {
void Promise.resolve(
options.emit(
event(replicaId, {
level: 'error',
event: 'runtime_diagnostic',
diagnostic: diagnosticFact(
'cancellation-dispatch',
error,
),
}),
),
).catch(() => undefined);
},
},
}),
audit(record) {