Skip to content

fix: keep restored Usage navigation from being replaced by Chat - #137402

Merged
steipete merged 2 commits into
mainfrom
codex/qa-usage-remembered-route-20260903
Sep 4, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/qa-usage-remembered-route-20260903

Conversation

@steipete

@steipete steipete commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Closes #137391

What Problem This Solves

Fixes an issue where the native dashboard briefly restored remembered Usage, then jumped back to Chat during startup.

Why This Change Was Made

An earlier router subscriber can start another navigation while a not-found notification is still being delivered. The outlet consumed the obsolete outer snapshot after seeing the newer navigation and queued Chat recovery. It now reads the router's current state on notification, using its existing publication comparison instead of a second selector comparison.

This repairs the shared route-presentation owner. Native route memory, explicit deep links, first-run setup, pending-page retention and recovery readiness retain their existing policies. No dependency or persistent preference changes.

User Impact

Remembered Usage stays open. A navigation started by an earlier subscriber is no longer overwritten by recovery from a superseded route.

Evidence

Final exact-head CI run passed.

  • A regression using the real @openclaw/uirouter 0.1.1 fails on main with an obsolete not-found callback while the replacement route is already loading; it passes after the repair.
  • 118 focused tests across eight files pass, covering outlet timing/reconnection, retained views, native memory, deleted-session recovery and bootstrap precedence.
  • The identical preserved-bundle browser probe goes from 2/3 to 3/3 passing contracts: remembered Usage, invalid stored route and explicit deep link. No page or console errors in the final before/after runs.
  • Both canonical UI builds pass; independent Codex autoreview is clean through P2.
  • Production LOC: +4/−15 (−11 net). Tests: +52. Docs: +5.

Live Gateway verification now passes on the exact head in explicitly authorized isolated Chromium. The Gateway uses canonical synthetic SQLite sessions, the real connection/route lifecycle, and its production UI; no transport mocking or provider calls. Document-start native bridge markers are simulated. This is not a signed macOS/WebKit application test.

Entry with remembered Usage Baseline Fixed head
Default /chat Ends /chat/main; overwrites remembered route to Chat Ends /usage?agent=main; remembers Usage
Explicit /chat/main/qa/usage-openai Exact session URL and recorded transcript retained Exact session URL and recorded transcript retained

All four observations pass with unchanged source/bundles and verified served JavaScript hashes. The remembered-route cases have zero page, console or HTTP errors. Each explicit-session control records one intentional missing-workspace-icon 404 and verifies the documented visible folder fallback; there are no unexpected errors. The synthetic profile and screenshots were inspected before publication.

Before: remembered Usage is overwritten by Chat

Real Gateway baseline falls back to Chat

After: remembered Usage remains open

Real Gateway candidate retains Usage

Direct dependency inspection confirmed @openclaw/uirouter 0.1.1: installed dist/index.js:204–216 captures next = readState() before iterating its listener set synchronously; dist/index.js:345–354 applies selectors to that delivered snapshot. Source SHA-256: 3f4179f5ff957232e5067142cdb0c40ca3d5cd1c77c006a38be1d52b434b58bb. The real-router regression records this ordering:

outer notFound publication captures its snapshot
  earlier shell subscriber starts Usage navigation
    nested loading publication reaches the outlet
  outer publication resumes and delivers stale notFound
before: router loading, one obsolete recovery callback
 after: router loading, no obsolete recovery callback

Fresh main cd8c74889d21ddcc9f3a2d47fe868224a0e44acb still has the identical outlet owner as the reproduced baseline. The maintainer personally inspected the dependency and current-main source, closing the review environment's source-access gaps.

ClawSweeper disposition: the real Gateway before/after media and direct notification-order evidence above address both rank-up moves and the requested proof/contract follow-ups. The macOS binary remains untested; the user explicitly authorized isolated Chromium for this completion, and the changed owner is the shared browser outlet, with native/setup policy unchanged. The fresh independent complete-branch Codex review is clean through P2. Its evidence resolves the confidence gaps; a new ClawSweeper rating is not an enforced review rule or a prerequisite under the repository's fresh-review policy.

Read current router state when an earlier subscriber starts another navigation during notification. Remove the duplicate selector comparison and retain the outlet presentation and recovery lifecycle.
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: macos App: macos app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 3, 2026, 6:58 PM ET / 22:58 UTC.

ClawSweeper review

What this changes

The PR makes the Control UI route outlet read the router’s current state during notifications so stale not-found recovery cannot replace a remembered Usage page with Chat.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep this maintainer-authored PR open. The focused outlet change and regression test match the linked startup-navigation defect, but merge remains blocked on real macOS/Gateway behavior proof and independent confirmation of the router notification contract.

Priority: P1
Reviewed head: ed0550642b9d3dca04e9cd469177f6faeb48d73a

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused owner-boundary repair and regression test are strong, but real native startup proof and independent router-contract confirmation are still missing.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 6 items Changed owner boundary: The outlet now reads the router’s current state inside its notification subscriber before applying selection, preventing a superseded not-found snapshot from scheduling recovery.
Caller and recovery owner: The shell subscribes to route changes before rendering the outlet; remembered-route restoration starts replacement navigation, while the outlet callback delegates unavailable-route recovery to shell navigation.
Focused regression coverage: The added controller test places an earlier not-found subscriber ahead of the outlet, starts a second navigation, and asserts that recovery is not called while the second route is pending.
Findings None None.
Security None None.

How this fits together

The Control UI router publishes route-state changes to the outlet controller, which renders pending or active pages and recovers unavailable routes. During native dashboard startup, the shell can restore a remembered page before the outlet decides whether recovery is needed.

flowchart LR
  A[Native dashboard startup] --> B[Restore remembered route]
  B --> C[Router notification]
  C --> D[Shell route restoration]
  C --> E[Route outlet controller]
  D --> F[New route navigation]
  F --> E
  E --> G{Current state unavailable?}
  G -->|No| H[Render remembered page]
  G -->|Yes| I[Recover to Chat]
Loading

Before merge

  • Resolve merge risk (P1) - The supplied screenshots explicitly use a simulated native bridge and mocked Gateway, so they do not demonstrate that real macOS dashboard startup retains Usage after this change.
  • Resolve merge risk (P1) - Direct @openclaw/uirouter source and current-main source could not be inspected in this read-only environment; maintainers should confirm the notification-order contract and exact merged behavior before landing.
  • Complete next step (P2) - Attach redacted after-fix real Gateway/macOS Control UI startup evidence and a concrete @openclaw/uirouter 0.1.1 notification-order trace or upstream source citation before merge.
  • Resolve review confidence - ClawSweeper must reach high confidence before merge readiness is known.
Agent review details

Security

None.

PR surface

Source -11, Tests +52, Docs +5. Total +46 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 4 15 -11
Tests 1 52 0 +52
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 61 15 +46

Review metrics

Metric Value Why it matters
Production versus test LOC production +4/-15 (net -11); tests +52; docs +5 The repair removes the duplicate selector comparison while adding one focused ordering regression test and documentation.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #137391
Summary: This PR is the explicit candidate fix for the linked remembered-Usage startup regression.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the generic outlet-level current-state read, then attach redacted real Gateway/macOS startup evidence and the router-contract evidence needed to validate the ordering assumption.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the generic outlet-level current-state read, then attach redacted real Gateway/macOS startup evidence and the router-contract evidence needed to validate the ordering assumption.

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

No independently verified current-main reproduction was possible here: the focused test expresses the exact subscriber-order scenario, but the real router package could not be inspected or run in this read-only environment.

Is this the best way to solve the issue?

