Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 11, 2026, 10:49 AM ET / 14:49 UTC (Revision 17). ClawSweeper reviewWhat this changesAdds shared cycle detection and a ten-hop limit to loader redirects during navigation and cache preloading, with documentation and regression tests. Merge readiness⛔ Blocked before merge - 3 items remain This remains a useful, focused fix: current main and v0.1.1 still follow redirects without a bound. The supplied runtime evidence supports the implementation, and no blocking code defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe standalone UI router consumes application route definitions, loader results, and history locations. It follows redirects and exposes active-route or cached-match state for applications to present. flowchart TD
A[Navigation or preload request] --> B[Route matching and loading]
B --> C{Loader redirects?}
C -->|No| D[Active route or cached result]
C -->|Yes| E{Repeated location or over ten hops?}
E -->|No| B
E -->|Yes| F[Reject redirect chain]
Decision needed
Why: The implementation and runtime proof establish the behavior, but cannot establish which existing consumer chains the package must continue supporting. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use one bounded redirect policy for navigation and preload, with an approved ceiling and explicit upgrade guidance for longer-chain consumers. Do we have a high-confidence way to reproduce the issue? Yes: two loaders redirecting to each other enter unbounded follow paths on current main. Source establishes the mechanism, and the contributor supplies a before/after Node trace; this read-only review did not execute it. Is this the best way to solve the issue? Yes for the implementation approach: one shared guard covers both follow paths without widening the public API. The precise ten-hop compatibility policy still needs approval. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ea06377b0e80. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (16 earlier review cycles; latest 8 shown)
|
Loader redirect() follows had no hop budget or cycle set, so A to B to A recursed in handleLocation and preload until hang or heap exhaustion. Cap follows at 10 hops, reject repeated locations, and throw a clear error on both navigation and preload paths. Signed-off-by: Sebastien Tardif <[email protected]>
8c45e1b to
ef42948
Compare
What Problem This Solves
Fixes an issue where consumers whose loaders return
redirect()in a cycle (A to B to A) or a long chain would hang the tab or exhaust the heap. Navigation (handleLocation) andpreloadRoute/preloadLocationboth followed loader redirects with no hop budget and no seen-location set.Why This Change Was Made
Both follow paths now share one internal budget: at most 10 hops, and a location may appear only once. A cycle or an 11th hop throws a clear
Error(Redirect cycle detectedorRedirect hop limit of 10 exceeded) and publishesstatus: "error". Finite chains such as A to B to C still resolve. No public exports, types, history adapter shape, or loader signature changed.User Impact
A misconfigured loader cycle fails fast instead of locking the UI. Finite redirect chains still land on the destination. Preload uses the same rules so warming the cache cannot spin either.
Evidence
Live
nodeagainst the builtdist/index.json this branch (8c45e1b), macOS 26.6.1, Node v26.7.0:Before this patch, the same A to B to A
navigategrew until the process hitFATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory(about 23s).pnpm run checkpassed locally (format, build, typecheck, lint, 25 tests, pack/import).The unbounded follow was introduced in
f047b64(2026-06-20,refactor: finalize router match loading). Adjacent but different: #20 (stale navigation cancellation). Same bug class in other routers: TanStack/router#8046.Real behavior proof
Behavior or issue addressed: Loader
redirect()cycles and uncapped hop chains no longer hangnavigateorpreloadRoute. A to B to A throws. A to B to C still lands on C.Real environment tested: macOS 26.6.1 arm64, Node v26.7.0,
@openclaw/uirouterbuilt fromfix/redirect-hop-limitat/tmp/oc-impl-uirouter-redirect(8c45e1b).Exact steps or command run after this patch:
cd /tmp/oc-impl-uirouter-redirect node /tmp/proof-uirouter-redirect.mjsEvidence after fix: terminal output from the patched
dist/index.js:Observed result after fix: A to B to C navigation and preload both resolve to
gamma. A to B to A rejects in 0ms withRedirect cycle detected: /alpha -> /beta -> /alpha.and router statuserror. An 11-hop chain rejects withRedirect hop limit of 10 exceeded while following /hop10 -> /hop11.What was not tested: Browser history adapter clicks, a running OpenClaw UI shell, and custom hop limits (the cap is fixed at 10).