Conversation
History-driven loads were closing over the context passed to start(). navigate and preload already store lastContext for invalidate(); the listener now reads that same value so Back and Forward see the current session or auth context. Signed-off-by: Sebastien Tardif <[email protected]>
|
🦞👀 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 5, 2026, 2:58 PM ET / 18:58 UTC. ClawSweeper reviewWhat this changesHistory-driven navigation uses the latest stored application context, with a regression test and changelog entry. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 3 items remain This remains a useful fix absent from current main and v0.1.1, but the previously reported restart-context defect remains unfixed. The supplied terminal evidence demonstrates the ordinary history-navigation improvement. Priority: P2 Review scores
Verification
How this fits togetherThe standalone router receives application context and locations from navigation calls and application-provided history adapters. It selects routes, runs loaders and lifecycle hooks, and publishes route state for applications to display. flowchart LR
A[Application navigation] --> B[Stored context]
C[History location change] --> D[History listener]
B --> D
D --> E[Route matching and loading]
E --> F[Application route state]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Make each start establish its supplied context before subscribing, while preserving subsequent context updates and the existing loaderDeps identity contract. Do we have a high-confidence way to reproduce the issue? Yes, source establishes both the current-main stale-context mechanism and the introduced restart defect: store one context, then start with another and a synchronously replaying adapter or unmatched initial location. No target code or tests were executed in this read-only review. Is this the best way to solve the issue? The approach is appropriate, but incomplete: reusing the existing context store is narrow and consistent with invalidation, provided start seeds it before any history callback. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ea06377b0e80. LabelsLabel justifications:
EvidenceAcceptance criteria:
What 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 (17 earlier review cycles; latest 8 shown)
|
What Problem This Solves
Fixes an issue where consumers that call
start(history, base, context)and later pass a new session or auth context tonavigateorpreloadwould still run loaders with the originalstartcontext on Back, Forward, or any other history-driven location change. README documents context as session, auth, or DI. After a laternavigate("chat", { userId: "u_2" }), a popstate load still ran asu_1.Why This Change Was Made
invalidate()already reloads withlastContext, whichnavigateandpreloadupdate. The history listener now reads that same stored context (falling back to thestartargument only if nothing has been stored yet). No public exports, types, history adapter shape, or loader signature changed.User Impact
After a session or auth context update, Back and Forward load the current user (or other context value), not the user from the original
start()call. Apps that never change context afterstart()behave as before.Evidence
Live
nodeagainst the builtdist/index.json this branch, macOS 26.6.2, Node v26.7.0. The same public sequence (startasu_1,navigateasu_2, then a history emit to/settings) was run against the unpatched bundle and the patched bundle.Unpatched
dist/index.js(settings loader still seesu_1):Patched
dist/index.js(settings loader seesu_2):pnpm run checkpassed locally (format, typecheck, lint, 21 tests, pack/import).The listener has closed over the
startargument since5042bdc(2026-06-19,refactor: establish router foundation).2260add(2026-06-29) addedlastContextforinvalidate()but did not update the listener. Adjacent but different: #20 (stale navigation cancellation) and #21 (loader redirect hop cap).Real behavior proof
Behavior or issue addressed: History-driven loads (Back, Forward, adapter emit) use the latest
navigateorpreloadcontext, not the context originally passed tostart().Real environment tested: macOS 26.6.2 arm64, Node v26.7.0,
@openclaw/uirouterbuilt fromfix/f002-history-last-contextat/tmp/oc-pr-uirouter-F002.Exact steps or command run after this patch:
cd /tmp/oc-pr-uirouter-F002 node /tmp/proof-uirouter-f002.mjsEvidence after fix: terminal output from the patched
dist/index.js:Observed result after fix: After
start(..., { userId: "u_1" })andnavigate("chat", { userId: "u_2" }), a history emit to/settingsloads settings asu_2. The same command against the unpatched bundle loaded settings asu_1.What was not tested: A browser
popstateadapter in a running OpenClaw UI shell, andloaderDepsthat include the context value (same-route identity changes).