fix: agent updated to respect sweep interval #2834
No reviewers
Labels
No labels
1week
2weeks
Failed compliance check
IP cameras
NATS
Possible security concern
Review effort 1/5
Review effort 2/5
Review effort 3/5
Review effort 4/5
Review effort 5/5
UI
aardvark
accessibility
amd64
api
arm64
auth
back-end
bgp
blog
bug
build
checkers
ci-cd
cleanup
cnpg
codex
core
dependencies
device-management
documentation
duplicate
dusk
ebpf
enhancement
eta 1d
eta 1hr
eta 3d
eta 3hr
feature
fieldsurvey
github_actions
go
good first issue
help wanted
invalid
javascript
k8s
log-collector
mapper
mtr
needs-triage
netflow
network-sweep
observability
oracle
otel
plug-in
proton
python
question
reddit
redhat
research
rperf
rperf-checker
rust
sdk
security
serviceradar-agent
serviceradar-agent-gateway
serviceradar-web
serviceradar-web-ng
siem
snmp
sysmon
topology
ubiquiti
wasm
wontfix
zen-engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
carverauto/serviceradar!2834
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2834/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from GitHub pull request.
Original GitHub pull request: #2673
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/2673
Original created: 2026-02-02T18:38:02Z
Original updated: 2026-02-02T23:43:30Z
Original head: carverauto/serviceradar:2646-bug-scanningsweep-interval-is-being-ignored
Original base: staging
Original merged: 2026-02-02T23:43:22Z by @mfreeman451
User description
IMPORTANT: Please sign the Developer Certificate of Origin
Thank you for your contribution to ServiceRadar. Please note, when contributing, the developer must include
a DCO sign-off statement indicating the DCO acceptance in one commit message. Here
is an example DCO Signed-off-by line in a commit message:
Describe your changes
Issue ticket number and link
Code checklist before requesting a review
PR Type
Bug fix, Enhancement
Description
Fixed sweep interval configuration being ignored by agent
Refactored gateway sweep config parsing to merge multiple groups
Added ticker reset mechanism to respect interval changes at runtime
Implemented deduplication logic for ports, modes, and networks
Added comprehensive specification and task documentation
Diagram Walkthrough
File Walkthrough
sweep_config_gateway.go
Merge multiple sweep groups with deduplicationpkg/agent/sweep_config_gateway.go
duplicates
sweeper.go
Implement ticker reset on interval changespkg/sweeper/sweeper.go
tickerResetchannel to signal interval changessweep_service.go
Add logging for sweep config updatespkg/agent/sweep_service.go
proposal.md
Add proposal for sweep interval fixopenspec/changes/fix-sweep-interval-config/proposal.md
spec.md
Define sweep job configuration specificationsopenspec/changes/fix-sweep-interval-config/specs/sweep-jobs/spec.md
tasks.md
Add implementation tasks for sweep interval fixopenspec/changes/fix-sweep-interval-config/tasks.md
intervals
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2673#issuecomment-3836983779
Original created: 2026-02-02T18:38:44Z
PR Compliance Guide 🔍
Below is a summary of compliance checks for this PR:
Ticker reset DoS
Description:
ticker.Reset(newInterval)is invoked without validatingnewInterval > 0, so amalformed/zero/negative interval from config could panic or create a tight loop leading to
service disruption (remote config-driven DoS). sweeper.go [426-433]
Referred Code
🎫 #2646
into one, with deduplication of combined targets/settings, and the shortest interval used
when intervals differ.
should adjust the running ticker rather than requiring a restart).
5 minutes.
config (
sweep.jsonpayload) and must not default to 5 minutes when a valid interval isprovided.
Codebase context is not defined
Follow the guide to enable codebase context checks.
Generic: Comprehensive Audit Trails
Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.
Status: Passed
Generic: Meaningful Naming and Self-Documenting Code
Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting
Status: Passed
Generic: Secure Error Handling
Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.
Status: Passed
Generic: Secure Logging Practices
Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.
Status: Passed
Generic: Robust Error Handling and Edge Case Management
Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation
Status:
Interval not validated: The new ticker reset path calls
ticker.Reset(newInterval)without validatingnewInterval> 0, which can cause runtime panics or undefined scheduling when interval iszero/invalid.
Referred Code
Generic: Security-First Input Validation and Data Handling
Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities
Status:
Unvalidated external values: The merged gateway sweep config consumes external inputs (e.g.,
group.Ports,group.Schedule) with minimal validation, so it requires verification that upstream schemavalidation prevents invalid ports/intervals from reaching runtime scheduling.
Referred Code
Compliance status legend
🟢 - Fully Compliant🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2673#issuecomment-3836989177
Original created: 2026-02-02T18:40:06Z
PR Code Suggestions ✨
Explore these optional code suggestions:
✅
Re-evaluate the sweep group merging strategySuggestion Impact:
The commit removed the global “merge all groups” logic (including choosing the shortest interval) by switching to returning a per-group SweepGroupsConfig where each group retains its own Interval. The spec text that required using the shortest interval as the global interval was also removed.code diff:
The current strategy of merging multiple sweep groups by using the shortest
interval can cause unintended high-frequency scanning. It is suggested to
re-evaluate this merging logic to prevent unexpected network load.
Examples:
pkg/agent/sweep_config_gateway.go [145-149]
openspec/changes/fix-sweep-interval-config/specs/sweep-jobs/spec.md [38]
Solution Walkthrough:
Before:
After:
Suggestion importance[1-10]: 9
__
Why: This suggestion raises a critical design concern about the sweep group merging strategy, as using the shortest interval could cause unintended high network load, which is a significant potential issue.
Deduplicate device targets to prevent redundant scans
Deduplicate
DeviceTargetsby their network address and merge theirSweepModestoprevent redundant scans and ensure all scan modes are included.
pkg/agent/sweep_config_gateway.go [137-138]
Suggestion importance[1-10]: 7
__
Why: The suggestion correctly identifies that
DeviceTargetsare not deduplicated, unlike other merged fields, which could lead to redundant scans. The proposed fix to merge properties of duplicate targets is a robust improvement.Ensure ticker reset signal is not dropped
To prevent dropping ticker reset signals during rapid configuration updates,
drain the
tickerResetchannel before sending a new signal.pkg/sweeper/sweeper.go [727-733]
Suggestion importance[1-10]: 7
__
Why: This suggestion correctly identifies a potential race condition where a ticker reset signal could be dropped, making the new interval update mechanism more robust.
Imported GitHub PR review comment.
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/2673#discussion_r2755869682
Original created: 2026-02-02T19:24:20Z
Original path: pkg/agent/push_loop.go
Original line: 804
seems like we should be able to set this
Imported GitHub PR review comment.
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/2673#discussion_r2756421047
Original created: 2026-02-02T23:13:26Z
Original path: pkg/agent/sync_runtime.go
Original line: 383
??