Skip to content

Scheduler createTask rejects recurrence: null for one-off schedules #753

Description

@dcramer

When a model includes recurrence: null in a scheduler_slackScheduleCreateTask call with schedule_kind: "one_off", the TypeBox schema rejects it because null is not in the create tool's recurrence union — even though downstream logic (buildRecurrence) already treats null as absent, and the updateTask schema correctly accepts null to remove recurrence.

Root cause

createTask recurrence schema:

recurrence: Type.Optional(
  Type.Union([
    Type.Literal("daily"),
    Type.Literal("weekly"),
    Type.Literal("monthly"),
    Type.Literal("yearly"),
  ])
)

updateTask recurrence schema includes Type.Null() in the union. createTask does not.

validateCreateScheduleKind also rejects any recurrence !== undefined, meaning a model that passes recurrence: null will fail schema validation before reaching the custom error, and a model that passes a valid frequency string (e.g. "daily") with schedule_kind: "one_off" hits the semantic rejection.

buildRecurrence already short-circuits on null:

if (args.input.recurrence === null) {
  return undefined;
}

So the schema and the downstream are inconsistent.

Fix

  • Add Type.Null() to the recurrence union in createSlackScheduleCreateTaskTool.
  • Update validateCreateScheduleKind to treat null the same as absent: input.recurrence !== undefined && input.recurrence !== null.
  • Keep rejection for schedule_kind: "one_off" + valid frequency string (semantically contradictory).

Test cases

  • schedule_kind: "one_off" + omitted recurrence → succeeds (unchanged).
  • schedule_kind: "one_off" + recurrence: null → succeeds after fix.
  • schedule_kind: "one_off" + recurrence: "daily" → continues to fail.
  • schedule_kind: "recurring" + null/omitted recurrence → continues to fail.

--

View Junior Session in Sentry

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions