Discovery schedule including devices with multiple IPs and using counting jobs is completed prematurelyDescriptionWhen using the optimized counting mechanism for Discovery status tracking, the legacy code paths that handle duplicate IP processing and the jail mechanism continue to update status counters and trigger state transitions. This causes the discovery status to complete prematurely because the counters are incremented by multiple unsynchronized paths, inflating the completed count before all discovery work is actually finished. As a result, discovery_probes_tracker records remain stuck in "In Progress" status even though the parent discovery status has already transitioned to "Completed".Steps to Reproduce 1. Have a discovery schedule with multiple devices containing multiple IPs2. Configure the counting job to run less frequently (e.g., 3 minutes)3. Run the schedule4. Observe that status is completed ahead of timeWorkaroundImportant: After applying these changes, follow the ServiceNow documentation to mark the modified files as "Overwrite on Upgrade": Overwrite Customizations During Upgrades Navigate to System Definition > Script Includes and search for DiscoveryStatusOpen the script include and locate the updateStatusCount functionAdd the following check at the beginning of the function, right after the num = 1; line: // When optimized counting is active for this status, the DiscoveryStatusCounterJob // is the sole authority for counter updates and completion decisions. // Skip direct counter increments and BR triggers to prevent race conditions // (e.g., duplicate IP processing inflating the completed count prematurely). var statusGr = new GlideRecord('discovery_status'); if (statusGr.get('sys_id', statusId) && statusGr.scratchpad && statusGr.scratchpad.isOptimizedCounting) return; Navigate to System Definition > Business Rules and search for Discovery - CompleteOpen the business rule and add the following check at the beginning of the checkComplete() function: // When optimized counting is active, DiscoveryStatusMonitor is the sole authority // for completing the status. Skip this BR to prevent premature completion caused by // counter inflation from duplicate IP processing or other unsynchronized paths. if (current.scratchpad && current.scratchpad.isOptimizedCounting) return; Save both changes and follow the documentation link above to mark them as "Overwrite on Upgrade"Related Problem: PRB1988150