Yes, provisionally: the outlet owns not-found recovery and its caller can initiate a newer navigation first, so reading current router state prevents the stale snapshot from driving recovery. Direct router-contract and current-main confirmation remain outstanding.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8c6653a78dec.

Labels

Label justifications:

  • P1: This repairs a Control UI startup regression that can redirect users from their remembered page to Chat.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

What I checked:

  • Changed owner boundary: The outlet now reads the router’s current state inside its notification subscriber before applying selection, preventing a superseded not-found snapshot from scheduling recovery. (ui/src/app/router-outlet-controller.ts:164, ed0550642b9d)
  • Caller and recovery owner: The shell subscribes to route changes before rendering the outlet; remembered-route restoration starts replacement navigation, while the outlet callback delegates unavailable-route recovery to shell navigation. (ui/src/app/app-host.ts:370, ed0550642b9d)
  • Focused regression coverage: The added controller test places an earlier not-found subscriber ahead of the outlet, starts a second navigation, and asserts that recovery is not called while the second route is pending. (ui/src/app/router-outlet-controller.test.ts:232, ed0550642b9d)
  • Introduced-hunk provenance: The PR’s first commit has the verified merge-base as its raw parent, and the raw parent-to-commit diff replaces the selector callback with the current-state subscriber. (ui/src/app/router-outlet-controller.ts:164, c0ffd72caa2c)
  • Dependency signal and review limitation: The changed controller and regression test import @openclaw/uirouter, which is pinned by the UI package. Its installed source was unavailable in this checkout, and network name resolution prevented direct upstream inspection. (ui/package.json:35, ed0550642b9d)
  • Current-main source gap: The fetched current-main revision could not be source-compared because this blobless checkout needed a promisor fetch and GitHub DNS resolution was unavailable. (8c6653a78dec)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach redacted after-fix real Gateway/macOS Control UI evidence showing remembered Usage survives startup.
  • Include a concrete @openclaw/uirouter 0.1.1 subscriber-order trace or an upstream source citation for the notification semantics.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-03T16:40:53.911Z sha ed05506 :: blocked before merge. :: none
  • reviewed 2026-09-03T16:50:03.818Z sha ed05506 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 3, 2026
@steipete
steipete merged commit d2f262a into main Sep 4, 2026
147 checks passed
@steipete
steipete deleted the codex/qa-usage-remembered-route-20260903 branch September 4, 2026 00:51
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 4, 2026
…date-command

* origin/main:
  fix(ci): retry transient npm advisory timeouts (#137716)
  fix: keep restored Usage navigation from being replaced by Chat (#137402)
  fix: keep Usage day totals within the selected session scope (#137396)
  refactor: reduce live digest scheduling allocations (#137655)
  fix(ui): submit selected slash arguments in new sessions (#137571)
  fix(ui): expand collapsed task progress on final (#137569)
  fix(test): prevent auth discovery from stalling MCP replacement proof (#137639)
  test(cli): reuse canonical directory mock call helper (#137640)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
…claw#137402)

Remembered Usage now stays open when dashboard startup starts a replacement navigation inside a router notification. The route outlet reads current router state, preventing an obsolete not-found snapshot from scheduling Chat recovery.

Remove the duplicate selector equality helper and retain the existing presentation/recovery owner. Native route memory, explicit deep links, pending-page retention and first-run setup policy remain unchanged. Net production change: -11 lines.

Verified real uirouter subscriber ordering, failing original-owner regression, 118 sibling tests, fresh independent review and exact-head CI. Real Gateway/production UI browser proof reproduces the baseline Chat overwrite and verifies retained Usage plus explicit-session transcript controls. Native bridge is simulated in explicitly authorized isolated Chromium; the signed macOS/WebKit app was not exercised.

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

Labels

app: macos App: macos app: web-ui App: web-ui docs Improvements or additions to documentation maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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.

Remembered Usage route is overwritten by stale Chat recovery on startup

1 participant