[Bug]: schedule_task silently drops freshSession when updating an existing task#32258

opened4d agobyRRokaSwK

What happens Updating an existing scheduled task with freshSession: true returns success, but the saved task still has freshSession: false. The field isn't applied, and no error or warning is given. The same field works when creating a task.

Repro

  1. Have an existing bound scheduled task with freshSession: false (in our case a fixed_time weekly task bound to a thread).
  2. Call schedule_task with only { scheduledTaskId, projectId, freshSession: true }.
  3. The response, and a later list_scheduled_tasks, both show freshSession: false. Prompt, schedule and enabled state stay unchanged.
  4. Adding bindToCurrentThread: true to the update doesn't help.
  5. By contrast, creating a new task with bindToCurrentThread: true, freshSession: true returns and persists freshSession: true.

Reproduced on three separate tasks (two fixed_time daily, one weekly). Prompt updates on the same tasks apply fine.

Expected An update with freshSession changes the stored value, as the tool description says ("only given fields change"). If changing it on an existing task isn't supported, the call should be rejected with an error rather than reported as a success.

Impact The only way to switch an existing routine to fresh sessions is to delete it and recreate it, which changes its id and loses its run history.

Synced from GitHub

Reproduced on 0.1.8-nightly.20261108.4380. schedule_task with scheduledTaskId + freshSession: true returns success, but scheduled_tasks.thread_mode stays new_thread. Saving the same task through scheduledTasks.upsert (the Settings path) stores fresh_session. Any of #31696, #31649, #32367 fixes it.