Repository navigation
feat: cancel a scan that is queued for a slot - #1246
Merged
Merged
Conversation
Deploying edgewatch with
|
| Latest commit: |
eec50ef
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://926ed37b.edgewatch-cpd.pages.dev |
| Branch Preview URL: | https://feat-cancel-queued-runs.edgewatch-cpd.pages.dev |
crypt0rr
force-pushed
the
feat/cancel-queued-runs
branch
from
October 7, 2026 16:35
dde80c2 to
eec50ef
Compare
A run waiting for a scan slot can be withdrawn with DELETE
/jobs/{id}/run (jobs.run) or the new Cancel queued scan button on the
job page and the Overview. The run's wait has its own context, so the
cancellation ends only the wait; a cancellation that races the slot
grant is refused for a run that has taken its slot and stops one that
has not. The withdrawn run is reported as scan.skipped with reason
canceled, is audited as scan.queued_run_canceled, and never starts or
holds a slot.
Fixes #1226
crypt0rr
force-pushed
the
feat/cancel-queued-runs
branch
from
October 7, 2026 17:01
eec50ef to
82c6e0c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A run waiting for a scan slot can now be withdrawn (#1226). Before this change only a running scan could be cancelled, so an accidental Scan now behind a long scan, with
max_concurrent_scans: 1, could not be taken back.API
DELETE /jobs/{id}/run, using the samejobs.runpermission as starting a run.{"status":"canceled"}when the job had a queued run.run_not_queuedwhen nothing is waiting, including a run that has already taken its slot; a running scan is still cancelled withPOST /scans/{id}/cancel.resolveJob), andTestIsolationMatrixcovers the route automatically throughapiRoutes.scan.queued_run_canceled, in the data category.App
context.WithCancelCause), soCancelQueuedRunends only the wait and never touches the run context the scan will use.started/canceledpair makes the race with the slot grant deterministic: a cancel either stops a run that hasn't taken its slot, or is refused because it has.ErrQueuedRunCanceled, never starts or holds a slot, and is reported asscan.skippedwith the new reasoncanceled. A cancelled scheduled run is logged as skipped, not asscan failed.Console
Docs: the jobs guide describes Cancel queued scan.
Compatibility
Additive: a new route, a new skip reason
canceled, and a new audit action. There are no schema changes.Validation
gofmt,go vet ./...go test -racefor the queued and slot tests ininternal/app, and for the new route, isolation, route-drift, permission and audit tests ininternal/web. The audit-category tests ininternal/storepass with the new action.npm run lintnpm --prefix docs run buildNew tests:
internal/app/queued_cancel_test.go:ErrQueuedRunCanceled, emits onecanceledskip, takes no slot and persists no scan;internal/web/scan_control_test.go: the route returns 202, then 409run_not_queuedfor that job and for the running job, and leaves the running scan untouched.Fixes #1226