Overview: report liveness and a Source whose poll loop stopped

This commit is contained in:
2026-11-02 01:22:34 +08:00
parent a662188a57
commit b348d69beb
10 changed files with 153 additions and 13 deletions
+9 -2
View File
@@ -20,7 +20,7 @@ import { githubChannel } from '../../src/sources/github-trigger.ts'
import { feishuKind } from '../../src/sources/feishu.ts'
import { githubKind } from '../../src/sources/github.ts'
import type { Health } from '../../src/sources/host.ts'
import type { SourceKind } from '../../src/sources/kind.ts'
import type { Localized, SourceKind } from '../../src/sources/kind.ts'
import { testDeployment } from './deployment.ts'
export const MEMBER = 'ou_alice'
@@ -110,6 +110,8 @@ export interface PanelServer {
opened: string[]
dropped: DroppedReply[]
failing: Extract<Problem, { kind: 'outgoing' }>['outgoing'][]
/** Sources whose poll loop the fixture reports as stopped, with how long ago their last round was. */
stalled: { id: string; title: Localized; ageMs: number; intervalMs: number }[]
}
export let server: PanelServer
@@ -195,8 +197,13 @@ const overviewView = (): ApiResponse<'GET overview'> => {
...Object.entries(server.health).filter(([name, item]) => item.state === 'error' && !KINDS.some(kind => kind.health.includes(name))
&& !name.startsWith('sync:') && name !== 'evals')
.map(([name, item]) => ({ kind: 'runtime-error' as const, name, detail: item.detail })),
...server.stalled.map(item => ({ kind: 'stalled' as const, source: { id: item.id, title: item.title }, ageMs: item.ageMs,
intervalMs: item.intervalMs })),
...Object.values(server.settings.policy.sources).some(part => part.allowed.length) ? [] : [{ kind: 'no-allowed' as const }],
...server.failing.map(outgoing => ({ kind: 'outgoing' as const, outgoing }))],
// The fixture panel renders the readout, so a poll round a few seconds old stands for a running Source.
liveness: { startedAt: '2026-09-22T00:00:00Z', uptimeMs: 3_600_000, lastPollAt: new Date(Date.now() - 4_000).toISOString(),
pollAgeMs: 4_000, polling: true },
person: server.person, executor: { running: 2, queued: 0, maxWorkers: server.settings.executor.maxWorkers, idle: 1 },
flow: { received: 12, filtered: 2, triggers: 10, judged: 5, accepted: 1, evaluating: 0,
dropped: server.dropped.filter(item => item.dropped.at >= dayAgo()).length },
@@ -249,7 +256,7 @@ function initial(): PanelServer {
en: 'Feishu message' } }
const defaults = { revision: 0, previousRevision: null, savedAt: '', source: 'defaults' }
return {
health: {}, down: false, pending: 0, opened: [], requests: [], misuse: [], queued: new Set(), dropped: [], failing: [],
health: {}, down: false, pending: 0, opened: [], requests: [], misuse: [], queued: new Set(), dropped: [], failing: [], stalled: [],
setup: { machine: MACHINE, problem: null, feishuProblem: null,
accounts: { repository: 'acme/widgets', agent: 'agent-bot', feishu: { appId: 'cli_bot', brand: 'feishu', botId: 'ou_bot',
name: 'Widgets Bot' } } },