@agent-vm/agent-vm 0.0.91 → 0.0.93

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.
Files changed (133) hide show
  1. package/dist/build/gondolin-image-builder.d.ts +1 -0
  2. package/dist/build/gondolin-image-builder.d.ts.map +1 -1
  3. package/dist/build/gondolin-image-builder.js +11 -1
  4. package/dist/build/gondolin-image-builder.js.map +1 -1
  5. package/dist/build/managed-image-dockerfile.d.ts +2 -1
  6. package/dist/build/managed-image-dockerfile.d.ts.map +1 -1
  7. package/dist/build/managed-image-dockerfile.js +51 -27
  8. package/dist/build/managed-image-dockerfile.js.map +1 -1
  9. package/dist/cli/commands/controller-definition.d.ts +42 -42
  10. package/dist/cli/commands/create-app.d.ts +60 -60
  11. package/dist/cli/manual-templates.d.ts.map +1 -1
  12. package/dist/cli/manual-templates.js +14 -1
  13. package/dist/cli/manual-templates.js.map +1 -1
  14. package/dist/config/system-config.d.ts +15 -0
  15. package/dist/config/system-config.d.ts.map +1 -1
  16. package/dist/config/system-config.js +74 -0
  17. package/dist/config/system-config.js.map +1 -1
  18. package/dist/controller/controller-runtime-operations.d.ts +1 -0
  19. package/dist/controller/controller-runtime-operations.d.ts.map +1 -1
  20. package/dist/controller/controller-runtime-operations.js +2 -0
  21. package/dist/controller/controller-runtime-operations.js.map +1 -1
  22. package/dist/controller/controller-runtime-types.d.ts +5 -0
  23. package/dist/controller/controller-runtime-types.d.ts.map +1 -1
  24. package/dist/controller/controller-runtime.d.ts +1 -0
  25. package/dist/controller/controller-runtime.d.ts.map +1 -1
  26. package/dist/controller/controller-runtime.js +220 -3
  27. package/dist/controller/controller-runtime.js.map +1 -1
  28. package/dist/controller/health/channel-provider-recovery-observation.d.ts +23 -0
  29. package/dist/controller/health/channel-provider-recovery-observation.d.ts.map +1 -0
  30. package/dist/controller/health/channel-provider-recovery-observation.js +69 -0
  31. package/dist/controller/health/channel-provider-recovery-observation.js.map +1 -0
  32. package/dist/controller/health/durable-health-event-log.d.ts +24 -0
  33. package/dist/controller/health/durable-health-event-log.d.ts.map +1 -0
  34. package/dist/controller/health/durable-health-event-log.js +89 -0
  35. package/dist/controller/health/durable-health-event-log.js.map +1 -0
  36. package/dist/controller/health/gateway-recovery-actions.d.ts +27 -0
  37. package/dist/controller/health/gateway-recovery-actions.d.ts.map +1 -0
  38. package/dist/controller/health/gateway-recovery-actions.js +71 -0
  39. package/dist/controller/health/gateway-recovery-actions.js.map +1 -0
  40. package/dist/controller/health/gateway-service-health-monitor.d.ts +71 -3
  41. package/dist/controller/health/gateway-service-health-monitor.d.ts.map +1 -1
  42. package/dist/controller/health/gateway-service-health-monitor.js +383 -10
  43. package/dist/controller/health/gateway-service-health-monitor.js.map +1 -1
  44. package/dist/controller/health/gateway-vm-recovery-policy.d.ts +68 -0
  45. package/dist/controller/health/gateway-vm-recovery-policy.d.ts.map +1 -0
  46. package/dist/controller/health/gateway-vm-recovery-policy.js +199 -0
  47. package/dist/controller/health/gateway-vm-recovery-policy.js.map +1 -0
  48. package/dist/controller/health/gateway-vm-recovery-runner.d.ts +39 -0
  49. package/dist/controller/health/gateway-vm-recovery-runner.d.ts.map +1 -0
  50. package/dist/controller/health/gateway-vm-recovery-runner.js +251 -0
  51. package/dist/controller/health/gateway-vm-recovery-runner.js.map +1 -0
  52. package/dist/controller/health/health-event-store.d.ts +4 -0
  53. package/dist/controller/health/health-event-store.d.ts.map +1 -1
  54. package/dist/controller/health/health-event-store.js +19 -0
  55. package/dist/controller/health/health-event-store.js.map +1 -1
  56. package/dist/controller/http/controller-health-event-routes.d.ts +6 -0
  57. package/dist/controller/http/controller-health-event-routes.d.ts.map +1 -1
  58. package/dist/controller/http/controller-health-event-routes.js +49 -0
  59. package/dist/controller/http/controller-health-event-routes.js.map +1 -1
  60. package/dist/controller/http/controller-http-routes.d.ts.map +1 -1
  61. package/dist/controller/http/controller-http-routes.js +6 -0
  62. package/dist/controller/http/controller-http-routes.js.map +1 -1
  63. package/dist/controller/leases/lease-manager.d.ts.map +1 -1
  64. package/dist/controller/leases/lease-manager.js +37 -16
  65. package/dist/controller/leases/lease-manager.js.map +1 -1
  66. package/dist/controller/leases/tool-vm-lease-lifecycle.d.ts +44 -0
  67. package/dist/controller/leases/tool-vm-lease-lifecycle.d.ts.map +1 -0
  68. package/dist/controller/leases/tool-vm-lease-lifecycle.js +28 -0
  69. package/dist/controller/leases/tool-vm-lease-lifecycle.js.map +1 -0
  70. package/dist/controller/zone-runtimes/gateway-lifecycle-operation-record.d.ts +37 -0
  71. package/dist/controller/zone-runtimes/gateway-lifecycle-operation-record.d.ts.map +1 -0
  72. package/dist/controller/zone-runtimes/gateway-lifecycle-operation-record.js +133 -0
  73. package/dist/controller/zone-runtimes/gateway-lifecycle-operation-record.js.map +1 -0
  74. package/dist/controller/zone-runtimes/gateway-zone-state-machine.d.ts +101 -0
  75. package/dist/controller/zone-runtimes/gateway-zone-state-machine.d.ts.map +1 -0
  76. package/dist/controller/zone-runtimes/gateway-zone-state-machine.js +143 -0
  77. package/dist/controller/zone-runtimes/gateway-zone-state-machine.js.map +1 -0
  78. package/dist/controller/zone-runtimes/openclaw-zone-runtime.d.ts +16 -1
  79. package/dist/controller/zone-runtimes/openclaw-zone-runtime.d.ts.map +1 -1
  80. package/dist/controller/zone-runtimes/openclaw-zone-runtime.js +700 -40
  81. package/dist/controller/zone-runtimes/openclaw-zone-runtime.js.map +1 -1
  82. package/dist/controller/zone-runtimes/zone-runtime-errors.d.ts +7 -1
  83. package/dist/controller/zone-runtimes/zone-runtime-errors.d.ts.map +1 -1
  84. package/dist/controller/zone-runtimes/zone-runtime-errors.js +5 -1
  85. package/dist/controller/zone-runtimes/zone-runtime-errors.js.map +1 -1
  86. package/dist/controller/zone-runtimes/zone-runtime-registry.d.ts +2 -0
  87. package/dist/controller/zone-runtimes/zone-runtime-registry.d.ts.map +1 -1
  88. package/dist/controller/zone-runtimes/zone-runtime-registry.js +23 -0
  89. package/dist/controller/zone-runtimes/zone-runtime-registry.js.map +1 -1
  90. package/dist/controller/zone-runtimes/zone-runtime-types.d.ts +14 -1
  91. package/dist/controller/zone-runtimes/zone-runtime-types.d.ts.map +1 -1
  92. package/dist/gateway/gateway-ownership-evidence.d.ts +35 -0
  93. package/dist/gateway/gateway-ownership-evidence.d.ts.map +1 -0
  94. package/dist/gateway/gateway-ownership-evidence.js +10 -0
  95. package/dist/gateway/gateway-ownership-evidence.js.map +1 -0
  96. package/dist/gateway/gateway-recovery.d.ts +16 -0
  97. package/dist/gateway/gateway-recovery.d.ts.map +1 -1
  98. package/dist/gateway/gateway-recovery.js +105 -9
  99. package/dist/gateway/gateway-recovery.js.map +1 -1
  100. package/dist/gateway/gateway-zone-orchestrator.d.ts.map +1 -1
  101. package/dist/gateway/gateway-zone-orchestrator.js +50 -39
  102. package/dist/gateway/gateway-zone-orchestrator.js.map +1 -1
  103. package/dist/integration-tests/{smoke-harness.d.ts → e2e-harness.d.ts} +45 -37
  104. package/dist/integration-tests/e2e-harness.d.ts.map +1 -0
  105. package/dist/integration-tests/{smoke-harness.js → e2e-harness.js} +134 -108
  106. package/dist/integration-tests/e2e-harness.js.map +1 -0
  107. package/dist/integration-tests/e2e-workspace-build-global-setup.d.ts +16 -0
  108. package/dist/integration-tests/e2e-workspace-build-global-setup.d.ts.map +1 -0
  109. package/dist/integration-tests/e2e-workspace-build-global-setup.js +27 -0
  110. package/dist/integration-tests/e2e-workspace-build-global-setup.js.map +1 -0
  111. package/dist/integration-tests/live-agent-model-roundtrip-deployment.d.ts +11 -0
  112. package/dist/integration-tests/live-agent-model-roundtrip-deployment.d.ts.map +1 -0
  113. package/dist/integration-tests/live-agent-model-roundtrip-deployment.js +48 -0
  114. package/dist/integration-tests/live-agent-model-roundtrip-deployment.js.map +1 -0
  115. package/dist/integration-tests/live-agent-model-roundtrip-gates.d.ts +11 -0
  116. package/dist/integration-tests/live-agent-model-roundtrip-gates.d.ts.map +1 -0
  117. package/dist/integration-tests/live-agent-model-roundtrip-gates.js +21 -0
  118. package/dist/integration-tests/live-agent-model-roundtrip-gates.js.map +1 -0
  119. package/dist/integration-tests/live-vm-e2e-gates.d.ts +2 -0
  120. package/dist/integration-tests/live-vm-e2e-gates.d.ts.map +1 -0
  121. package/dist/integration-tests/live-vm-e2e-gates.js +4 -0
  122. package/dist/integration-tests/live-vm-e2e-gates.js.map +1 -0
  123. package/dist/operations/controller-status.d.ts +5 -0
  124. package/dist/operations/controller-status.d.ts.map +1 -1
  125. package/dist/operations/controller-status.js +42 -0
  126. package/dist/operations/controller-status.js.map +1 -1
  127. package/package.json +11 -11
  128. package/dist/integration-tests/live-integration-gates.d.ts +0 -2
  129. package/dist/integration-tests/live-integration-gates.d.ts.map +0 -1
  130. package/dist/integration-tests/live-integration-gates.js +0 -4
  131. package/dist/integration-tests/live-integration-gates.js.map +0 -1
  132. package/dist/integration-tests/smoke-harness.d.ts.map +0 -1
  133. package/dist/integration-tests/smoke-harness.js.map +0 -1
