fix(scan): a person's scan gets the next slot and shows as queued (t84) #940

Merged
sharang merged 3 commits from fix/t84-scan-followup into main 2026-11-09 07:52:25 +00:00
3 Commits
Author SHA1 Message Date
Sharang ParnerkarandClaude Opus 5.5 9d79bac004 fix(scan): a taken-over waiting scan is charged as the scan it replaces (t84)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 5m58s
CI / Check (pull_request) Successful in 19m58s
When a person's request takes over a scheduled, webhook or new-content
scan that still waits for a slot, the run keeps the person's priority
and attribution (the history shows that a person asked), but it counts
only as the scan it replaced would have: that scan would have run
anyway, the customer only gets it sooner. Change detection decides, as
for that trigger, so on an included target it is not charged.

A person's follow-up after a running scan is a new run and is charged
as their request, as before. The run records the trigger it is charged
as in `charged_as`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 23:36:41 +01:00
Sharang ParnerkarandClaude Opus 5.5 eac393613f fix(scan): a person's scan gets the next slot and shows as queued (t84)
A scan a person asked for waited behind every scheduled scan of every
tenant: the scan gate's slots were one FIFO semaphore, and a request for
a target whose scheduled scan still waited became a follow-up behind it.
On stage a click waited about 3 hours with nothing to show for it.

- Scan gate: two queues for the slots. Manual and support scans go
  first, FIFO within each class; after 3 person scans in a row a waiting
  background scan gets the slot, so clicks never starve the scheduler.
- A person's request takes over a waiting scan that was not a person's,
  at person priority; on a running target it is the follow-up and
  re-queues at person priority once the running scan ends.
- Each request is recorded at once as a run with status `queued`
  ("Wartet auf einen Platz"), follow-ups included; the scan starts on
  that run. Requests that will not run have theirs removed; one whose
  scan ends before it starts is closed as failed.
- A restart closes queued runs as interrupted and resumes the target;
  a queued run does not count toward the restart-loop guard, and a
  person's trigger wins.
- Evidence and the platform's last_scan_at ignore queued runs.

Metering is unchanged: a counted Prüfung is admitted and charged when
it runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 22:54:17 +01:00
Sharang ParnerkarandClaude Opus 5.5 5e0e6b33de test(scan): a person's follow-up waits behind every scheduled scan (t84)
Reproduces t84: a scan requested while the target's scheduled scan still
waits for a slot is coalesced as its follow-up, but the follow-up only
queues for a slot after that scan finished, behind every other scheduled
scan of the tick. Fails until person-started scans go first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 16:37:14 +01:00