@atolis-hq/wake 0.4.94 → 0.4.95

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.
@@ -10,6 +10,15 @@ const healthSchema = z.object({
10
10
  kind: z.string().optional(),
11
11
  detail: z.string().optional(),
12
12
  })),
13
+ adapters: z
14
+ .array(z.object({
15
+ adapter: z.string(),
16
+ scope: z.string(),
17
+ channel: z.string(),
18
+ status: z.string(),
19
+ detail: z.string().optional(),
20
+ }))
21
+ .optional(),
13
22
  }),
14
23
  });
15
24
  function unavailable(reason) {
@@ -59,10 +68,17 @@ export async function doctorProcessorHealth(wakeRoot, config) {
59
68
  const checks = parsed.data.data.checks.filter(({ kind }) => kind === ApiHealthCheckKind.Processor);
60
69
  if (checks.length === 0)
61
70
  return unavailable('the API reported no processors');
71
+ // Only degraded adapters are reported; 'unknown' means never exercised.
72
+ const adapterFailures = (parsed.data.data.adapters ?? [])
73
+ .filter(({ status }) => status === 'degraded')
74
+ .map(({ adapter, scope, channel, detail }) => `Adapter ${adapter} ${scope} (${channel}): ${detail ?? 'degraded'}`);
62
75
  return {
63
- failures: checks
64
- .filter(({ status }) => status !== healthyStatus)
65
- .map(({ name, detail }) => `Processor ${name}: ${detail ?? 'degraded'}`),
76
+ failures: [
77
+ ...checks
78
+ .filter(({ status }) => status !== healthyStatus)
79
+ .map(({ name, detail }) => `Processor ${name}: ${detail ?? 'degraded'}`),
80
+ ...adapterFailures,
81
+ ],
66
82
  notices: checks
67
83
  .filter(({ status }) => status === healthyStatus)
68
84
  .map(({ name, detail }) => `Processor ${name}: ${detail ?? 'ok'}`),
@@ -10,6 +10,7 @@ import { type createResourceLookup, type createResourceService } from '../resour
10
10
  import { type createWorkService } from '../work/index.js';
11
11
  import type { ResolvedWakeModulesConfig } from './config/load-config.js';
12
12
  import type { EventProcessorRuntime } from './event-processor-runtime.js';
13
+ import { type PollCoordinator } from './poll-coordinator.js';
13
14
  import { type RuntimeProjectionSubscriptions } from './projection-runtime.js';
14
15
  export interface IntegrationRuntime {
15
16
  readonly triggers: TriggerService;
@@ -53,5 +54,5 @@ export interface IntegrationRuntimeInput {
53
54
  }
54
55
  export declare function composeIntegrationRuntime(input: IntegrationRuntimeInput): Promise<IntegrationRuntime>;
55
56
  /** Coalesces provider webhook requests while retaining the source's durable poll semantics. */
56
- export declare function createImmediatePollRequester(providers: readonly ProviderInstance[], journal: EventJournal, wakeRoot: string): (adapter: string) => void;
57
+ export declare function createImmediatePollRequester(providers: readonly ProviderInstance[], journal: EventJournal, wakeRoot: string, coordinator?: PollCoordinator): (adapter: string) => void;
57
58
  export declare function composeProviders(input: Pick<IntegrationRuntimeInput, 'wakeRoot' | 'config' | 'work' | 'conversations' | 'resources' | 'lookup' | 'pullRequests' | 'journal' | 'orchestration' | 'ids' | 'clock' | 'checkpoints' | 'execution' | 'providerDefinitions'>): Promise<import("../integrations/index.js").ProviderCompositionResult>;
@@ -1,17 +1,17 @@
1
1
  import { EventActorKind, correlationId, } from '@atolis-hq/eventing';
2
- import { withFileLock } from '@atolis-hq/eventing-filesystem';
3
2
  import { join } from 'node:path';
4
3
  import { z } from 'zod';
5
4
  import { ActivityExecutionKind, activityName, } from '../activities/index.js';
6
5
  import { ControlEventType, ControlStreamKind, TriggerService, createDurableRunnerIneligibility, createIntakePipeline, createRunnerPipeline, createTriggerReactor, createWorkCancellationPolicy, hasOpenWorkCapacity, readOpenWorkItemIds, selectControlEvent, triggerInvocationProjection, triggerInvocationStream, } from '../control-plane/index.js';
7
6
  import { ConversationOriginKind, workItemIdForConversation } from '../conversations/index.js';
8
7
  import { ExecutionStreamKind, NoEligibleRunnerError, RunRepository, createRuntimeMemoryProfile, decodeActivationExecutionEvent, isActiveRunStatus, isRunStream, runId, } from '../execution/index.js';
9
- import { AgentRunPublicationReactor, ArtifactRegistrationReactor, DeliveryOutcomeReactor, DeliveryService, IntegrationStreamKind, PollService, ProviderRegistry, deliveryProjectionDefinitions, fakeProviderDefinition, publishConversationCommandFeedback, reconcileMergedDeliveries, } from '../integrations/index.js';
8
+ import { AgentRunPublicationReactor, ArtifactRegistrationReactor, DeliveryOutcomeReactor, DeliveryService, IntegrationStreamKind, ProviderRegistry, deliveryProjectionDefinitions, fakeProviderDefinition, publishConversationCommandFeedback, reconcileMergedDeliveries, } from '../integrations/index.js';
10
9
  import { compileWorkflowSelectors, createConversationCommandReactor, createPullRequestTransitionEvidence, createResourceTransitionReactor, createWatchReactor, createWatchReconciler, isWorkflowInstanceStream, selectWorkflow, workflowInstanceId, workflowName, } from '../orchestration/index.js';
11
10
  import { BuiltInResourceCapability, resourceId, } from '../resources/index.js';
12
11
  import { isWorkItemStream } from '../work/index.js';
13
12
  import { decodeCanonicalEvent } from './canonical-events.js';
14
13
  import { hydrateFakeProviderEvidence } from './fake-provider-files.js';
14
+ import { createPollCoordinator } from './poll-coordinator.js';
15
15
  import { createRuntimeProjectionSubscriptions, } from './projection-runtime.js';
16
16
  import { createCapabilityResourceTransitionEvidence } from './resource-transition-evidence.js';
17
17
  export async function composeIntegrationRuntime(input) {
@@ -220,13 +220,17 @@ export async function composeIntegrationRuntime(input) {
220
220
  // Inbound translation reads durable provider facts through its own services,
221
221
  // so it has no projection freshness dependency that could hold shutdown or
222
222
  // unrelated resident work behind a blocked projection consumer.
223
+ const pollCoordinator = createPollCoordinator({
224
+ journal: input.journal,
225
+ wakeRoot: input.wakeRoot,
226
+ });
223
227
  const intakePipeline = createIntakePipeline({
224
228
  isPaused: input.isPaused,
225
229
  poll: async (signal) => {
226
230
  return observeMemory(memoryProfile, 'intake.poll', async () => {
227
231
  let appended = 0;
228
232
  for (const provider of providers)
229
- appended += await withFileLock(join(input.wakeRoot, '.wake', 'locks', `poll-${provider.adapter}.lock`), async () => (await new PollService(input.journal, provider).pollOnce(signal)).appended);
233
+ appended += (await pollCoordinator.poll(provider, signal)).appended;
230
234
  return appended;
231
235
  });
232
236
  },
@@ -274,7 +278,7 @@ export async function composeIntegrationRuntime(input) {
274
278
  await delivery.deliverNext(signal);
275
279
  }),
276
280
  });
277
- const requestImmediatePoll = createImmediatePollRequester(providers, input.journal, input.wakeRoot);
281
+ const requestImmediatePoll = createImmediatePollRequester(providers, input.journal, input.wakeRoot, pollCoordinator);
278
282
  return {
279
283
  triggers,
280
284
  projectionSubscriptions,
@@ -298,22 +302,15 @@ export async function composeIntegrationRuntime(input) {
298
302
  };
299
303
  }
300
304
  /** Coalesces provider webhook requests while retaining the source's durable poll semantics. */
301
- export function createImmediatePollRequester(providers, journal, wakeRoot) {
302
- const immediatePolls = new Map();
305
+ export function createImmediatePollRequester(providers, journal, wakeRoot, coordinator = createPollCoordinator({ journal, wakeRoot })) {
303
306
  return (adapter) => {
304
- if (immediatePolls.has(adapter))
305
- return;
306
307
  const provider = providers.find((candidate) => candidate.adapter === adapter);
307
308
  if (provider === undefined)
308
309
  return;
309
- const run = withFileLock(join(wakeRoot, '.wake', 'locks', `poll-${provider.adapter}.lock`), async () => {
310
- await new PollService(journal, provider).pollOnce(new AbortController().signal, {
311
- bypassInterval: true,
312
- });
313
- })
314
- .catch((error) => console.error(`Webhook polling ${adapter} failed`, error))
315
- .finally(() => immediatePolls.delete(adapter));
316
- immediatePolls.set(adapter, run);
310
+ // Joins any in-flight poll, so a webhook burst never queues behind intake.
311
+ coordinator
312
+ .poll(provider, new AbortController().signal, { bypassInterval: true })
313
+ .catch((error) => console.error(`Webhook polling ${adapter} failed`, error));
317
314
  };
318
315
  }
319
316
  async function observeMemory(profile, phase, operation) {
@@ -0,0 +1,36 @@
1
+ import type { EventJournal } from '@atolis-hq/eventing';
2
+ import { type ProviderInstance } from '../integrations/index.js';
3
+ export declare const PollOutcome: {
4
+ readonly Polled: "polled";
5
+ readonly LockContended: "lock-contended";
6
+ };
7
+ export interface PollCoordinatorOptions {
8
+ readonly journal: EventJournal;
9
+ readonly wakeRoot: string;
10
+ /** Wall-clock bound for one poll run; the lock is released when it elapses. */
11
+ readonly deadlineMs?: number;
12
+ /** How long to wait for another process holding the poll lock before skipping the tick. */
13
+ readonly lockWaitMs?: number;
14
+ }
15
+ export interface PollRunOptions {
16
+ readonly bypassInterval?: boolean;
17
+ }
18
+ export interface PollRunResult {
19
+ readonly outcome: (typeof PollOutcome)[keyof typeof PollOutcome];
20
+ readonly appended: number;
21
+ }
22
+ export declare const DEFAULT_POLL_DEADLINE_MS: number;
23
+ export declare const DEFAULT_POLL_LOCK_WAIT_MS = 5000;
24
+ export type PollCoordinator = ReturnType<typeof createPollCoordinator>;
25
+ /**
26
+ * Single-flight per adapter inside the process (intake and webhook polls join
27
+ * one another); the file lock only guards against other processes. Every run
28
+ * is bounded so a hung request cannot pin the lock for the life of the process.
29
+ */
30
+ export declare function createPollCoordinator(options: PollCoordinatorOptions): {
31
+ /**
32
+ * Joins the existing run using its original signal; a joining caller cannot
33
+ * cancel it. Changes arriving after its reads wait for the next interval.
34
+ */
35
+ poll(provider: ProviderInstance, signal: AbortSignal, pollOptions?: PollRunOptions): Promise<PollRunResult>;
36
+ };
@@ -0,0 +1,93 @@
1
+ import { join } from 'node:path';
2
+ import { acquireFileLock } from '@atolis-hq/eventing-filesystem';
3
+ import { PollService } from '../integrations/index.js';
4
+ export const PollOutcome = {
5
+ Polled: 'polled',
6
+ LockContended: 'lock-contended',
7
+ };
8
+ export const DEFAULT_POLL_DEADLINE_MS = 5 * 60_000;
9
+ export const DEFAULT_POLL_LOCK_WAIT_MS = 5_000;
10
+ /**
11
+ * Single-flight per adapter inside the process (intake and webhook polls join
12
+ * one another); the file lock only guards against other processes. Every run
13
+ * is bounded so a hung request cannot pin the lock for the life of the process.
14
+ */
15
+ export function createPollCoordinator(options) {
16
+ const deadlineMs = options.deadlineMs ?? DEFAULT_POLL_DEADLINE_MS;
17
+ const lockWaitMs = options.lockWaitMs ?? DEFAULT_POLL_LOCK_WAIT_MS;
18
+ const inFlight = new Map();
19
+ const run = async (provider, signal, pollOptions) => {
20
+ const lockPath = join(options.wakeRoot, '.wake', 'locks', `poll-${provider.adapter}.lock`);
21
+ const lock = await acquireWithin(lockPath, lockWaitMs);
22
+ if (!lock.acquired) {
23
+ const error = new Error(`Poll lock is held by another process: ${lockPath}`);
24
+ provider.recordPollFailure?.(error);
25
+ console.warn(`Skipping ${provider.adapter} poll: ${error.message}`);
26
+ return { outcome: PollOutcome.LockContended, appended: 0 };
27
+ }
28
+ try {
29
+ const result = await runWithDeadline((boundedSignal) => new PollService(options.journal, provider).pollOnce(boundedSignal, pollOptions), signal, deadlineMs, provider.adapter);
30
+ return { outcome: PollOutcome.Polled, appended: result.appended };
31
+ }
32
+ catch (error) {
33
+ provider.recordPollFailure?.(error);
34
+ throw error;
35
+ }
36
+ finally {
37
+ await lock.release();
38
+ }
39
+ };
40
+ return {
41
+ /**
42
+ * Joins the existing run using its original signal; a joining caller cannot
43
+ * cancel it. Changes arriving after its reads wait for the next interval.
44
+ */
45
+ poll(provider, signal, pollOptions = {}) {
46
+ const existing = inFlight.get(provider.adapter);
47
+ if (existing !== undefined)
48
+ return existing;
49
+ const started = run(provider, signal, pollOptions).finally(() => {
50
+ inFlight.delete(provider.adapter);
51
+ });
52
+ inFlight.set(provider.adapter, started);
53
+ return started;
54
+ },
55
+ };
56
+ }
57
+ async function acquireWithin(path, waitMs) {
58
+ const deadline = Date.now() + waitMs;
59
+ for (;;) {
60
+ const lock = await acquireFileLock(path, {
61
+ staleAfterMs: 60_000,
62
+ staleRequiresDeadProcess: true,
63
+ });
64
+ if (lock.acquired || Date.now() >= deadline)
65
+ return lock;
66
+ await new Promise((resolve) => setTimeout(resolve, 50));
67
+ }
68
+ }
69
+ async function runWithDeadline(operation, outer, deadlineMs, adapter) {
70
+ const controller = new AbortController();
71
+ const abort = () => controller.abort(outer.reason);
72
+ if (outer.aborted)
73
+ abort();
74
+ else
75
+ outer.addEventListener('abort', abort, { once: true });
76
+ let timer;
77
+ const deadline = new Promise((_, reject) => {
78
+ timer = setTimeout(() => {
79
+ const error = new Error(`Polling ${adapter} exceeded its ${deadlineMs}ms deadline`);
80
+ // Abort first so cooperative work stops, but reject regardless: release
81
+ // of the lock must not depend on the hung operation honouring the signal.
82
+ controller.abort(error);
83
+ reject(error);
84
+ }, deadlineMs);
85
+ });
86
+ try {
87
+ return await Promise.race([operation(controller.signal), deadline]);
88
+ }
89
+ finally {
90
+ clearTimeout(timer);
91
+ outer.removeEventListener('abort', abort);
92
+ }
93
+ }
@@ -124,6 +124,6 @@ export function resolveWakeVersion(options = {}) {
124
124
  return `g${headHash.slice(0, 7)}`;
125
125
  return '0.1.0-dev';
126
126
  }
127
- export const wakeVersion = "v0.4.94";
127
+ export const wakeVersion = "v0.4.95";
128
128
  /** The registry-installable version used by packaged sandbox images. */
129
129
  export const wakePackageVersion = packageVersion(defaultRepoRoot) ?? wakeVersion;
@@ -3,6 +3,8 @@ export interface AdapterHealth {
3
3
  readonly detail?: string;
4
4
  readonly successCount: number;
5
5
  readonly failureCount: number;
6
+ /** Epoch milliseconds of the latest success; absent until one happens. */
7
+ readonly lastSuccessAt?: number;
6
8
  }
7
9
  export interface AdapterHealthTracker {
8
10
  recordSuccess(): void;
@@ -6,9 +6,11 @@ export function createAdapterHealthTracker(options = {}) {
6
6
  let failureCount = 0;
7
7
  let consecutiveFailures = 0;
8
8
  let degradedDetail;
9
+ let lastSuccessAt;
9
10
  return {
10
11
  recordSuccess() {
11
12
  successCount += 1;
13
+ lastSuccessAt = now();
12
14
  consecutiveFailures = 0;
13
15
  degradedDetail = undefined;
14
16
  },
@@ -32,6 +34,7 @@ export function createAdapterHealthTracker(options = {}) {
32
34
  ...(degradedDetail === undefined ? {} : { detail: degradedDetail }),
33
35
  successCount,
34
36
  failureCount,
37
+ ...(lastSuccessAt === undefined ? {} : { lastSuccessAt }),
35
38
  };
36
39
  },
37
40
  };
@@ -13,6 +13,9 @@ export class PollService {
13
13
  let appended = 0;
14
14
  let failed = 0;
15
15
  for (const draft of drafts) {
16
+ // A run past its deadline may be leaked; it must not persist or advance state.
17
+ if (signal.aborted)
18
+ return { appended, failed: failed + 1 };
16
19
  try {
17
20
  if (!this.instance.eventTypes.includes(draft.eventType))
18
21
  throw new Error(`Provider ${adapter} emitted an unknown event type`);
@@ -28,7 +31,7 @@ export class PollService {
28
31
  console.error(`Polling ${adapter} could not persist ${draft.eventId}`, error);
29
32
  }
30
33
  }
31
- if (failed === 0)
34
+ if (failed === 0 && !signal.aborted)
32
35
  await this.instance.source.markPollPersisted?.();
33
36
  return { appended, failed };
34
37
  }
@@ -55,6 +55,8 @@ export interface AdapterHealthCheck {
55
55
  readonly detail?: string;
56
56
  readonly successCount: number;
57
57
  readonly failureCount: number;
58
+ /** Epoch milliseconds of the latest success, for adapters that derive stall from it. */
59
+ readonly lastSuccessAt?: number;
58
60
  }
59
61
  export interface AdapterCommand {
60
62
  readonly syntax: string;
@@ -77,6 +79,8 @@ export interface ProviderInstance {
77
79
  }): Promise<VerifiedArtifact | ArtifactVerificationResult>;
78
80
  readonly checkConnectivity?: () => Promise<void>;
79
81
  readonly health?: () => readonly AdapterHealthCheck[];
82
+ /** Lets the poll runner report whole-poll failures (lock contention, timeouts) as health. */
83
+ readonly recordPollFailure?: (error: unknown) => void;
80
84
  readonly commands?: () => readonly AdapterCommand[];
81
85
  readonly replyPublication?: ReplyPublicationConfig | undefined;
82
86
  readonly webhook?: ProviderWebhook | undefined;
@@ -15,12 +15,16 @@ export function createGitHubSource(config, client, adapter, requests = createGit
15
15
  // This cache avoids returning unchanged issue observations within one process.
16
16
  const lastEventIds = new Map();
17
17
  const pendingWatermarks = new Map();
18
+ let pendingSignal;
18
19
  const now = state?.now ?? Date.now;
19
20
  // In-memory only: an extra real poll after a process restart is harmless,
20
21
  // the same tradeoff already made for lastEventIds above.
21
22
  let lastPolledAt;
22
23
  return {
23
24
  async poll(signal, options) {
25
+ // Uncommitted cursors belong only to the attempt that produced them.
26
+ pendingWatermarks.clear();
27
+ pendingSignal = undefined;
24
28
  const currentTime = now();
25
29
  if (options?.bypassInterval !== true &&
26
30
  lastPolledAt !== undefined &&
@@ -38,10 +42,13 @@ export function createGitHubSource(config, client, adapter, requests = createGit
38
42
  watermark: await loadWatermark(state?.checkpoints, adapter, owner, repo),
39
43
  health,
40
44
  })));
45
+ const drafts = await consecutivePullRequestObservations(perRepository.flatMap((result) => result.drafts), state?.journal, adapter);
46
+ // Journal reads can outlive the deadline too; never publish leaked cursors.
47
+ signal.throwIfAborted();
48
+ pendingSignal = signal;
41
49
  for (const result of perRepository)
42
50
  if (result.watermark !== undefined)
43
51
  pendingWatermarks.set(result.repository, result.watermark);
44
- const drafts = await consecutivePullRequestObservations(perRepository.flatMap((result) => result.drafts), state?.journal, adapter);
45
52
  return drafts.filter((draft) => {
46
53
  if (draft.eventType !== GitHubEventType.WorkObserved)
47
54
  return true;
@@ -53,13 +60,14 @@ export function createGitHubSource(config, client, adapter, requests = createGit
53
60
  });
54
61
  },
55
62
  async markPollPersisted() {
56
- if (state?.checkpoints === undefined)
63
+ if (state?.checkpoints === undefined || pendingSignal?.aborted === true)
57
64
  return;
58
65
  const checkpoints = state.checkpoints;
59
- for (const [repository, watermark] of pendingWatermarks) {
66
+ // Detach before awaiting saves: a deadline may let the next attempt start.
67
+ const committed = [...pendingWatermarks];
68
+ pendingWatermarks.clear();
69
+ for (const [repository, watermark] of committed)
60
70
  await checkpoints.save(watermarkCheckpoint(adapter, repository), watermark);
61
- pendingWatermarks.delete(repository);
62
- }
63
71
  },
64
72
  };
65
73
  }
@@ -1,3 +1,5 @@
1
1
  import { type ProviderDefinition } from '../contracts/provider.js';
2
2
  import { type GitHubConfig } from './contracts/config.js';
3
3
  export declare const gitHubProviderDefinition: ProviderDefinition<GitHubConfig>;
4
+ /** Multiple of the poll interval without a success before observation counts as stalled. */
5
+ export declare const POLL_STALL_INTERVALS = 3;
@@ -2,7 +2,7 @@ import { BuiltInActivityName, PullRequestState } from '../../activities/index.js
2
2
  import { ConversationSurfaceCapability } from '../../orchestration/index.js';
3
3
  import { BuiltInResourceCapability, BuiltInResourceKind, ResourceCorrelationRole, resourceId, resourceKind, } from '../../resources/index.js';
4
4
  import { ArtifactVerificationResult } from '../contracts/artifact-vocabulary.js';
5
- import { AdapterHealthStatus } from '../contracts/provider.js';
5
+ import { AdapterHealthStatus, } from '../contracts/provider.js';
6
6
  import { InboundTranslator } from './application/inbound-translator.js';
7
7
  import { translateGitHubOutbound } from './application/outbound-translator.js';
8
8
  import { createGitHubWakeLabelReconciler } from './application/wake-labels.js';
@@ -31,6 +31,7 @@ export const gitHubProviderDefinition = {
31
31
  maxConcurrent: config.polling.maxConcurrent,
32
32
  });
33
33
  const health = createGitHubAdapterHealthRegistry(config.repositories);
34
+ const healthStartedAt = Date.now();
34
35
  const inbound = new InboundTranslator(services.journal, services.work, services.resources, {
35
36
  pullRequests: services.pullRequests,
36
37
  ids: services.ids,
@@ -61,7 +62,17 @@ export const gitHubProviderDefinition = {
61
62
  setLabels: client.setIssueLabels,
62
63
  requests,
63
64
  }),
64
- health: () => health.snapshotAll().flatMap((check) => {
65
+ recordPollFailure: (error) => {
66
+ for (const { owner, repo } of config.repositories)
67
+ health.recordFailure(`${owner}/${repo}`, 'poll', error);
68
+ },
69
+ health: () => health.snapshotAll().flatMap(({ lastSuccessAt, ...check }) => {
70
+ // A process that never polled (standalone UI/API host) cannot judge a stall;
71
+ // the intake-owning process reports it.
72
+ if (check.channel === 'poll' && check.successCount + check.failureCount > 0)
73
+ return [
74
+ applyPollStall(check, lastSuccessAt ?? healthStartedAt, Date.now(), config.polling.intervalMs),
75
+ ];
65
76
  if (check.channel !== 'webhook')
66
77
  return [check];
67
78
  if (!config.webhooks.enabled)
@@ -197,6 +208,21 @@ export const gitHubProviderDefinition = {
197
208
  };
198
209
  },
199
210
  };
211
+ /** Multiple of the poll interval without a success before observation counts as stalled. */
212
+ export const POLL_STALL_INTERVALS = 3;
213
+ // Derived at read time so a wedged process cannot keep reporting a stale "ok".
214
+ function applyPollStall(check, lastProgressAt, nowMs, intervalMs) {
215
+ const silentMs = nowMs - lastProgressAt;
216
+ const thresholdMs = intervalMs * POLL_STALL_INTERVALS;
217
+ if (silentMs <= thresholdMs)
218
+ return check;
219
+ const stalled = `stalled: no successful poll for ${Math.round(silentMs / 1000)}s (threshold ${Math.round(thresholdMs / 1000)}s)`;
220
+ return {
221
+ ...check,
222
+ status: 'degraded',
223
+ detail: check.detail === undefined ? stalled : `${stalled}; ${check.detail}`,
224
+ };
225
+ }
200
226
  function parsePullRequestKey(key) {
201
227
  const match = /^(?<owner>[^/]+)\/(?<repo>[^#]+)#(?<number>[1-9]\d*)$/.exec(key);
202
228
  if (match?.groups === undefined)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atolis-hq/wake",
3
- "version": "0.4.94",
3
+ "version": "0.4.95",
4
4
  "description": "Local autonomous agent control plane for software development",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {