Repository navigation
fix(rekor-monitor): raise scan-window timeout for large backlogs - #1900
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughAdds a shared GitHub API retry script with atomic output publication and wires it into the Rekor monitoring workflow for artifact, checkpoint, and tag fetches. The workflow job timeout increases to 90 minutes, while the monitor’s single-pass timeout increases to 45 minutes. Documentation now specifies known-tag suppression behavior and when Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/scripts/gh-api-retry.sh:
- Around line 1-14: Add the standard repository license header immediately after
the shebang in gh-api-retry.sh, preserving the existing script comments and
behavior. Run the repository license check to verify the header meets the
required format.
- Around line 19-30: Update the retry script around the gh api loop to register
an EXIT trap that removes both ${out} and ${out}.part, ensuring no output file
remains after any failure, including a failed mv. Clear or disable the trap only
after mv successfully publishes ${out}, while preserving the successful exit
path and existing retry behavior.
- Around line 19-25: Update the retry loop in gh-api-retry.sh so each gh api
invocation is wrapped with timeout and has a finite limit comfortably below the
overall job budget. Preserve the existing partial-output handling, retry
warnings, backoff, and fallback behavior while ensuring stalled requests return
control to the loop.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: b77471ea-6e85-443f-b8bd-a869ab6ce35f
📒 Files selected for processing (5)
.github/scripts/gh-api-retry.sh.github/workflows/rekor-monitor.yamltools/rekor-monitor/README.mdtools/rekor-monitor/doc.gotools/rekor-monitor/main.go
Coverage Report ✅
Coverage BadgeCoverage unchanged by this PR. |
06a211e to
6667f22
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/rekor-monitor.yaml:
- Around line 115-119: Increase the workflow job’s timeout-minutes from 50 to at
least 80, ensuring the three API fetch retry budget, the monitor’s 45-minute
deadline, and setup overhead fit within the job limit. Keep the existing timeout
rationale and monitor behavior unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: c7e8e6c6-7e12-4979-9e7f-af957131bc42
📒 Files selected for processing (5)
.github/scripts/gh-api-retry.sh.github/workflows/rekor-monitor.yamltools/rekor-monitor/README.mdtools/rekor-monitor/doc.gotools/rekor-monitor/main.go
6667f22 to
46051bb
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tools/rekor-monitor/doc.go`:
- Around line 54-58: Document in tools/rekor-monitor/doc.go lines 54-58 that
argument parsing or known-tags-file loading errors return before the run and
print no CLASSIFICATION= line. Update tools/rekor-monitor/README.md lines 84-89
to include known-tags-file loading errors in the exit-status exception alongside
argument errors.
In `@tools/rekor-monitor/main.go`:
- Around line 33-43: Move the 45-minute timeout default from the local
defaultTimeout constant in the rekor monitor to a named constant in
pkg/defaults, then reference that shared constant from main.go. Remove the
standalone local literal while preserving the current timeout behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: b36b559c-a359-4938-802b-67c73f9f7237
📒 Files selected for processing (5)
.github/scripts/gh-api-retry.sh.github/workflows/rekor-monitor.yamltools/rekor-monitor/README.mdtools/rekor-monitor/doc.gotools/rekor-monitor/main.go
46051bb to
559edaa
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/rekor-monitor.yaml:
- Around line 115-122: Update the timeout configuration around the workflow’s
timeout-minutes setting to reserve explicit time for post-monitor failure
handling, including issue creation, Slack delivery, degraded-run checks, and
cleanup. Either bound those gh/curl operations and include their maximum
duration in the documented budget, or increase timeout-minutes with explicit
headroom so follow-up processing completes before the job is killed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: 2366031b-f529-42cd-ab30-a642ecaa39a8
📒 Files selected for processing (5)
.github/scripts/gh-api-retry.sh.github/workflows/rekor-monitor.yamltools/rekor-monitor/README.mdtools/rekor-monitor/doc.gotools/rekor-monitor/main.go
559edaa to
aebb7f6
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/scripts/gh-api-retry.sh:
- Around line 41-45: Update the cleanup trap and publish step in the retry loop
to pass `--` to both rm and mv before the caller-supplied out paths. Preserve
the existing temporary-file cleanup and successful publish behavior while
ensuring paths beginning with "-" are treated as filenames.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: 33c86bd2-5d38-4c15-ad7e-c275ae69c520
📒 Files selected for processing (5)
.github/scripts/gh-api-retry.sh.github/workflows/rekor-monitor.yamltools/rekor-monitor/README.mdtools/rekor-monitor/doc.gotools/rekor-monitor/main.go
The first scheduled run after #1897 hit the 15-minute per-pass timeout in the identity scan: the checkpoint had been wedged for hours, so the scan window had grown to roughly 380k entries. The tool classified the timeout as operational (correct: no security page, a calm degraded issue), but a window that large cannot finish inside 15m, so the cursor never advances and the monitor cannot catch up. Raise the per-pass timeout (defaultTimeout) from 15m to 45m and the job backstop (timeout-minutes) from 20m to 50m so a single pass can scan a large backlog (a multi-hour Sigstore/TUF outage, or an untriaged finding that deliberately holds the cursor) and advance, after which the hourly windows return to a few minutes. This doubles as a durable resilience buffer against future large-window conditions. Also fold in the post-merge CodeRabbit review nits from #1897: - Extract the duplicated gh_api_retry helper into .github/scripts/gh-api-retry.sh, invoked by both fetch steps, so the two copies cannot drift. - Clarify in the tool README and doc.go that a set-but-missing --known-tags-file is a hard error (exit 2), distinct from an empty file (disables suppression), and that the CLASSIFICATION line is printed for a completed run (exit 0/1/3) but not the exit-2 argument-error path. Follow-up to #1897. Related #1898 Related #1899 Signed-off-by: Brian Lockwood <[email protected]>
aebb7f6 to
5769834
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
mchmarny
left a comment
There was a problem hiding this comment.
APPROVED — no merge blockers found. Reviewed the timeout and retry-helper changes at the exact head, including failure cleanup and workflow budgets. Focused race tests, affected-package lint, bash and shell validation, actionlint, and yamllint all passed; all live checks are complete with no failures.
The identity scan is linear in the window size, so a window that has not advanced for a while (a multi-hour Sigstore/TUF outage, or a finding that deliberately holds the cursor) can grow past what one run can scan inside the 45m pass deadline. On 2026-07-24 the window reached ~1.17M entries and timed out (operational) every run; the monitor could not self-heal without a re-baseline, which skips the backlog (a coverage gap). Make the scan resumable. Split the signed checkpoint (the consistency anchor, advanced only once the scan reaches head) from a new scannedTo cursor persisted in a <checkpoint>.scan companion carried in the same artifact. Each run scans a bounded slice (maxScanEntriesPerRun, in scanChunkSize chunks), persists progress after each clean chunk, and resumes there next run. A large backlog is caught up over several hourly runs, each within budget, with no coverage gap and no re-baseline. A partial catch-up pass is a clean (exit 0) run; a finding still halts at its chunk and is re-detected until triaged (so a partial-clean pass never coexists with an open finding alert). The consistency proof stays O(log n), so it is never the bottleneck. Also re-enable the scheduled cron (commented out on 2026-07-24 to pause the wedged monitor) and upload the progress companion alongside the checkpoint. An artifact without the companion (a run before this shipped, or one that did not scan) resumes from 0, i.e. the prior full-window behavior. Follows #1897 / #1900 / #1903. Signed-off-by: Brian Lockwood <[email protected]>
The identity scan is linear in the window size, so a window that has not advanced for a while (a multi-hour Sigstore/TUF outage, or a finding that deliberately holds the cursor) can grow past what one run can scan inside the 45m pass deadline. On 2026-07-24 the window reached ~1.17M entries and timed out (operational) every run; the monitor could not self-heal without a re-baseline, which skips the backlog (a coverage gap). Make the scan resumable. Split the signed checkpoint (the consistency anchor, advanced only once the scan reaches head) from a new scannedTo cursor persisted in a <checkpoint>.scan companion carried in the same artifact. Each run scans a bounded slice (maxScanEntriesPerRun, in scanChunkSize chunks), persists progress after each clean chunk, and resumes there next run. A large backlog is caught up over several hourly runs, each within budget, with no coverage gap and no re-baseline. A partial catch-up pass is a clean (exit 0) run; a finding still halts at its chunk and is re-detected until triaged (so a partial-clean pass never coexists with an open finding alert). The consistency proof stays O(log n), so it is never the bottleneck. Also re-enable the scheduled cron (commented out on 2026-07-24 to pause the wedged monitor) and upload the progress companion alongside the checkpoint. An artifact without the companion (a run before this shipped, or one that did not scan) resumes from 0, i.e. the prior full-window behavior. Follows #1897 / #1900 / #1903. Signed-off-by: Brian Lockwood <[email protected]>
The identity scan is linear in the window size, so a window that has not advanced for a while (a multi-hour Sigstore/TUF outage, or a finding that deliberately holds the cursor) can grow past what one run can scan inside the 45m pass deadline. On 2026-07-24 the window reached ~1.17M entries and timed out (operational) every run; the monitor could not self-heal without a re-baseline, which skips the backlog (a coverage gap). Make the scan resumable. Split the signed checkpoint (the consistency anchor, advanced only once the scan reaches head) from a new scannedTo cursor persisted in a <checkpoint>.scan companion carried in the same artifact. Each run scans a bounded slice (maxScanEntriesPerRun, in scanChunkSize chunks), persists progress after each clean chunk, and resumes there next run. A large backlog is caught up over several hourly runs, each within budget, with no coverage gap and no re-baseline. A partial catch-up pass is a clean (exit 0) run; a finding still halts at its chunk and is re-detected until triaged (so a partial-clean pass never coexists with an open finding alert). The consistency proof stays O(log n), so it is never the bottleneck. Also re-enable the scheduled cron (commented out on 2026-07-24 to pause the wedged monitor) and upload the progress companion alongside the checkpoint. An artifact without the companion (a run before this shipped, or one that did not scan) resumes from 0, i.e. the prior full-window behavior. Follows #1897 / #1900 / #1903. Signed-off-by: Brian Lockwood <[email protected]>
The identity scan is linear in the window size, so a window that has not advanced for a while (a multi-hour Sigstore/TUF outage, or a finding that deliberately holds the cursor) can grow past what one run can scan inside the 45m pass deadline. On 2026-07-24 the window reached ~1.17M entries and timed out (operational) every run; the monitor could not self-heal without a re-baseline, which skips the backlog (a coverage gap). Make the scan resumable. Split the signed checkpoint (the consistency anchor, advanced only once the scan reaches head) from a new scannedTo cursor persisted in a <checkpoint>.scan companion carried in the same artifact. Each run scans a bounded slice (maxScanEntriesPerRun, in scanChunkSize chunks), persists progress after each clean chunk, and resumes there next run. A large backlog is caught up over several hourly runs, each within budget, with no coverage gap and no re-baseline. A partial catch-up pass is a clean (exit 0) run; a finding still halts at its chunk and is re-detected until triaged (so a partial-clean pass never coexists with an open finding alert). The consistency proof stays O(log n), so it is never the bottleneck. Also re-enable the scheduled cron (commented out on 2026-07-24 to pause the wedged monitor) and upload the progress companion alongside the checkpoint. An artifact without the companion (a run before this shipped, or one that did not scan) resumes from 0, i.e. the prior full-window behavior. Follows #1897 / #1900 / #1903. Signed-off-by: Brian Lockwood <[email protected]>
The identity scan is linear in the window size, so a window that has not advanced for a while (a multi-hour Sigstore/TUF outage, or a finding that deliberately holds the cursor) can grow past what one run can scan inside the 45m pass deadline. On 2026-07-24 the window reached ~1.17M entries and timed out (operational) every run; the monitor could not self-heal without a re-baseline, which skips the backlog (a coverage gap). Make the scan resumable. Split the signed checkpoint (the consistency anchor, advanced only once the scan reaches head) from a new scannedTo cursor persisted in a <checkpoint>.scan companion carried in the same artifact. Each run scans a bounded slice (maxScanEntriesPerRun, in scanChunkSize chunks), persists progress after each clean chunk, and resumes there next run. A large backlog is caught up over several hourly runs, each within budget, with no coverage gap and no re-baseline. A partial catch-up pass is a clean (exit 0) run; a finding still halts at its chunk and is re-detected until triaged (so a partial-clean pass never coexists with an open finding alert). The consistency proof stays O(log n), so it is never the bottleneck. Also re-enable the scheduled cron (commented out on 2026-07-24 to pause the wedged monitor) and upload the progress companion alongside the checkpoint. An artifact without the companion (a run before this shipped, or one that did not scan) resumes from 0, i.e. the prior full-window behavior. Follows #1897 / #1900 / #1903. Signed-off-by: Brian Lockwood <[email protected]>
The identity scan is linear in the window size, so a window that has not advanced for a while (a multi-hour Sigstore/TUF outage, or a finding that deliberately holds the cursor) can grow past what one run can scan inside the 45m pass deadline. On 2026-07-24 the window reached ~1.17M entries and timed out (operational) every run; the monitor could not self-heal without a re-baseline, which skips the backlog (a coverage gap). Make the scan resumable. Split the signed checkpoint (the consistency anchor, advanced only once the scan reaches head) from a new scannedTo cursor persisted in a <checkpoint>.scan companion carried in the same artifact. Each run scans a bounded slice (maxScanEntriesPerRun, in scanChunkSize chunks), persists progress after each clean chunk, and resumes there next run. A large backlog is caught up over several hourly runs, each within budget, with no coverage gap and no re-baseline. A partial catch-up pass is a clean (exit 0) run; a finding still halts at its chunk and is re-detected until triaged (so a partial-clean pass never coexists with an open finding alert). The consistency proof stays O(log n), so it is never the bottleneck. Also re-enable the scheduled cron (commented out on 2026-07-24 to pause the wedged monitor) and upload the progress companion alongside the checkpoint. An artifact without the companion (a run before this shipped, or one that did not scan) resumes from 0, i.e. the prior full-window behavior. Follows #1897 / #1900 / #1903. Signed-off-by: Brian Lockwood <[email protected]>
Summary
Raise the Rekor monitor's per-pass scan timeout so a large backlog window (from a wedged checkpoint or a multi-hour upstream outage) can be scanned in a single pass and let the cursor advance, and fold in the three post-merge CodeRabbit nits from #1897.
Motivation / Context
The first scheduled run after #1897 merged hit the 15-minute per-pass timeout during the identity scan: the checkpoint had been wedged since ~14:30, so the scan window had grown to ~380k entries. The tool classified the timeout as operational (correct: no security page, just a calm degraded issue), but a window that large cannot finish inside 15m, so the cursor never advances and the monitor cannot catch up. This raises the timeout so one pass clears the backlog; afterward the hourly windows are minutes again.
Follow-up to #1897.
Related: #1898, #1899
Type of Change
Component(s) Affected
docs/,examples/)tools/rekor-monitor+.github/workflows/rekor-monitor.yaml+.github/scripts/Implementation Notes
defaultTimeout15m -> 45m; workflowtimeout-minutes20 -> 50 (the job backstop must exceed the tool's per-pass deadline so the tool's own deadline, which classifies as operational, fires first rather than a hard job kill). Sized for a several-hundred-thousand-entry backlog with headroom, since the window keeps growing (~70k/hour) while wedged; also a durable resilience buffer.gh_api_retryhelper into.github/scripts/gh-api-retry.sh(repo's existing.github/scripts/*.shconvention), invoked by both fetch steps so the two copies cannot drift.--known-tags-file(hard error, exit 2) from an empty file (disables suppression), matchingmaintaining.md.doc.goclarify theCLASSIFICATION=line prints for a completed run (exit 0/1/3), not the exit-2 argument-error path.Testing
TestParseFlagsreferences thedefaultTimeoutconstant (not a literal), so the bump needs no test change. Fullmake qualify(e2e + scan) relies on CI.Risk Assessment
Rollout notes: On merge, the next scheduled (or a dispatched) run scans the full backlog within 45m, advances the checkpoint, and the workflow's clean-run close step auto-closes #1898 and #1899. Future windows are small again. If the backlog has grown past what 45m allows, the fallback is a one-time checkpoint re-baseline.
Checklist
make testwith-race)make lint)git commit -S)