Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions apps/host/src/agent/scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -633,14 +633,30 @@ export function createHostScheduler(ports: HostSchedulerPorts) {
// profile; writes re-check the hold after the bounded readiness wait, right before
// the operation can touch SQLite. Owner and readiness guards are identical to the
// remote path, which keeps its own assertPublicScheduleSource rule.
const localOperationsFor = (enforceHold: boolean) => createScheduleOperations({
withScheduler: createWithScheduler(enforceHold),
isRemoteInvoke: () => false,
captureRequestGuard: captureScheduledOwnerGuard,
hookPathDeps: hookScript,
broadcast: ports.publish,
warn: message => ports.logger.warn?.(message),
});
const localOperationsFor = (enforceHold: boolean) => {
const local = createScheduleOperations({
withScheduler: createWithScheduler(enforceHold),
isRemoteInvoke: () => false,
captureRequestGuard: captureScheduledOwnerGuard,
hookPathDeps: hookScript,
broadcast: ports.publish,
warn: message => ports.logger.warn?.(message),
});
return {
...local,
// The window's automation form has no desktop-notification control and
// always sends its Desktop default. Save the routes this Host delivers,
// as project rows do, instead of refusing the whole automation.
'maker:schedule:create': async (input: unknown) => {
const schedule = input as Partial<CreateScheduleInput> & Pick<Schedule, 'source'> | null;
if (!schedule || typeof schedule !== 'object' || schedule.source === 'project' || !schedule.notify?.desktop)
return local['maker:schedule:create'](input);
return local['maker:schedule:create']({
...schedule, notify: { ...schedule.notify, desktop: supportsScheduleDesktopNotification },
});
},
};
};
const localOperations = localOperationsFor(false);
const localWriteOperations = localOperationsFor(true);
const operations = {
Expand Down
15 changes: 15 additions & 0 deletions apps/host/src/ipc-bindings/batch5a-scheduler.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,21 @@ test('maker-schedule: create accepts a new local task whose own modelAgentDevice
h.assertNoResultMismatch();
});

test('maker-schedule: production local create saves the Desktop form default this Host can run', { timeout: TEST_TIMEOUT_MS }, async t => {
const production = await createProductionSchedulerHarness(t);
// The exact JSON buildScheduleInput sends for a new automation from
// useScheduleForm's defaults. The form has no desktop-notification control.
const created = await production.runtime.localWriteOperations['maker:schedule:create']({
name: 'Desktop form default', prompt: 'Test only', executionMode: 'agent', kind: 'cron',
cronExpr: '0 9 * * *', timezone: 'Asia/Shanghai', expireAt: null, recurring: true, manual: false,
agentKind: 'claude-code', workspaceKind: 'dialogue', useWorktree: false, persistentSession: false,
silentWhenIdle: false, preRunPlugin: null, webhookTrigger: null,
notify: { desktop: true, feishu: false, wecomGroup: false },
});
assert.equal(created.notify.desktop, false);
assert.equal(production.countSchedules(), 1);
});

test('maker-schedule: update restores opted-in clears and keeps prTrigger three-state', { timeout: TEST_TIMEOUT_MS }, async t => {
const h = await createBatch5aHarness(t);
const created = await h.invoke('maker:schedule:create', CREATE_INPUT);
Expand Down
Loading