No ticket for the real problem: on 2026-11-23 and 24 the WAN was slow or lossy for about 20 hours, and nothing opened a ticket.
A ticket for the fix: the only ticket (Tinker 460506581) came from the reboot that fixed it.
The WAN history shows the owner's AT&T-app reboot, then Smart Power power-cycling the modem at 04:03 and again at 04:09.
That caused two short drops, and UniFi's "WAN failed multiple times" opened the ticket.
What changes
New wan_degraded ticket (P2).
Opens when at least half of the last 2 hours of UniFi WAN-health periods were slow, lossy or down. That needs at least an hour of data, and the share is configurable as modem.degraded_fraction.
Closes with a recovery note once the last 2 hours are at most a quarter bad. The 2-hour exit stops it closing and reopening during a patchy day.
Includes a slow ping from the modem itself, from the logged-in checks, when there is one.
Suggests the Restart modem button.
"WAN connection unstable" waits 10 minutes before deciding. That gives time for the modem's uptime reset to show up. It then opens only if at least 2 drops in the last 24 hours aren't explained by a restart: anything from 5 minutes before to 15 minutes after.
One restart history from three sources:
Smart Power entries from the UniFi log
uptime resets, which catch AT&T-app, modem-button or power-loss reboots
the Restart modem button
Entries within 15 minutes count as one restart.
Both tickets list the last 7 days of restarts and how long each one lasted. After 2 or more restarts in a week they add: "ask AT&T for a replacement BGW320".
Replay against prod's real last 24 hours of WAN health
OPEN 11-23 06:50 (12 of 24 bad), RESOLVE 11-23 18:15
OPEN 11-24 01:30, about 2.5 hours before the owner noticed and rebooted
With a 1-hour exit it closed at 10:00 and reopened at 10:15, which is why the exit is 2 hours. Under the new rule, last night's reboot drops (both inside the 04:03 and 04:09 restart window) would not have opened "unstable".
Also found
Smart Power power-cycles the modem while it's rebooting on purpose. It did this on 11-20 during the restart, and twice on 11-24 after the app reboot. So an intentional reboot turns into two or three power cycles. Worth considering:
lengthening Smart Power's wait before it acts, in UniFi
having the Restart modem button pause it
Not changed here.
Tests
635 passed. flake8 and bandit are clean, and there are no em or en dashes.
TestWanDegraded:
opens after two bad hours
an occasional slow period does nothing
resolves
stays as it is in between
does nothing with no timeline
mentions a slow ping from the modem
TestWanLog:
waits before deciding
drops with no restart open the ticket
reboot drops alone don't
the Gandalf button explains its own drop
the ticket lists restarts and suggests a replacement
test_modem: restart episodes, unexplained drops, the restart lines and replacement hint, and the degradation and recovery thresholds.
Closes #58.
## Why
- **No ticket for the real problem:** on 2026-11-23 and 24 the WAN was slow or lossy for about 20 hours, and nothing opened a ticket.
- **A ticket for the fix:** the only ticket (Tinker 460506581) came from the reboot that fixed it.
- The WAN history shows the owner's AT&T-app reboot, then Smart Power power-cycling the modem at 04:03 and again at 04:09.
- That caused two short drops, and UniFi's "WAN failed multiple times" opened the ticket.
## What changes
- **New `wan_degraded` ticket (P2).**
- **Opens** when at least half of the last 2 hours of UniFi WAN-health periods were slow, lossy or down. That needs at least an hour of data, and the share is configurable as `modem.degraded_fraction`.
- **Closes** with a recovery note once the last 2 hours are at most a quarter bad. The 2-hour exit stops it closing and reopening during a patchy day.
- **Includes** a slow ping from the modem itself, from the logged-in checks, when there is one.
- **Suggests** the Restart modem button.
- **"WAN connection unstable" waits 10 minutes before deciding.** That gives time for the modem's uptime reset to show up. It then opens only if at least 2 drops in the last 24 hours aren't explained by a restart: anything from 5 minutes before to 15 minutes after.
- **One restart history from three sources:**
- Smart Power entries from the UniFi log
- uptime resets, which catch AT&T-app, modem-button or power-loss reboots
- the Restart modem button
Entries within 15 minutes count as one restart.
- **Both tickets list the last 7 days of restarts** and how long each one lasted. After 2 or more restarts in a week they add: "ask AT&T for a replacement BGW320".
## Replay against prod's real last 24 hours of WAN health
- `OPEN 11-23 06:50` (12 of 24 bad), `RESOLVE 11-23 18:15`
- `OPEN 11-24 01:30`, about 2.5 hours before the owner noticed and rebooted
With a 1-hour exit it closed at 10:00 and reopened at 10:15, which is why the exit is 2 hours. Under the new rule, last night's reboot drops (both inside the 04:03 and 04:09 restart window) would not have opened "unstable".
## Also found
Smart Power power-cycles the modem while it's rebooting on purpose. It did this on 11-20 during the restart, and twice on 11-24 after the app reboot. So an intentional reboot turns into two or three power cycles. Worth considering:
- lengthening Smart Power's wait before it acts, in UniFi
- having the Restart modem button pause it
Not changed here.
## Tests
635 passed. flake8 and bandit are clean, and there are no em or en dashes.
- **`TestWanDegraded`:**
- opens after two bad hours
- an occasional slow period does nothing
- resolves
- stays as it is in between
- does nothing with no timeline
- mentions a slow ping from the modem
- **`TestWanLog`:**
- waits before deciding
- drops with no restart open the ticket
- reboot drops alone don't
- the Gandalf button explains its own drop
- the ticket lists restarts and suggests a replacement
- **`test_modem`:** restart episodes, unexplained drops, the restart lines and replacement hint, and the degradation and recovery thresholds.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
On 2026-11-23/24 the WAN was degraded for about 20 hours with no ticket,
and the only ticket came from the owner's reboot fixing it.
- wan_degraded (P2): half or more of the last 2 hours of UniFi WAN health
periods slow, lossy or down. Closes with a recovery note once the last
2 hours are at most a quarter bad. Mentions a slow ping from the modem.
- "WAN connection unstable" waits 10 minutes, then counts only drops that
no modem restart explains (Smart Power, uptime reset, or the Restart
modem button, folded into one restart when within 15 minutes).
- Both list the last 7 days of restarts and how long each lasted, and
suggest asking AT&T for a replacement after 2+ restarts in a week.
Closes#58
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only health periods from 15 minutes after the latest restart count, so a
slowdown the restart fixed neither opens a ticket on deploy nor holds one
open. Replay: opens 11-24 01:30, resolves 04:20 after the reboot.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-up commit: a modem restart resets the degraded check.
The bug it fixes: the 2-hour window still held the bad stretch from before last night's reboot. Deploying would have opened a "degraded" ticket straight away for a problem already fixed.
The change: only WAN-health periods from 15 minutes after the latest restart now count. This also closes an open degraded alert soon after a restart, which #58 asked for.
Replay with real WAN history and restarts:
Event
Time
Open
11-23 06:50
Resolve
11-23 18:15
Open
11-24 01:30
Resolve
11-24 04:20 (after the reboot)
Nothing is open now, so deploying won't cut a ticket. 636 tests pass.
**Follow-up commit: a modem restart resets the degraded check.**
**The bug it fixes:** the 2-hour window still held the bad stretch from before last night's reboot. Deploying would have opened a "degraded" ticket straight away for a problem already fixed.
**The change:** only WAN-health periods from 15 minutes after the latest restart now count. This also closes an open degraded alert soon after a restart, which #58 asked for.
**Replay with real WAN history and restarts:**
| Event | Time |
|---|---|
| Open | 11-23 06:50 |
| Resolve | 11-23 18:15 |
| Open | 11-24 01:30 |
| Resolve | 11-24 04:20 (after the reboot) |
Nothing is open now, so deploying won't cut a ticket. 636 tests pass.
jared
scheduled this pull request to auto merge when all checks succeed 2026-11-23 23:56:42 -05:00
jared
merged commit a7792063ba into main2026-11-23 23:58:12 -05:00
jared
deleted branch wan-degradation2026-11-23 23:58:16 -05:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #58.
Why
What changes
New
wan_degradedticket (P2).modem.degraded_fraction."WAN connection unstable" waits 10 minutes before deciding. That gives time for the modem's uptime reset to show up. It then opens only if at least 2 drops in the last 24 hours aren't explained by a restart: anything from 5 minutes before to 15 minutes after.
One restart history from three sources:
Entries within 15 minutes count as one restart.
Both tickets list the last 7 days of restarts and how long each one lasted. After 2 or more restarts in a week they add: "ask AT&T for a replacement BGW320".
Replay against prod's real last 24 hours of WAN health
OPEN 11-23 06:50(12 of 24 bad),RESOLVE 11-23 18:15OPEN 11-24 01:30, about 2.5 hours before the owner noticed and rebootedWith a 1-hour exit it closed at 10:00 and reopened at 10:15, which is why the exit is 2 hours. Under the new rule, last night's reboot drops (both inside the 04:03 and 04:09 restart window) would not have opened "unstable".
Also found
Smart Power power-cycles the modem while it's rebooting on purpose. It did this on 11-20 during the restart, and twice on 11-24 after the app reboot. So an intentional reboot turns into two or three power cycles. Worth considering:
Not changed here.
Tests
635 passed. flake8 and bandit are clean, and there are no em or en dashes.
TestWanDegraded:TestWanLog:test_modem: restart episodes, unexplained drops, the restart lines and replacement hint, and the degradation and recovery thresholds.🤖 Generated with Claude Code
Follow-up commit: a modem restart resets the degraded check.
The bug it fixes: the 2-hour window still held the bad stretch from before last night's reboot. Deploying would have opened a "degraded" ticket straight away for a problem already fixed.
The change: only WAN-health periods from 15 minutes after the latest restart now count. This also closes an open degraded alert soon after a restart, which #58 asked for.
Replay with real WAN history and restarts:
Nothing is open now, so deploying won't cut a ticket. 636 tests pass.