Skip to content

fix(router): keep the joined location when a shared load fails - #112

Open
SebTardif wants to merge 1 commit into
openclaw:mainfrom
SebTardif:fix/joined-nav-location
Open

SebTardif wants to merge 1 commit into
openclaw:mainfrom
SebTardif:fix/joined-nav-location

Conversation

@SebTardif

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: a failed shared navigation leaves the address bar on the latest location while router state shows the first one.

User Impact

User impact: when two navigations to the same route share one load, a loader failure keeps router location, resolved location, the match, and history on the latest location.

Why This Change Was Made

The in-flight run already stores the joined location, and the success path publishes that value. The failure path and the component publish still closed over the first call. Both now publish the joined location.

This failure path has used the first location since the router match loading refactor on 2026-06-20 (f047b64, 153 days). That commit has no linked pull request.

Evidence

Terminal output from node against the built package. The same public calls ran before the patch and after it.

Before, history and the match were ?second=1 while router location and resolved location stayed ?first=1:

$ node proof-f006.mjs
{"history":"?second=1","state":"?first=1","resolved":"?first=1","match":"?second=1","status":"error"}

After, all four agree on ?second=1 and status stays error:

$ node proof-f006.mjs
{"history":"?second=1","state":"?second=1","resolved":"?second=1","match":"?second=1","status":"error"}

Real behavior proof

  • Behavior or issue addressed: A second navigate of the same match joins the in-flight load and pushes the new location. When the loader fails, router location and resolved location went back to the first location.
  • Real environment tested: macOS 27.2.1, Node v26.13.1, package built from this branch.
  • Exact steps or command run after this patch: Start the router on /page?first=1 with a loader that stays pending. Navigate again to /page?second=1 with history push. Reject the loader. Read history, router location, resolved location, match location, and status from the public router API.
  • Evidence after fix: terminal output from the patched package:
$ node proof-f006.mjs
{"history":"?second=1","state":"?second=1","resolved":"?second=1","match":"?second=1","status":"error"}

The same command on the previous package printed state and resolved as ?first=1.

  • Observed result after fix: History, router location, resolved location, and the match all stay on ?second=1. Status is error.
  • What was not tested: A browser history adapter. The run uses the public history push and replace methods.

A second navigate of the same match updates history and the match
location. A loader failure then published the first location on the
router. Publish the joined location on that path, matching success.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
@SebTardif
SebTardif requested a review from a team as a code owner November 20, 2026 12:59
@clawsweeper

clawsweeper Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 20, 2026
@clawsweeper

clawsweeper Bot commented Nov 20, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

Publish the latest joined navigation location when its component becomes available or its shared load fails.

Example: Start loading /page?first=1, navigate to /page?second=1 with the same match identity, then reject the loader.

  • Before: History and the match retain ?second=1, but router location and resolved location revert to ?first=1.
  • After: All four retain ?second=1 while router status remains error.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct repair supported by package-level before-and-after output, meaningful regression coverage, and successful checks on the reviewed head.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The contributor records Node output from the built package's public router API on macOS: start at ?first=1, join at ?second=1, reject the loader, and observe history, state, resolved location, and match all retain ?second=1 with error status; a browser adapter is outside this package's ownership.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: After two same-match navigations share a failing load, the address bar can show the latest URL while router state reports the earlier URL.
Reason: Restores consistency using existing state and preserves the documented same-match sharing behavior without adding an option or API.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a current-main location mismatch with a focused change, useful regression coverage, and built-package proof; no actionable defects were found.

Priority: P2
Reviewed head: d3762ec34e2cc4b47494a98e021816ca32fa9d32

Before merge

None.

Findings

None.

Agent review details

How this fits together

The framework-independent router accepts route definitions, locations, and history adapters, then publishes loading results and observable navigation state.

flowchart LR
  A[Navigation calls] --> B[Match identity]
  B --> C[Shared navigation run]
  C --> D[Component and data loading]
  D --> E[Match store]
  C --> E
  A --> F[History adapter]
  E --> G[Application subscribers]
Loading

Technical review

Best possible solution:

Use the existing navigation run's latest location consistently at component, success, and failure publication.

Do we have a high-confidence way to reproduce the issue?

The current-main join branch updates ongoing.location while the failure branch publishes its captured first location; the contributor's before trace shows that exact mismatch, though this review ran no target code.

Is this the best way to solve the issue?

This is the smallest complete fix for the reported mismatch: reuse the location already owned by NavigationRun and preserve match identity, loading, cancellation, and history-adapter contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5acce8720c86.

Provenance checked

  • Failure location publication keeps the original intent (f047b64: The match-loading refactor introduced shared navigation runs and latest-location success publication; its failure branch retained the first location. GitHub reports no linked PR for that commit.)
  • Early component location publication keeps the original intent (0549932: Publish loaded components before route data finishes; this change preserves that behavior and reads the joined location from the existing run.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current-main defect and existing owner: Joining navigation updates the match and ongoing.location, but the component and failure publications still use the first call's location; successful completion already uses run.location. (src/router.ts:212, 5acce8720c86)
  • Verified introduced change: The production patch changes only the two stale location publications to run.location and adds an unreleased changelog entry. (src/router.ts:317, d3762ec34e2c)
  • Behavioral regression coverage: The added test starts a pending route, joins at ?second=1 with history push, rejects its loader, and checks history, both router locations, match location, and error status. (test/router-navigation.test.ts:153, d3762ec34e2c)
  • Supplied package-entry-point proof: The full PR body records before-and-after Node output from the built package on macOS: the failed joined navigation changes from mismatched locations to all four locations retaining ?second=1. (d3762ec34e2c)
  • Original navigation intent: The scoped historical diff introduces joining through ongoing.location and uses run.location for success, establishing the existing latest-location invariant. Unscoped historical stats encountered unavailable unrelated blobs; scoped router.ts history remained readable. (router.ts, f047b64a87a5)
  • Early component publication intent: The earlier refactor publishes loaded components before data finishes; this PR preserves that timing while correcting the published location. (router.ts, 0549932a6f4f)

Likely related people:

  • Shakker: Raw commit f047b64 adds router.ts:135 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f047b64a87a5; files: router.ts)
  • Vincent Koc: Raw commit dca0722 adds src/router.ts:168 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: dca0722e4865; files: src/router.ts)
  • Sebastien Tardif: Raw commit 5dc5da2 adds src/router.ts:179 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5dc5da240ef7; files: src/router.ts)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Focused patch size Production +2/-2; tests +33/-1; changelog +2 Corrects two existing publication sites without adding production machinery; the test exercises the reported failure through public navigation APIs.

Labels

Label changes:

  • add P2: A failed shared navigation can leave router state inconsistent with history, with a limited trigger and a narrow repair.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: A failed shared navigation can leave router state inconsistent with history, with a limited trigger and a narrow repair.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 20, 2026, 8:12 AM ET / 13:12 UTC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant