Follow-up to #548. Issue creation covers only a scan's NEW findings, so a finding whose issue failed (listing error, refused create) never got one.
What
ISSUE_CATCHUP=off|dry_run|on (AgentConfig issue_catchup, default off; an unknown value logs a warning and stays off). Documented in .env.example and docs/guide/issues.md (there is no config reference doc).
After the normal issue creation of a Gitea target, the catch-up loads the target's findings with severity medium+, status open/triaged/needs_review (the same "undecided" set normal creation uses, shared via wants_issue) and no tracker_issue_url.
It reuses the scan's one listing (ExistingIssues, with this scan's new issues added): no second listing. If the listing fails, neither runs.
Matching is the same as #548: marker, then title; grouped findings by fingerprint only. A match is linked (url on the finding plus a tracker_issues record, so the status sync closes/reopens it), and links don't count toward the cap.
At most 20 new issues per target per scan, highest severity first, then oldest. The rest are deferred. Failed creates count toward the cap, so a broken Gitea gets at most 20 attempts. The #548 limiter and the 250 ms pause apply (same GiteaTracker calls).
dry_run counts what it would create/link and changes nothing (no creates, no links, no label requests).
One INFO line per target: tenant_id, target_id, mode, created/linked/deferred/failed, each with a severity breakdown. No titles or paths.
Gitea only. GitHub/GitLab/Jira are unchanged: they have no listing, so matching would need a search per finding.
Refactor
Normal creation and the catch-up share IssueSink::open (body, labels, create, record). The managed labels are now ensured lazily on the first create (one OnceCell), so a run that creates nothing doesn't touch the labels.
The tracker_issues record is now upserted per finding_id (unique index) instead of inserted.
GiteaIssue carries state, so a link to a closed issue is recorded as closed.
Notes
The catch-up also covers this scan's own findings: a new finding whose create failed is retried in the same scan (within the cap), and one that normal creation matched to an existing issue gets linked.
When two single findings share a title and neither has an issue, one issue is opened. The other is linked to it on the next scan.
a_dry_run_counts_but_creates_and_links_nothing (fake axum Gitea, no requests)
on_links_by_marker_and_opens_the_others (Mongo + fake Gitea: dry run changes nothing; on links #7 by marker with no POST and creates one; a second run does nothing). It skips without Mongo; it ran locally against mongo:7.
Follow-up to #548. Issue creation covers only a scan's NEW findings, so a finding whose issue failed (listing error, refused create) never got one.
## What
- `ISSUE_CATCHUP=off|dry_run|on` (AgentConfig `issue_catchup`, default `off`; an unknown value logs a warning and stays off). Documented in `.env.example` and `docs/guide/issues.md` (there is no config reference doc).
- After the normal issue creation of a **Gitea** target, the catch-up loads the target's findings with severity medium+, status open/triaged/needs_review (the same "undecided" set normal creation uses, shared via `wants_issue`) and no `tracker_issue_url`.
- It reuses the scan's one listing (`ExistingIssues`, with this scan's new issues added): no second listing. If the listing fails, neither runs.
- Matching is the same as #548: marker, then title; grouped findings by fingerprint only. A match is **linked** (url on the finding plus a `tracker_issues` record, so the status sync closes/reopens it), and links don't count toward the cap.
- At most **20 new issues** per target per scan, highest severity first, then oldest. The rest are deferred. Failed creates count toward the cap, so a broken Gitea gets at most 20 attempts. The #548 limiter and the 250 ms pause apply (same `GiteaTracker` calls).
- `dry_run` counts what it would create/link and changes nothing (no creates, no links, no label requests).
- One INFO line per target: `tenant_id`, `target_id`, mode, created/linked/deferred/failed, each with a severity breakdown. No titles or paths.
- **Gitea only.** GitHub/GitLab/Jira are unchanged: they have no listing, so matching would need a search per finding.
## Refactor
- Normal creation and the catch-up share `IssueSink::open` (body, labels, create, record). The managed labels are now ensured lazily on the first create (one `OnceCell`), so a run that creates nothing doesn't touch the labels.
- The `tracker_issues` record is now upserted per `finding_id` (unique index) instead of inserted.
- `GiteaIssue` carries `state`, so a link to a closed issue is recorded as closed.
## Notes
- The catch-up also covers this scan's own findings: a new finding whose create failed is retried in the same scan (within the cap), and one that normal creation matched to an existing issue gets linked.
- When two single findings share a title and neither has an issue, one issue is opened. The other is linked to it on the next scan.
## Tests
- `pipeline::issue_catchup::tests::only_undecided_medium_and_above_without_an_issue_are_caught_up`, `highest_severity_first_then_oldest`, `at_most_twenty_new_issues_and_the_rest_are_deferred`, `a_finding_with_an_issue_is_linked_and_not_counted`, `one_new_issue_per_title`
- `a_dry_run_counts_but_creates_and_links_nothing` (fake axum Gitea, no requests)
- `on_links_by_marker_and_opens_the_others` (Mongo + fake Gitea: dry run changes nothing; on links #7 by marker with no POST and creates one; a second run does nothing). It skips without Mongo; it ran locally against mongo:7.
- `config::app_env_tests::issue_catchup_is_off_unless_named` (flag parsing)
- The existing `issue_creation`, `issue_sync` and `trackers::gitea` tests pass. Clippy `-D warnings` passes for core and agent, and fmt is clean.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
Issue creation only covers a scan's new findings, so a finding whose issue
failed (a failed listing, a refused create) never got one. ISSUE_CATCHUP
(off | dry_run | on, default off; unknown values warn and stay off) adds a
catch-up after a Gitea target's normal issue creation, on the same listing:
open/triaged/needs-review findings of medium or above without
tracker_issue_url are linked to their existing issue (marker, then title;
groups by fingerprint only) or get a new one, at most 20 new per target and
scan, highest severity then oldest first; the rest are deferred. dry_run
only counts. One INFO summary line per target with counts and severities.
Issue creation and the catch-up share one IssueSink: it opens an issue,
ensures the managed labels lazily on the first create, and records the
issue on the finding plus a tracker_issues record (upserted per finding),
so a linked issue follows the finding's status like an opened one.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang
merged commit e382746cfb into main2026-10-09 16:08:24 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Follow-up to #548. Issue creation covers only a scan's NEW findings, so a finding whose issue failed (listing error, refused create) never got one.
What
ISSUE_CATCHUP=off|dry_run|on(AgentConfigissue_catchup, defaultoff; an unknown value logs a warning and stays off). Documented in.env.exampleanddocs/guide/issues.md(there is no config reference doc).wants_issue) and notracker_issue_url.ExistingIssues, with this scan's new issues added): no second listing. If the listing fails, neither runs.tracker_issuesrecord, so the status sync closes/reopens it), and links don't count toward the cap.GiteaTrackercalls).dry_runcounts what it would create/link and changes nothing (no creates, no links, no label requests).tenant_id,target_id, mode, created/linked/deferred/failed, each with a severity breakdown. No titles or paths.Refactor
IssueSink::open(body, labels, create, record). The managed labels are now ensured lazily on the first create (oneOnceCell), so a run that creates nothing doesn't touch the labels.tracker_issuesrecord is now upserted perfinding_id(unique index) instead of inserted.GiteaIssuecarriesstate, so a link to a closed issue is recorded as closed.Notes
Tests
pipeline::issue_catchup::tests::only_undecided_medium_and_above_without_an_issue_are_caught_up,highest_severity_first_then_oldest,at_most_twenty_new_issues_and_the_rest_are_deferred,a_finding_with_an_issue_is_linked_and_not_counted,one_new_issue_per_titlea_dry_run_counts_but_creates_and_links_nothing(fake axum Gitea, no requests)on_links_by_marker_and_opens_the_others(Mongo + fake Gitea: dry run changes nothing; on links #7 by marker with no POST and creates one; a second run does nothing). It skips without Mongo; it ran locally against mongo:7.config::app_env_tests::issue_catchup_is_off_unless_named(flag parsing)issue_creation,issue_syncandtrackers::giteatests pass. Clippy-D warningspasses for core and agent, and fmt is clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p