Skip to content

FIX: validate cancel_job delete flag type#360

Open
biru-codeastromer wants to merge 1 commit into
sktime:mainfrom
biru-codeastromer:fix/cancel-job-delete-flag-validation
Open

FIX: validate cancel_job delete flag type#360
biru-codeastromer wants to merge 1 commit into
sktime:mainfrom
biru-codeastromer:fix/cancel-job-delete-flag-validation

Conversation

@biru-codeastromer

Copy link
Copy Markdown
Contributor

Closes #359

Summary

  • validate the delete flag type in cancel_job_tool
  • reject non-boolean values before any job record is removed
  • add a regression test for delete="false"

Problem

cancel_job_tool treats the delete parameter as a plain truthy/falsy value.
That means malformed MCP calls like:

cancel_job_tool(job_id, delete="false")

still delete job records, because non-empty strings are truthy in Python.

I reproduced this on current code by creating a completed job and calling cancel_job_tool(job_id, delete="false"), which returned success and removed the job.

Fix

Add a strict boolean validation guard near the start of cancel_job_tool:

  • if delete is not a real bool, return a validation error
  • do not delete anything in that case

Tests

Added regression coverage to ensure:

  • cancel_job_tool(job_id, delete="false") returns an error
  • the job record remains present after the invalid call

Verification

  • ruff check .
  • ruff format --check .
  • pytest -q

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] cancel_job_tool treats non-boolean delete values as truthy and removes jobs unexpectedly

1 participant