Skip to content

feat(research): sweep command files intake issues #3899

Closed

Description

@dan-petty

Problem

Findings from item 3 need a path to a person. Today a person must remember to look. devops survey --emit-candidates shows the pattern, but it covers pyproject.toml only.

Expected

devops research sweep runs inventory and advisories, drops findings that were filed before (marker line research-finding: <source_id> found by issue search), and files one intake candidate per actionable finding through devops roadmap intake with --confirm. Actionable: severity high or critical and the pin is affected; or exploited; or past end of life. It prints a digest text. It sets the gauge devops_cli_research_open_findings by severity and adds one Alertmanager rule for critical or exploited findings to the existing Mattermost route. --dry-run makes no request and returns the would-be requests and a result of the same type.

Acceptance criteria

  • Tests that fail on the base: a new actionable finding gives one candidate; a second run gives none; a non-actionable finding gives only a digest line.
  • A test: --dry-run makes zero external requests.
  • A test: the candidate body holds advisory ids and URLs and no private host name or address.
  • The intake duplicate flag stays on; the sweep never drops a candidate or closes an issue.
  • docs/TELEMETRY.md has a row for the new instrument; the Prometheus rule test passes.

Existing tool considered

devops roadmap intake and NewCandidate (reused by survey and review intake), Alertmanager to Mattermost, devops survey. No new alert path.

Related

Part of the research agent plan. Related: #2044, #3495.

