Skip to content

fix(router): preserve joined navigation and clear expired timers - #112

Merged
steipete merged 1 commit into
openclaw:mainfrom
SebTardif:fix/joined-nav-location
Nov 21, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
SebTardif:fix/joined-nav-location

Conversation

@SebTardif

@SebTardif SebTardif commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Shared navigation loads can publish an old URL after a second navigation joins them. A preloaded route that immediately expires can also leave an armed retention timer after stop().

User Impact

History, active matches, and resolved locations now stay aligned with the latest joined navigation, including while the component becomes visible and when loading fails. Stopping the router clears expired preload timers. Public exports, runtime engines, and zero-runtime-dependency packaging are preserved.

Why This Change Was Made

Finish the fixes from this PR and #114 together: publication uses the inflight navigation's latest location, and immediate cache expiry cancels its previous timer before forgetting it. Refresh eligible development dependencies, including #120, while keeping the two-day release-age policy.

Evidence

Both original regression tests fail on main and pass with the fixes; a third regression covers component publication before the loader settles. Independent P0–P2 review with full source context is clean. The complete package gate covers formatting, build, types, lint, all tests, and packed-package import validation.

Thanks @SebTardif for both fixes and @dependabot[bot] for the dependency update.

Related: #114, #120.

@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.

Finish shared-load URL publication and immediate cache-expiry cleanup, with regression coverage. Refresh eligible development dependencies while preserving the release-age policy and runtime contract.

Co-authored-by: Sebastien Tardif <sebtardif@ncf.ca>
@steipete
steipete force-pushed the fix/joined-nav-location branch from d3762ec to 64eed84 Compare November 21, 2026 02:42
@steipete steipete changed the title fix(router): keep the joined location when a shared load fails fix(router): preserve joined navigation and clear expired timers Nov 21, 2026

@steipete steipete left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both original regressions reproduced before the fixes. Full package gate (83 tests and packed import), independent P0–P2 review, and exact-head Linux/macOS/Windows CI passed.

@steipete
steipete merged commit 760e341 into openclaw:main Nov 21, 2026
10 of 11 checks passed
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.

2 participants