How to force stop and clear a stuck job

Problem:
job has gone into paused state due to the katello bug in most recent version

Expected outcome:
clear job using GUI
Foreman and Proxy versions:
latest

hi all please can someone advise on how to stop and clear a job that is stuck in paused state please

We upgraded our Foreman/Katello stack last week and then 4 days ago our cron to sync then publish 6 content views failed due to the reported bug here: Upgrade to Katello 4.17 - katello:correct_repositories fails - Support - TheForeman

I have added the db fix as suggested in the link and now trying to resync, but it fails immediately because old jobs are still there

I have tried to force cancel in GUI which said success, but they still remain. Also ran:
foreman-rake foreman_tasks:cleanup:config, foreman-rake foreman_tasks:cleanup:run and foreman-rake katello:correct_repositories. then stopped and started foreman services. All 6 jobs still showing as paused

Ive also tried adding a filter to the tasks cleanup command, which said it found 12 and cleared them. but still the same
I’ve also gone to the recurring logics tab and stopped the sync jobs in there too
But 6 still stuck in paused state with errors linked to this bug

Nevermind, seems I had to give it this command to cancel the job, with specific ID:
foreman-rake foreman_tasks:cleanup TASK_SEARCH=‘id=89241eaf-fcec-4a7a-a0d5-b621db34dacb’ STATES=paused,stopped VERBOSE=true

don’t understand why foreman-rake foreman_tasks:cleanup would fail to clean up the 6 stuck jobs though. I had to repeat above command 5 times to clean them all :-/