Skip to content

fix: MCP update_agent_schedule may accidentally re-enable disabled schedules #741

Closed

Description

@vybe

Summary

Two bugs in MCP schedule management that can silently corrupt schedule state when AI agents call `update_agent_schedule`:

  1. Accidental re-enable: The `enabled` field description in `update_agent_schedule` was too terse. An AI model updating other fields (e.g. cron expression) might include `enabled: true` to be "thorough" or copy it from a `list_agent_schedules` response — immediately re-enabling a schedule the user had intentionally disabled.

  2. Silent no-op on retry config: `ScheduleUpdateRequest` (Pydantic model in `routers/schedules.py`) was missing `max_retries` and `retry_delay_seconds`. When an MCP call included these fields, Pydantic's `exclude_unset=True` silently dropped them — the DB layer's `allowed_fields` list included them, but they could never reach it.

Context

Discovered during investigation of schedule CRUD path: MCP tool → Pydantic model → `model_dump(exclude_unset=True)` → `db.update_schedule()` → SQL UPDATE.

Acceptance Criteria

  • `update_agent_schedule` `enabled` field description explicitly warns AI models to omit the field unless intentionally changing enabled state
  • `ScheduleUpdateRequest` includes `max_retries: Optional[int] = None` and `retry_delay_seconds: Optional[int] = None` so retry config changes are no longer silently dropped
  • No regression: toggling via `toggle_agent_schedule` and explicit enable/disable still work correctly
  • Existing tests pass

Technical Notes

Files changed:

  • `src/mcp-server/src/tools/schedules.ts` — expand `enabled` description in `updateAgentSchedule` Zod schema
  • `src/backend/routers/schedules.py` — add `max_retries` and `retry_delay_seconds` to `ScheduleUpdateRequest`

The bug path for (1): disabled schedule → MCP update call with `enabled: true` in payload → backend applies it → schedule re-enabled without user intent.

Activity

  1. added
    priority-p1
    type-bug
    on May 8, 2026
  2. vybe commented on May 8, 2026

    @vybe
    ContributorAuthor

    /claim

  3. github-actions commented on May 8, 2026

    @github-actions

    Claimed by @vybe. Label status-in-progress added.

    Next steps:

    1. Create branch: feature/741-<short-slug>
    2. Implement the feature
    3. Open a PR with Fixes #741
  4. added
    status-in-progress
    on May 8, 2026
  5. added
    status-in-dev
    and removed
    status-in-progress
    on May 9, 2026
  6. vybe commented on May 10, 2026

    @vybe
    ContributorAuthor

    Fixed in PR #742 (aaad4f6 on dev). MCP update_agent_schedule now requires explicit enabled flag to change schedule state; accidental re-enable prevented.

  7. reopened this on May 10, 2026
  8. vybe commented on Jun 1, 2026

    @vybe
    ContributorAuthor

    Shipped in v0.6.0 (released via #998).

  9. removed
    status-in-dev
    on Jun 1, 2026
  10. added a commit that references this issue on Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority-p1type-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions