The problem
Redirect loops are hard to spot in the router timeline.
- The route lint already flags redirect cycles in the config (
redirectTo pointing back and forth).
- The timeline shows "redirected from #N" on each navigation, so you can follow a chain by hand.
What neither catches is a loop made by guards. For example, an auth guard sends /account to /login, and a guard on /login sends a signed-in user back to /account. Each hop looks normal on its own, and the timeline just fills up with navigations.
What we need
- Detect loops at runtime: follow
redirectedFrom through recent navigations and flag a chain where the same URL shows up twice.
- Show it in the timeline: mark the navigations in the loop, show the chain (
/account → /login → /account), and name the guard or redirectTo behind each hop when it's known.
- Lint: add a
redirect-loop finding with the chain and the guards involved.
- MCP: include the loop in
explain-navigation and export-navigation, and in the lint tool, so agents can explain it.
- Tests: a guard-to-guard loop, a
redirectTo loop, and a long chain that isn't a loop (no false positives).
Notes
- Guard results are recorded when router recording is on (on by default in dev), so the chain can say which guard redirected.
- Angular stops real infinite loops with NG04016; this should catch the loop before that point too, including loops that end after a few bounces.
The problem
Redirect loops are hard to spot in the router timeline.
redirectTopointing back and forth).What neither catches is a loop made by guards. For example, an auth guard sends
/accountto/login, and a guard on/loginsends a signed-in user back to/account. Each hop looks normal on its own, and the timeline just fills up with navigations.What we need
redirectedFromthrough recent navigations and flag a chain where the same URL shows up twice./account → /login → /account), and name the guard orredirectTobehind each hop when it's known.redirect-loopfinding with the chain and the guards involved.explain-navigationandexport-navigation, and in the lint tool, so agents can explain it.redirectToloop, and a long chain that isn't a loop (no false positives).Notes