fix(schedule): narrow persistence error operation

This commit is contained in:
pku-xht
2026-08-07 22:43:21 +08:00
committed by Tianyi Cui
parent e21f331078
commit cbda2b9d43
3 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ const PERSISTENCE_ERROR_SCHEMA = {
properties: {
code: { type: 'string', required: true, const: 'persistence_uncertain' },
message: { type: 'string', required: true },
operation: { type: 'string', required: true, enum: ['create', 'list', 'delete', 'dispatch'] },
operation: { type: 'string', required: true, enum: ['create', 'list', 'delete'] },
id: { type: 'string' },
},
} as const
+2 -2
View File
@@ -76,8 +76,8 @@ export interface ScheduleReminderPresentation {
readonly deliveryMode: ScheduleDeliveryMode
}
/** Operations whose persistence barrier may be uncertain. */
export type SchedulePersistenceOperation = 'create' | 'list' | 'delete' | 'dispatch'
/** Management operations whose persistence barrier may be uncertain. */
export type SchedulePersistenceOperation = 'create' | 'list' | 'delete'
/** Stable error returned for an empty reminder prompt. */
export interface InvalidPromptError {
@@ -103,6 +103,12 @@ describe('Schedule tool protocol', () => {
const test = await harness()
expect(['schedule_create', 'schedule_list', 'schedule_delete'].map(name => test.ctx.tools.get(name)?.name))
.toEqual(['schedule_create', 'schedule_list', 'schedule_delete'])
const outputSchema = test.ctx.tools.get('schedule_create')?.output.schema as {
oneOf?: Array<{ properties?: { code?: { const?: string }; operation?: { enum?: string[] } } }>
}
const persistenceError = outputSchema.oneOf?.find(schema =>
schema.properties?.code?.const === 'persistence_uncertain')
expect(persistenceError?.properties?.operation?.enum).toEqual(['create', 'list', 'delete'])
for (const name of ['schedule_create', 'schedule_list', 'schedule_delete']) {
expect(test.ctx.tools.executionMode({ signal, callId: CallId(name), name, arguments: {}, agent: test.agent }))
.toEqual({ kind: 'exclusive' })