@@ -1,3 +1,5 @@
1
+ import { deriveChannelProviderRecoveryObservation, } from './channel-provider-recovery-observation.js';
2
+ import { createGatewayVmRecoveryTracker, defaultGatewayVmChannelProviderRecoveryPolicy, } from './gateway-vm-recovery-policy.js';
1
3
  function writeGatewayServiceHealthMonitorLog(message) {
2
4
  process.stderr.write(`[gateway-service-health-monitor] ${message}\n`);
3
5
  }
@@ -5,11 +7,346 @@ const unknownGatewayServiceHealthTarget = {
5
7
  path: '(unknown)',
6
8
  port: 0,
7
9
  };
10
+ function channelProviderEventKey(event) {
11
+ return `${event.zoneId}\0${event.channelProviderId}\0${String(event.observedAtMs)}`;
12
+ }
13
+ function recoveryActionForBudgetClass(recoveryBudgetClass) {
14
+ return recoveryBudgetClass === 'gateway-vm-cold-start'
15
+ ? 'gateway-vm-cold-start'
16
+ : 'gateway-vm-restart';
17
+ }
18
+ function budgetResultForRecoveryResult(result) {
19
+ return result.action === 'observe-only' || result.action === 'operator-required'
20
+ ? undefined
21
+ : result.result;
22
+ }
23
+ function isGatewayRecoveryTimeoutErrorCodeValue(value) {
24
+ return value === 'recovery-callback-unconfigured' || value === 'recovery-timeout';
25
+ }
8
26
  export function createGatewayServiceHealthMonitor(options) {
9
27
  const setIntervalImpl = options.setIntervalImpl ?? setInterval;
10
28
  const clearIntervalImpl = options.clearIntervalImpl ?? clearInterval;
29
+ const recoveryPolicy = options.gatewayServiceAutoRestart;
30
+ const channelProviderPolicy = recoveryPolicy.channelProviderHealth ?? defaultGatewayVmChannelProviderRecoveryPolicy;
31
+ const recoveryTracker = createGatewayVmRecoveryTracker({ policy: recoveryPolicy });
11
32
  let timer;
12
33
  let runningTick;
34
+ const recoveredChannelProviderEventKeys = new Set();
35
+ let stopped = false;
36
+ const classifyRecoveryBudgetClass = (request) => {
37
+ try {
38
+ return options.classifyRecoveryBudgetClass?.(request) ?? 'gateway-vm-restart';
39
+ }
40
+ catch (error) {
41
+ writeGatewayServiceHealthMonitorLog(`recovery budget classification failed for zone '${request.zoneId}': ${error instanceof Error ? error.message : String(error)}`);
42
+ return 'gateway-vm-restart';
43
+ }
44
+ };
45
+ const classifyGatewayControlLinkObservation = (props) => {
46
+ const controlLinkEvent = options.healthEventStore
47
+ .listLatestEventsForZone(props.zoneId)
48
+ .find((event) => {
49
+ return event.kind === 'gateway-control-link';
50
+ });
51
+ if (!controlLinkEvent) {
52
+ return 'unobserved';
53
+ }
54
+ if (props.nowMs - controlLinkEvent.observedAtMs > options.staleAfterMs) {
55
+ return 'stale';
56
+ }
57
+ return controlLinkEvent.result;
58
+ };
59
+ const latestChannelProviderHealthEvents = (zoneId) => options.healthEventStore
60
+ .listLatestEventsForZone(zoneId)
61
+ .filter((event) => event.kind === 'agent-channel-provider-health');
62
+ const runRecovery = async (request, intendedAction) => {
63
+ if (!options.recoverGatewayVm) {
64
+ return intendedAction === 'gateway-vm-restart'
65
+ ? {
66
+ action: 'gateway-vm-restart',
67
+ elapsedMs: 0,
68
+ errorCode: 'recovery-callback-unconfigured',
69
+ result: 'failed',
70
+ }
71
+ : {
72
+ action: 'gateway-vm-cold-start',
73
+ elapsedMs: 0,
74
+ errorCode: 'recovery-callback-unconfigured',
75
+ result: 'failed',
76
+ };
77
+ }
78
+ return await options.recoverGatewayVm(request);
79
+ };
80
+ const recordGatewayRecoveryEvent = (props) => {
81
+ const recoveryAction = props.result.action ?? 'gateway-vm-restart';
82
+ if (props.result.result === 'ok') {
83
+ const event = props.result.action !== 'gateway-vm-cold-start'
84
+ ? {
85
+ action: 'gateway-vm-restart',
86
+ consecutiveFailures: props.consecutiveFailures,
87
+ cooldownMs: recoveryPolicy.cooldownMs,
88
+ elapsedMs: props.result.elapsedMs,
89
+ kind: 'gateway-recovery',
90
+ leaseReleaseFailureCount: props.result.leaseReleaseFailureCount,
91
+ newBootedAt: props.result.newBootedAt,
92
+ newHostPid: props.result.newHostPid,
93
+ newVmId: props.result.newVmId,
94
+ observedAtMs: props.observedAtMs,
95
+ oldBootedAt: props.result.oldBootedAt,
96
+ oldHostPid: props.result.oldHostPid,
97
+ oldVmId: props.result.oldVmId,
98
+ ...(props.result.operationId === undefined
99
+ ? {}
100
+ : { operationId: props.result.operationId }),
101
+ reason: props.reason,
102
+ result: 'ok',
103
+ zoneId: props.zoneId,
104
+ }
105
+ : {
106
+ action: 'gateway-vm-cold-start',
107
+ consecutiveFailures: props.consecutiveFailures,
108
+ cooldownMs: recoveryPolicy.cooldownMs,
109
+ elapsedMs: props.result.elapsedMs,
110
+ kind: 'gateway-recovery',
111
+ leaseReleaseFailureCount: props.result.leaseReleaseFailureCount,
112
+ newBootedAt: props.result.newBootedAt,
113
+ newHostPid: props.result.newHostPid,
114
+ newVmId: props.result.newVmId,
115
+ observedAtMs: props.observedAtMs,
116
+ ...(props.result.operationId === undefined
117
+ ? {}
118
+ : { operationId: props.result.operationId }),
119
+ reason: props.reason,
120
+ result: 'ok',
121
+ zoneId: props.zoneId,
122
+ };
123
+ options.healthEventStore.record(event);
124
+ return;
125
+ }
126
+ const event = {
127
+ consecutiveFailures: props.consecutiveFailures,
128
+ cooldownMs: recoveryPolicy.cooldownMs,
129
+ elapsedMs: props.result.elapsedMs,
130
+ errorCode: props.result.errorCode,
131
+ kind: 'gateway-recovery',
132
+ ...(props.result.leaseReleaseFailureCount === undefined
133
+ ? {}
134
+ : { leaseReleaseFailureCount: props.result.leaseReleaseFailureCount }),
135
+ observedAtMs: props.observedAtMs,
136
+ ...(props.result.operationId === undefined ? {} : { operationId: props.result.operationId }),
137
+ reason: props.reason,
138
+ result: 'failed',
139
+ zoneId: props.zoneId,
140
+ };
141
+ if (recoveryAction === 'gateway-vm-restart') {
142
+ if (props.result.oldVmId === undefined) {
143
+ if (!isGatewayRecoveryTimeoutErrorCodeValue(props.result.errorCode)) {
144
+ const malformedRestartEvent = {
145
+ ...event,
146
+ action: 'operator-required',
147
+ errorCode: props.result.errorCode,
148
+ };
149
+ options.healthEventStore.record(malformedRestartEvent);
150
+ return;
151
+ }
152
+ const timeoutEvent = {
153
+ ...event,
154
+ action: 'gateway-vm-restart',
155
+ errorCode: props.result.errorCode,
156
+ oldBootedAt: props.result.oldBootedAt,
157
+ oldHostPid: props.result.oldHostPid,
158
+ oldVmId: props.result.oldVmId,
159
+ };
160
+ options.healthEventStore.record(timeoutEvent);
161
+ return;
162
+ }
163
+ const restartEvent = {
164
+ ...event,
165
+ action: 'gateway-vm-restart',
166
+ oldBootedAt: props.result.oldBootedAt,
167
+ oldHostPid: props.result.oldHostPid,
168
+ oldVmId: props.result.oldVmId,
169
+ };
170
+ options.healthEventStore.record(restartEvent);
171
+ return;
172
+ }
173
+ const nonRestartEvent = {
174
+ ...event,
175
+ action: recoveryAction,
176
+ };
177
+ options.healthEventStore.record(nonRestartEvent);
178
+ };
179
+ const recordGatewayRecoverySuspendedEvent = (props) => {
180
+ const event = {
181
+ action: props.action,
182
+ consecutiveFailedRecoveries: props.consecutiveFailedRecoveries,
183
+ consecutiveFailures: props.consecutiveFailures,
184
+ cooldownMs: recoveryPolicy.cooldownMs,
185
+ errorCode: 'max-failed-recoveries',
186
+ failedRecoveryResetMs: recoveryPolicy.failedRecoveryResetMs,
187
+ kind: 'gateway-recovery-suspended',
188
+ observedAtMs: props.observedAtMs,
189
+ reason: props.reason,
190
+ result: 'failed',
191
+ zoneId: props.zoneId,
192
+ };
193
+ options.healthEventStore.record(event);
194
+ };
195
+ const maybeRecoverGatewayVm = async (props) => {
196
+ const recoveryBudgetClass = classifyRecoveryBudgetClass({
197
+ consecutiveFailures: 0,
198
+ reason: props.reason,
199
+ zoneId: props.zoneId,
200
+ });
201
+ const decision = props.reason === 'gateway-service-unhealthy'
202
+ ? recoveryTracker.recordGatewayServiceProbe({
203
+ observedAtMs: props.observedAtMs,
204
+ recoveryBudgetClass,
205
+ result: props.serviceProbeResult,
206
+ zoneId: props.zoneId,
207
+ })
208
+ : recoveryTracker.recordGatewayControlLinkObservation({
209
+ observedAtMs: props.observedAtMs,
210
+ recoveryBudgetClass,
211
+ result: props.serviceProbeResult === 'ok'
212
+ ? classifyGatewayControlLinkObservation({
213
+ nowMs: props.observedAtMs,
214
+ zoneId: props.zoneId,
215
+ })
216
+ : 'unobserved',
217
+ zoneId: props.zoneId,
218
+ });
219
+ if (decision.kind === 'suspended') {
220
+ recordGatewayRecoverySuspendedEvent({
221
+ consecutiveFailedRecoveries: decision.consecutiveFailedRecoveries,
222
+ consecutiveFailures: decision.consecutiveFailures,
223
+ observedAtMs: props.observedAtMs,
224
+ reason: props.reason,
225
+ action: recoveryActionForBudgetClass(recoveryBudgetClass),
226
+ zoneId: decision.zoneId,
227
+ });
228
+ return;
229
+ }
230
+ if (decision.kind !== 'restart') {
231
+ return;
232
+ }
233
+ if (stopped) {
234
+ writeGatewayServiceHealthMonitorLog(`recovery requested for zone '${decision.zoneId}' but monitor is stopped`);
235
+ return;
236
+ }
237
+ recoveryTracker.markRecoveryStarted({
238
+ observedAtMs: props.observedAtMs,
239
+ recoveryBudgetClass,
240
+ zoneId: decision.zoneId,
241
+ });
242
+ const recoveryResult = await runRecovery({
243
+ consecutiveFailures: decision.consecutiveFailures,
244
+ reason: decision.reason,
245
+ zoneId: decision.zoneId,
246
+ }, recoveryActionForBudgetClass(recoveryBudgetClass));
247
+ const observedAtMs = options.now();
248
+ recoveryTracker.markRecoveryFinished({
249
+ observedAtMs,
250
+ recoveryBudgetClass,
251
+ result: budgetResultForRecoveryResult(recoveryResult),
252
+ zoneId: decision.zoneId,
253
+ });
254
+ recordGatewayRecoveryEvent({
255
+ consecutiveFailures: decision.consecutiveFailures,
256
+ observedAtMs,
257
+ reason: decision.reason,
258
+ result: recoveryResult,
259
+ zoneId: decision.zoneId,
260
+ });
261
+ };
262
+ const maybeRecoverAgentChannelProvider = async (props) => {
263
+ const latestEvents = latestChannelProviderHealthEvents(props.zoneId);
264
+ if (latestEvents.length === 0) {
265
+ return;
266
+ }
267
+ let selectedDecision;
268
+ for (const latestEvent of latestEvents) {
269
+ const eventKey = channelProviderEventKey(latestEvent);
270
+ if (recoveredChannelProviderEventKeys.has(eventKey)) {
271
+ continue;
272
+ }
273
+ const recoveryObservation = deriveChannelProviderRecoveryObservation({
274
+ allowRestartWhenUnrecoverable: channelProviderPolicy.restartGatewayOnUnrecoverable,
275
+ event: latestEvent,
276
+ nowMs: props.observedAtMs,
277
+ restartGatewayOnRecoverable: channelProviderPolicy.restartGatewayOnRecoverable,
278
+ staleAfterMs: options.staleAfterMs,
279
+ transitioningTimeoutMs: channelProviderPolicy.transitioningTimeoutMs,
280
+ });
281
+ if (recoveryObservation.kind === 'observe-only') {
282
+ continue;
283
+ }
284
+ const recoveryBudgetClass = classifyRecoveryBudgetClass({
285
+ consecutiveFailures: 0,
286
+ reason: recoveryObservation.reason ?? 'agent-channel-provider-unhealthy',
287
+ zoneId: props.zoneId,
288
+ });
289
+ const decision = recoveryTracker.recordAgentChannelProviderObservation({
290
+ ...recoveryObservation.observation,
291
+ recoveryBudgetClass,
292
+ });
293
+ if (decision.kind === 'restart' || decision.kind === 'suspended') {
294
+ selectedDecision = {
295
+ decision,
296
+ eventKey,
297
+ reason: recoveryObservation.reason ?? 'agent-channel-provider-unhealthy',
298
+ recoveryBudgetClass,
299
+ };
300
+ break;
301
+ }
302
+ }
303
+ if (!selectedDecision) {
304
+ return;
305
+ }
306
+ const { decision, reason } = selectedDecision;
307
+ if (decision.kind === 'suspended') {
308
+ recordGatewayRecoverySuspendedEvent({
309
+ consecutiveFailedRecoveries: decision.consecutiveFailedRecoveries,
310
+ consecutiveFailures: decision.consecutiveFailures,
311
+ observedAtMs: props.observedAtMs,
312
+ reason,
313
+ action: recoveryActionForBudgetClass(selectedDecision.recoveryBudgetClass),
314
+ zoneId: decision.zoneId,
315
+ });
316
+ return;
317
+ }
318
+ if (stopped) {
319
+ writeGatewayServiceHealthMonitorLog(`recovery requested for zone '${decision.zoneId}' but monitor is stopped`);
320
+ return;
321
+ }
322
+ recoveryTracker.markRecoveryStarted({
323
+ observedAtMs: props.observedAtMs,
324
+ recoveryBudgetClass: selectedDecision.recoveryBudgetClass,
325
+ zoneId: decision.zoneId,
326
+ });
327
+ const recoveryResult = await runRecovery({
328
+ consecutiveFailures: decision.consecutiveFailures,
329
+ reason: decision.reason,
330
+ zoneId: decision.zoneId,
331
+ }, recoveryActionForBudgetClass(selectedDecision.recoveryBudgetClass));
332
+ const observedAtMs = options.now();
333
+ recoveryTracker.markRecoveryFinished({
334
+ observedAtMs,
335
+ recoveryBudgetClass: selectedDecision.recoveryBudgetClass,
336
+ result: budgetResultForRecoveryResult(recoveryResult),
337
+ zoneId: decision.zoneId,
338
+ });
339
+ recordGatewayRecoveryEvent({
340
+ consecutiveFailures: decision.consecutiveFailures,
341
+ observedAtMs,
342
+ reason: decision.reason,
343
+ result: recoveryResult,
344
+ zoneId: decision.zoneId,
345
+ });
346
+ if (recoveryResult.result === 'ok') {
347
+ recoveredChannelProviderEventKeys.add(selectedDecision.eventKey);
348
+ }
349
+ };
13
350
  const tick = async () => {
14
351
  if (runningTick) {
15
352
  return await runningTick;
@@ -18,26 +355,53 @@ export function createGatewayServiceHealthMonitor(options) {
18
355
  await Promise.all(options.zoneIds.map(async (zoneId) => {
19
356
  try {
20
357
  const result = await options.probeZoneHealth(zoneId);
358
+ const observedAtMs = options.now();
359
+ const serviceProbeResult = result.ok ? 'ok' : 'failed';
21
360
  options.healthEventStore.record({
22
361
  kind: 'gateway-service-health',
23
- observedAtMs: options.now(),
362
+ observedAtMs,
24
363
  path: result.path,
25
364
  port: result.port,
26
- result: result.ok ? 'ok' : 'failed',
365
+ result: serviceProbeResult,
27
366
  ...(result.statusCode === undefined ? {} : { statusCode: result.statusCode }),
28
367
  zoneId: result.zoneId,
29
368
  });
369
+ await maybeRecoverGatewayVm({
370
+ observedAtMs,
371
+ reason: 'gateway-service-unhealthy',
372
+ serviceProbeResult,
373
+ zoneId: result.zoneId,
374
+ });
375
+ if (serviceProbeResult === 'ok') {
376
+ await maybeRecoverGatewayVm({
377
+ observedAtMs,
378
+ reason: 'gateway-control-link-unhealthy',
379
+ serviceProbeResult,
380
+ zoneId: result.zoneId,
381
+ });
382
+ await maybeRecoverAgentChannelProvider({
383
+ observedAtMs,
384
+ zoneId: result.zoneId,
385
+ });
386
+ }
30
387
  }
31
388
  catch (error) {
32
389
  writeGatewayServiceHealthMonitorLog(`probe failed for zone '${zoneId}': ${error instanceof Error ? error.message : String(error)}`);
390
+ const observedAtMs = options.now();
33
391
  options.healthEventStore.record({
34
392
  kind: 'gateway-service-health',
35
- observedAtMs: options.now(),
393
+ observedAtMs,
36
394
  path: unknownGatewayServiceHealthTarget.path,
37
395
  port: unknownGatewayServiceHealthTarget.port,
38
396
  result: 'failed',
39
397
  zoneId,
40
398
  });
399
+ await maybeRecoverGatewayVm({
400
+ observedAtMs,
401
+ reason: 'gateway-service-unhealthy',
402
+ serviceProbeResult: 'failed',
403
+ zoneId,
404
+ });
41
405
  }
42
406
  }));
43
407
  })().finally(() => {
@@ -50,17 +414,26 @@ export function createGatewayServiceHealthMonitor(options) {
50
414
  if (timer) {
51
415
  return;
52
416
  }
53
- timer = setIntervalImpl(() => {
54
- void tick();
417
+ stopped = false;
418
+ timer = setIntervalImpl(async () => {
419
+ try {
420
+ await tick();
421
+ }
422
+ catch (error) {
423
+ writeGatewayServiceHealthMonitorLog(`scheduled tick failed: ${error instanceof Error ? error.message : String(error)}`);
424
+ }
55
425
  }, options.intervalMs);
56
426
  timer.unref?.();
57
427
  },
58
- stop: () => {
59
- if (!timer) {
60
- return;
428
+ stop: async () => {
429
+ stopped = true;
430
+ if (timer) {
431
+ clearIntervalImpl(timer);
432
+ timer = undefined;
433
+ }
434
+ if (runningTick) {
435
+ await runningTick;
61
436
  }
62
- clearIntervalImpl(timer);
63
- timer = undefined;
64
437
  },
65
438
  tick,
66
439
  };
@@ -1 +1 @@
1
- {"version":3,"file":"gateway-service-health-monitor.js","sourceRoot":"","sources":["../../../src/controller/health/gateway-service-health-monitor.ts"],"names":[],"mappings":"AA6BA,SAAS,mCAAmC,CAAC,OAAe;IAC3D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oCAAoC,OAAO,IAAI,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,iCAAiC,GAAG;IACzC,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,CAAC;CACE,CAAC;AAEX,MAAM,UAAU,iCAAiC,CAChD,OAAiD;IAEjD,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,WAAW,CAAC;IAC/D,MAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,IAAI,aAAa,CAAC;IACrE,IAAI,KAAiC,CAAC;IACtC,IAAI,WAAsC,CAAC;IAE3C,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;QACtC,IAAI,WAAW,EAAE,CAAC;YACjB,OAAO,MAAM,WAAW,CAAC;QAC1B,CAAC;QACD,WAAW,GAAG,CAAC,KAAK,IAAI,EAAE;YACzB,MAAM,OAAO,CAAC,GAAG,CAChB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE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AC;IAEF,OAAO;QACN,KAAK,EAAE,GAAG,EAAE;YACX,IAAI,KAAK,EAAE,CAAC;gBACX,OAAO;YACR,CAAC;YACD,KAAK,GAAG,eAAe,CAAC,GAAG,EAAE;gBAC5B,KAAK,IAAI,EAAE,CAAC;YACb,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;YACvB,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;QACjB,CAAC;QACD,IAAI,EAAE,GAAG,EAAE;YACV,IAAI,CAAC,KAAK,EAAE,CAAC;gBACZ,OAAO;YACR,CAAC;YACD,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,KAAK,GAAG,SAAS,CAAC;QACnB,CAAC;QACD,IAAI;KACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"gateway-service-health-monitor.js","sourceRoot":"","sources":["../../../src/controller/health/gateway-service-health-monitor.ts"],"names":[],"mappings":"AAMA,OAAO,EACN,wCAAwC,GAExC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACN,8BAA8B,EAC9B,6CAA6C,GAM7C,MAAM,iCAAiC,CAAC;AA2GzC,SAAS,mCAAmC,CAAC,OAAe;IAC3D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oCAAoC,OAAO,IAAI,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,iCAAiC,GAAG;IACzC,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,CAAC;CACE,CAAC;AAEX,SAAS,uBAAuB,CAAC,KAAsC;IACtE,OAAO,GAAG,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,iBAAiB,KAAK,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;AACrF,CAAC;AAED,SAAS,4BAA4B,CACpC,mBAAiD;IAEjD,OAAO,mBAAmB,KAAK,uBAAuB;QACrD,CAAC,CAAC,uBAAuB;QACzB,CAAC,CAAC,oBAAoB,CAAC;AACzB,CAAC;AAED,SAAS,6BAA6B,CACrC,MAA+B;I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D,IAAI,WAAW,EAAE,CAAC;gBACjB,MAAM,WAAW,CAAC;YACnB,CAAC;QACF,CAAC;QACD,IAAI;KACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,68 @@
1
+ import type { GatewayRecoveryHealthReason } from '@agent-vm/gateway-interface';
2
+ export type GatewayVmRecoveryObservationResult = 'failed' | 'ok' | 'stale' | 'timeout' | 'unobserved';
3
+ export type GatewayVmRecoveryReason = GatewayRecoveryHealthReason;
4
+ export type GatewayVmRecoveryBudgetClass = 'gateway-vm-cold-start' | 'gateway-vm-restart';
5
+ export interface GatewayVmAutoRecoveryPolicy {
6
+ readonly channelProviderHealth?: GatewayVmChannelProviderRecoveryPolicy | undefined;
7
+ readonly consecutiveFailureThreshold: number;
8
+ readonly cooldownMs: number;
9
+ readonly enabled: boolean;
10
+ readonly failedRecoveryResetMs: number;
11
+ readonly maxConsecutiveFailedRecoveries: number;
12
+ readonly restartTimeoutMs: number;
13
+ }
14
+ export interface GatewayVmChannelProviderRecoveryPolicy {
15
+ readonly consecutiveFailureThreshold: number;
16
+ readonly enabled: boolean;
17
+ readonly restartGatewayOnRecoverable: boolean;
18
+ readonly restartGatewayOnUnrecoverable: boolean;
19
+ readonly transitioningTimeoutMs: number;
20
+ }
21
+ export declare const defaultGatewayVmChannelProviderRecoveryPolicy: {
22
+ consecutiveFailureThreshold: number;
23
+ enabled: true;
24
+ restartGatewayOnRecoverable: true;
25
+ restartGatewayOnUnrecoverable: false;
26
+ transitioningTimeoutMs: number;
27
+ };
28
+ export interface CreateGatewayVmRecoveryTrackerOptions {
29
+ readonly policy: GatewayVmAutoRecoveryPolicy;
30
+ }
31
+ export interface GatewayVmRecoveryObservation {
32
+ readonly channelProviderId?: string | undefined;
33
+ readonly observedAtMs: number;
34
+ readonly recoveryBudgetClass?: GatewayVmRecoveryBudgetClass | undefined;
35
+ readonly result: GatewayVmRecoveryObservationResult;
36
+ readonly zoneId: string;
37
+ }
38
+ export interface GatewayVmRecoveryLifecycleEvent {
39
+ readonly observedAtMs: number;
40
+ readonly recoveryBudgetClass?: GatewayVmRecoveryBudgetClass | undefined;
41
+ readonly result?: 'failed' | 'ok' | undefined;
42
+ readonly zoneId: string;
43
+ }
44
+ export type GatewayVmRecoveryDecision = {
45
+ readonly consecutiveFailures: number;
46
+ readonly kind: 'none';
47
+ readonly reason?: 'cooldown' | 'disabled' | 'in-flight' | 'unobserved' | undefined;
48
+ } | {
49
+ readonly consecutiveFailures: number;
50
+ readonly kind: 'restart';
51
+ readonly reason: GatewayVmRecoveryReason;
52
+ readonly zoneId: string;
53
+ } | {
54
+ readonly consecutiveFailedRecoveries: number;
55
+ readonly consecutiveFailures: number;
56
+ readonly kind: 'suspended';
57
+ readonly reason: 'max-failed-recoveries';
58
+ readonly zoneId: string;
59
+ };
60
+ export interface GatewayVmRecoveryTracker {
61
+ readonly markRecoveryFinished: (event: GatewayVmRecoveryLifecycleEvent) => void;
62
+ readonly markRecoveryStarted: (event: GatewayVmRecoveryLifecycleEvent) => void;
63
+ readonly recordAgentChannelProviderObservation: (observation: GatewayVmRecoveryObservation) => GatewayVmRecoveryDecision;
64
+ readonly recordGatewayControlLinkObservation: (observation: GatewayVmRecoveryObservation) => GatewayVmRecoveryDecision;
65
+ readonly recordGatewayServiceProbe: (observation: GatewayVmRecoveryObservation) => GatewayVmRecoveryDecision;
66
+ }
67
+ export declare function createGatewayVmRecoveryTracker(options: CreateGatewayVmRecoveryTrackerOptions): GatewayVmRecoveryTracker;
68
+ //# sourceMappingURL=gateway-vm-recovery-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gateway-vm-recovery-policy.d.ts","sourceRoot":"","sources":["../../../src/controller/health/gateway-vm-recovery-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAE/E,MAAM,MAAM,kCAAkC,GAC3C,QAAQ,GACR,IAAI,GACJ,OAAO,GACP,SAAS,GACT,YAAY,CAAC;AAE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