Part of the research agent plan of 2026-11-07 (design by the research-agent design workflow; the ADR is delivered through #3877).

Proposed design

Problem statement

Findings from research inventory and advisories need a path to a person. A person must remember to look today. The sweep files one intake candidate for each actionable finding. It skips findings that are already filed. It prints a digest, sets a severity gauge and adds one Mattermost alert rule.

Acceptance criteria

Requirement: Actionable finding files one intake candidate

The sweep SHALL file exactly one intake candidate for each actionable finding that has no earlier marker.

Scenario: First sweep of an actionable finding

  • WHEN the sweep runs on a high-severity finding whose affected pin is in the inventory and no issue body holds its marker
  • THEN the sweep calls intake once with --confirm and the candidate body holds the finding's advisory ids and URLs

Requirement: Second sweep skips a filed finding

The sweep SHALL file no candidate for a finding whose marker line already appears in an issue body.

Scenario: Second sweep of the same finding

  • WHEN the sweep runs again on the same finding and GitHub issue search returns its marker
  • THEN the sweep files no candidate and prints one digest line that says the finding was filed before

Requirement: Non-actionable finding stays in digest

The sweep SHALL print a digest line and file no candidate for a finding that is not actionable.

Scenario: Low-severity unaffected finding

  • WHEN the sweep runs on a low-severity finding whose pin is not affected and is not exploited or past end of life
  • THEN the sweep prints one digest line for the finding and makes no intake call

Requirement: Dry run makes no request

The sweep SHALL make zero external requests in dry-run mode and return the would-be requests and a result of the same type.

Scenario: Dry run with an actionable finding

  • WHEN the sweep runs with --dry-run on an actionable finding
  • THEN no GitHub search, intake, metric export or alert request leaves the process and the result lists the would-be intake request

Requirement: Candidate body has public advisory data only

The sweep MUST put advisory ids and URLs in the candidate body and MUST NOT put a private host name or address there.

Scenario: Candidate body from a finding with a private inventory path

  • WHEN the sweep files a candidate for a finding whose inventory record holds a private host name or address
  • THEN the candidate body holds the advisory ids and URLs and holds no private host name or address

Requirement: Intake duplicate flag stays on

The sweep SHALL call intake with its duplicate check enabled and SHALL NOT drop a candidate or close an issue.

Scenario: Intake reports a duplicate

  • WHEN intake reports that a candidate duplicates an item
  • THEN the sweep keeps the intake result and closes no issue

Requirement: Telemetry row and alert rule

The sweep SHALL set the gauge devops_cli_research_open_findings by severity and the project SHALL document it in docs/TELEMETRY.md.

Scenario: Critical finding sends gauge

  • WHEN the sweep finds one critical open finding
  • THEN the gauge has a severity=critical sample with value 1 and docs/TELEMETRY.md has a row for the instrument

Requirement: Prometheus rule test passes

The project SHALL add one Alertmanager rule for critical or exploited findings to the existing Mattermost route and its rule test SHALL pass.

Scenario: Alert rule test

  • WHEN the Prometheus rule test runs on the new rule
  • THEN the test passes and the rule routes to the existing Mattermost receiver

Requirement: Digest reports each finding

The sweep SHALL print a digest that lists each finding and its result.

Scenario: Digest with one filed and one skipped finding

  • WHEN the sweep handles one filed finding and one non-actionable finding
  • THEN the digest has one line for each finding and names the result of each

Existing Tool Considered

No alternatives check has run. No open, maintained external tool covers this repository-specific sweep. devops survey covers discovery but lacks advisory correlation, intake filing and deduplication. devops roadmap intake covers intake but lacks finding discovery. The change reuses both and the existing Alertmanager Mattermost route. The build cost is about 20,000 model tokens to build, keep and fix the sweep, and about 2 engineer-days of elapsed time.

Key questions

  • How does a new metric instrument reach Prometheus?: Declare the gauge in INSTRUMENTS in src/devops_cli/telemetry/instruments.py, send it with emit(), and add a row to docs/TELEMETRY.md. [sources: docs/TELEMETRY.md, src/devops_cli/telemetry/instruments.py]
  • Should the sweep call intake in process or as a subprocess?: Reuse the in-process intake path that survey uses. Keep the duplicate check on and pass the confirm behavior. (best practice) [sources: src/devops_cli/survey/intake.py, src/devops_cli/commands/survey.py, tests/commands/test_survey_cmd.py]
    • Chosen: In-process intake path. It reuses tested code, keeps the duplicate flag on and lets the test stub the call.
    • Rejected: devops roadmap intake subprocess. It adds a shell boundary, hides the duplicate flag and makes the test slower.
  • How does the sweep detect a finding that was filed before?: Search issue bodies for the exact marker line research-finding: <source_id> before intake. Treat any match as filed. (best practice) [sources: CONTEXT.md]
    • Chosen: Search issue bodies for the marker line. It is durable, searchable and survives a new process.
    • Rejected: Keep a local cache. It loses state on a new host and can file duplicates.
    • Rejected: Use a label on the issue. The body already holds the marker and a label adds a second source.
  • How should the candidate body avoid private data?: Build the body from an allowlist of public advisory fields and run the existing mask over it. (best practice) [sources: src/devops_cli/survey/models.py, src/devops_cli/survey/intake.py, docs/TELEMETRY.md]
    • Chosen: Allowlist public advisory fields and mask. It keeps advisory ids and URLs and leaves private host data out.
    • Rejected: Copy the finding text. It can carry a private host name or address into a public issue.
  • What does --dry-run return?: It builds the would-be intake requests and a result of the same type. It makes no GitHub search, intake, metric export or alert request. (best practice) [sources: src/devops_cli/commands/survey.py, tests/commands/test_all_commands_help_dryrun.py]
    • Chosen: Build and skip all network calls. It is testable and leaves no state.
    • Rejected: Run intake and roll back. It makes requests and can leave a candidate.
  • Which telemetry type and labels does the open-findings metric use?: Use a gauge named devops_cli_research_open_findings with a severity label. (best practice) [sources: docs/TELEMETRY.md]
    • Chosen: Gauge by severity. Open findings are a snapshot, and severity is the dimension that the body names.
    • Rejected: Counter by severity. A counter measures events, not the current open count.
    • Rejected: Histogram by severity. Severity is categorical, not a distribution.
  • What should the sweep do when intake reports a duplicate?: Keep the duplicate flag on, keep the intake result and close no issue. (best practice) [sources: CONTEXT.md, src/devops_cli/survey/intake.py]
    • Chosen: Keep the duplicate result and close nothing. Intake owns duplicate handling, and the sweep must not close or drop.
    • Rejected: Drop the candidate. It loses the finding and breaks the intake rule.
    • Rejected: Close the issue. The sweep never closes an issue.
  • Which findings count for the sweep?: Only anchored findings from inventory and advisories count. Model text is not a finding. [sources: docs/adr/0005-review-findings-come-from-tools-not-models.md, CONTEXT.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    status/new
    value/medium
    effort/medium
    on Nov 7, 2026
  2. dan-petty commented on Nov 7, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: none. The title has the scope research, and .github/labels.yml declares no scope/research label. Add the label to the file to give the scope to this item.
    • Priority: P2-Medium. It automates filing of security findings but does not fix a current failure or block a release.
    • Value: Medium. It removes the manual step of remembering to check advisories and file candidates, reducing the chance that a critical finding is missed.
    • Effort: Medium. It reuses existing intake and survey patterns but adds dedup logic, a new gauge, an Alertmanager rule, a dry-run path, and five acceptance tests.
    • Related: feat(ai): roadmap discovery from advisories, alerts, repo signals and web research (devops roadmap discover) #745, which asks for a different change. Both find security advisories and create intake candidates, but #745 is a broader 'roadmap discover' with multiple signal sources while the candidate is a focused 'research sweep' with dedup, gauge, and alerting.
  3. added
    priority/p2-medium
    on Nov 7, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 7, 2026
  5. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 226394c (see proposed design in issue body).

  6. added
    owner/agent
    on Nov 7, 2026
  7. dan-petty commented on Nov 7, 2026

    @dan-petty
    OwnerAuthor

    Pull request #4055 delivers this issue for findings of severity critical or high. The data for the two other conditions of "Actionable" does not exist on main, so each moves to the issue that adds the data:

    Everything else in the acceptance criteria is in #4055: the tests for one candidate and a second run with none, the non-actionable digest line, the dry run with zero requests, the public candidate body, the intake duplicate flag, the docs/TELEMETRY.md row and the Prometheus rule test.

  8. added
    status/in-review
    and removed
    status/ready
    on Nov 7, 2026
  9. added a commit that references this issue on Nov 7, 2026
    11ddee9
  10. removed
    status/in-review
    owner/agent
    on Nov 7, 2026
  11. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor
  12. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-07 22:00 UTC

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions