Files
goodbuddy/src/shared/supervision-review-contracts.ts
T
mesalogo 5116613615 fix: keep supervisor controls usable and prevent overlapping reviews
Allow only one active review across manual starts, automatic runs and resume. Add cancellation that holds admission through runtime cleanup, preserves saved batches and prevents cancelled runs from resuming.

Keep review controls usable during execution, show a dismissible progress notice and remove redundant filter labels. Include focused regressions and lifecycle documentation.

Release note: Supervision reviews can now be cancelled from Activity records. Starting another review shows the active review instead of duplicating work, while scope, time and refresh controls remain available.
2026-09-26 15:55:50 +08:00

43 lines
1.6 KiB
TypeScript

import { z } from 'zod'
import type { SupervisionEvidence, SupervisionSummaryOutput } from './supervision-contracts'
export const supervisionReviewSettingsSchema = z.object({
pageSize: z.number().int().min(1).max(200).default(50),
batchCharacters: z.number().int().min(1000).max(16000).default(8000),
batchMessages: z.number().int().min(1).max(50).default(20),
executionSeconds: z.number().int().min(30).max(3600).default(300),
responseKiB: z.number().int().min(100).max(16384).optional()
}).strict()
export type SupervisionReviewSettings = z.infer<typeof supervisionReviewSettingsSchema>
export const defaultSupervisionReviewSettings = supervisionReviewSettingsSchema.parse({})
export const supervisionReviewIdSchema = z.object({ runId: z.string().uuid() }).strict()
export type SupervisionReviewExecution = {
active: boolean
runId?: string
stopping?: 'paused' | 'cancelled'
}
export const supervisionBatchesRequestSchema = supervisionReviewIdSchema.extend({
offset: z.number().int().min(0).default(0),
limit: z.number().int().min(1).max(20).default(10)
})
export type SupervisionReviewProgress = {
runId: string
batches: number
characters: number
sources: number
remainingSources: number
complete: boolean
restartRequired?: boolean
inFlight?: number
phase?: 'collecting' | 'extracting' | 'summarizing' | 'saving'
navigationNodes?: number
settings?: SupervisionReviewSettings & { timeoutSeconds: number; concurrency: number }
}
export type SupervisionReviewBatch = {
id: string
projectId: string
conversationId: string
evidence: SupervisionEvidence[]
output: SupervisionSummaryOutput
}