发布

  • [NA] [BE] feat: accept all-clear reports + track last scan time (agent insights) (#7212)

    frostbyte_neo 发布于 2026-06-23 08:43:47 +00:00

    • [BE] fix: accept all-clear agent insights report (empty issues)

    The report endpoint rejected an empty issues list with 422 "issues must
    not be empty", so a diagnostic that legitimately finds nothing could not
    record completion — the reporting agent treated the 422 as retryable and
    looped until it exhausted its token budget.

    • AgentInsightsReport: issues is now @NotNull instead of @NotEmpty (a
      null body is still rejected; an empty list is a valid "all clear").
    • AgentInsightsIssueService.reportIssues: still validates the project,
      then returns without touching the DB when issues is empty (also avoids
      empty-batch writes in the DAO).
    • Tests: drop the empty-issues invalid case; add a happy-path test that
      an empty report is accepted (204) and persists nothing.

    Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

    • [BE] feat: track last scan time on agent insights jobs

    Stamp when a diagnostic report was last generated so the UI can show an
    accurate "Last scan" time. Unlike the issue's last_updated_at, this is not
    affected by users resolving/reopening issues.

    • Migration: add last_scan_at to agent_insights_jobs.
    • AgentInsightsJob: expose read-only last_scan_at.
    • AgentInsightsJobDAO.markScanned: stamp the column (no-op if no job row).
    • reportIssues: stamp last_scan_at on every report (incl. all-clear), in the
      same transaction as the issue upserts.

    Stacked on the all-clear fix (#7210) since both touch reportIssues.

    Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

    • [BE] address review: fix migration anchor, log order, scan audit actor
    • Migration: anchor last_scan_at AFTER status (last_triggered_at does not
      exist in the jobs schema, so AFTER last_triggered_at failed on a fresh DB).
    • reportIssues: log descriptive message first; compute issue count once.
    • markScanned: set last_updated_by alongside last_scan_at so the audit actor
      stays in sync with the ON UPDATE last_updated_at bump.

    Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

    • [BE] chore: trim verbose comments on agent insights changes

    Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

    • [BE] chore: add trailing newline to 000086 migration

    Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com


    Co-authored-by: Claude Opus 4.8 noreply@anthropic.com

    下载附件