Skip to content

fix(macos): Stop leaves browser tabs loading during navigation startup - #193307

Merged
steipete merged 2 commits into
mainfrom
fix/ci-mac3-1105
Nov 5, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/ci-mac3-1105

Conversation

@steipete

@steipete steipete commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Related: #185432, #191802

What Problem This Solves

Fixes: pressing Stop while a Mac browser tab is starting its next navigation can leave WebKit loading indefinitely instead of keeping the current page.

User Impact

Stop keeps the displayed page even when it arrives before the new navigation starts. Existing cancellation, failed-page Reload, history, and crash recovery remain covered.

Why This Change Was Made

Calling WKWebView.stopLoading() before its queued navigation policy/start callbacks can strand the load. The tab now retains the WKNavigation returned by each native navigation call and applies an early Stop at that navigation's provisional-start callback. Matching identities keep an older callback from retiring a newer request. Already-started loads still stop immediately.

The regression covers both sides of that boundary, waits for real HTTP request arrival for the after-start case, and waits for the asynchronously projected URL before its unchanged final assertions. The old 60-second fixture sleep is replaced with a cancellation-aware gate. Completed same-document navigations retire pending state through WebKit’s loading notification; a fragment-then-page-navigation regression covers this path.

Evidence

  • Original test on main: repetition 14 failed the Stop URL projection assertion (/pending versus WebKit's restored /article).

  • Before: five instrumented Stop-before-start trials timed out. The final regression also failed on unchanged production code; after its original 60-second limit, WebKit still reported isLoading=true, URL /pending.

  • The first review found stale pending state after fragment-only navigation. Its added regression failed at the original limit before the completion cleanup; the final stress run includes it.

  • After: 30 repetitions under four CPU load workers, 150 interruption cases passed, in 87.642 seconds wall time. All 36 tests in eight native-browser/fixture suites passed, 4.153 seconds test time / 5.909 seconds wall time.

  • Real AppKit, WKWebView, native Dashboard controller, and loopback fixtures inside the documented operator-desktop OS sandbox. macOS 27.0.1, Xcode 27.2 beta / Swift 6.4. No app launch/signing, Keychain access, operator Gateway or LaunchAgent changes, or local-model inference. The full loaded CI job itself was not replayed locally.

  • Native build passed. Pinned SwiftFormat passed. Standard SwiftLint reports only the three pre-existing length violations in unchanged DashboardManager.swift and GatewayConnection.swift; changed production files are clean.

  • All baseline ratchets passed on an isolated index of the final committed head. The separate line-cap check passes. No baselines were changed.

  • Production delta +52/-17 (net +35); tests +64/-76 (net -12). The bounded per-tab pending-navigation state is necessary to retain Stop across the observed asynchronous start boundary; no unrelated deletion was used to offset it.

  • Codex autoreview of base d595644b4c6c93b32ede7242bdf2a4f71b8a8c98 through head 7bbaf78a648e8a1b98459a9bb512abb2bed53fef: scoped-clean through P2, verdict patch is correct. The first review’s same-document finding was reproduced and fixed before this clean pass.

  • Exact-head CI passed openclaw/ci-gate, security-fast, native i18n, and docs. The macOS Swift jobs were skipped; native execution evidence above is local. Separate Periphery reports are still building.

  • ClawSweeper returned no verdict during the 15-minute observation window; the hosted review check is canceled. The completed independent Codex review above is clean through P2.

No visual appearance or public configuration changes. #191802's test-only candidate does not repair the demonstrated production race; this PR includes the owner fix and its regression.

Keep the pending WKNavigation in the native tab until its lifecycle callback, so an early Stop cancels that navigation once it starts instead of leaving WebKit loading indefinitely. Preserve immediate Stop for an already started navigation and retire only matching pending identities.

Extend the real WKWebView interruption regression with early Stop and synchronize request arrival and the asynchronous URL projection. Related: #185432.
Use WebKit loading completion to retire same-document requests before later page-initiated navigation. Keep queued URL publication while clearing completed request state at its main-thread notification.

Prove Stop after a fragment navigation, and share the existing article fixture to keep the expanded regression below its original test-line count.
@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@steipete
steipete marked this pull request as ready for review November 5, 2026 08:00
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: macos App: macos size: M labels Nov 5, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T08:02:27.829816Z 7bbaf78 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 5, 2026
@steipete

steipete commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 5, 2026
@clawsweeper

clawsweeper Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR defers an early Stop until the matching WebKit navigation starts and clears completed pending navigation state.

Example: A Mac tab displays /article, starts navigating to /pending, and immediately receives Stop.

  • Before: WebKit can remain loading indefinitely at /pending.
  • After: The matching navigation stops at provisional start, retaining /article without failure UI.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused, coherent repair with meaningful real-WebKit regressions and green exact-head gates; supplied execution evidence remains harness-based rather than a shipped-app demonstration.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its body reports real Dashboard controller and WKWebView regression execution on macOS, while the inspected historical screenshots demonstrate a different load-error scenario.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Pressing Stop while the next native-tab navigation is starting can leave the tab loading indefinitely.
Reason: Restores the existing Stop contract with a focused owner repair; maintainer authorship establishes direction without another product approval.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it addresses a concrete native-browser cancellation failure still present on main, and the reviewed diff introduces no actionable correctness or security finding.

Priority: P2
Reviewed head: 7bbaf78a648e8a1b98459a9bb512abb2bed53fef

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied regression runs do not exercise early Stop through the packaged app’s Browser controls.
Agent review details

How this fits together

The macOS Browser bridge sends navigation actions to DashboardNativeBrowserHost; each DashboardBrowserTab owns its WKWebView lifecycle and publishes navigation state back to the dashboard.

flowchart LR
  A[Browser controls] --> B[Native browser host]
  B --> C[Native tab owner]
  C --> D[WKWebView]
  D --> E[Navigation callbacks and KVO]
  E --> C
  C --> F[Published tab state]
Loading

Technical review

Best possible solution:

Keep pending cancellation in the existing tab owner, match navigation identities, and retire completed same-document requests through WebKit’s existing observation lifecycle.

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

Current main exposes the direct early-stop path, and the PR reports baseline WebKit failures followed by passing stress runs; this read-only review did not execute the reproduction.

Is this the best way to solve the issue?

The repair uses the existing lifecycle owner, preserves immediate Stop after navigation starts, and covers the same-document cleanup needed to prevent stale pending state.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 07fce674fd42.

Provenance checked

  • Native navigation and Stop keeps the original intent (fea4668: Unified native Mac tabs under the Browser panel with native navigation controls and window-owned lifetime.)
  • Failure handling and Reload keeps the original intent (de3936c: Show actionable load failures and retry failed first loads while keeping deliberate cancellation free of failure UI.)
  • Automatic crash recovery and history navigation keeps the original intent (54c9f7a: Bound automatic reloads and reset the per-tab recovery budget on explicit user navigation.)
  • Navigation-state observation keeps the original intent (f72bb2c: Consolidated existing KVO subscriptions while preserving asynchronous state projection.)
  • Favicon lifecycle and shared article fixture keeps the original intent (ea128a1: Preserve the displayed page’s favicon on fragment, failed, and canceled navigations until another document commits.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +35, Tests -12, Docs 0. Total +23 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 52 17 +35
Tests 1 64 76 -12
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 117 94 +23

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
Production versus test LOC Production +52/-17; tests +64/-76 The bounded per-tab navigation identity and Stop flag address an observed asynchronous lifecycle failure; shared fixtures reduce test duplication.

Labels

Label changes:

  • add P2: Stop can strand an individual native browser tab, with limited scope and no demonstrated core-runtime outage or data loss.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Stop can strand an individual native browser tab, with limited scope and no demonstrated core-runtime outage or data loss.
  • 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.

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 5, 2026, 3:22 AM ET / 08:22 UTC.

@steipete
steipete merged commit 91f796d into main Nov 5, 2026
148 of 153 checks passed
@steipete
steipete deleted the fix/ci-mac3-1105 branch November 5, 2026 08:28
@steipete

steipete commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 6, 2026
openclaw#193307)

* fix(macos): settle Stop before browser navigation starts

Keep the pending WKNavigation in the native tab until its lifecycle callback, so an early Stop cancels that navigation once it starts instead of leaving WebKit loading indefinitely. Preserve immediate Stop for an already started navigation and retire only matching pending identities.

Extend the real WKWebView interruption regression with early Stop and synchronize request arrival and the asynchronous URL projection. Related: openclaw#185432.

* fix(macos): retire completed pending browser navigations

Use WebKit loading completion to retire same-document requests before later page-initiated navigation. Keep queued URL publication while clearing completed request state at its main-thread notification.

Prove Stop after a fragment navigation, and share the existing article fixture to keep the expanded regression below its original test-line count.
RomneyDa added a commit that referenced this pull request Nov 13, 2026
Adapt the asynchronous URL projection wait from upstream 91f796d (#193307). Keep the failure UI and URL assertions intact; do not import unrelated navigation changes. Native execution remains pending in release CI.

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
RomneyDa pushed a commit that referenced this pull request Nov 13, 2026
Adapt upstream #193307 (91f796d) to the release browser owner. Track pending navigation identities across native loads and retire them at lifecycle callbacks or same-document completion; defer early Stop until provisional startup.

Keep the existing real WebKit regression and add early Stop and Stop after fragment navigation. The original Stop case failed in FRV 43419749868, macos-swift job 131879740732. Native compile/runtime validation remains pending hosted CI; this Linux host has no Swift, swiftlint, or swiftformat, and local/testbox proof is operator-skipped.

Co-authored-by: RomneyDa <[email protected]>

Co-authored-by: vincentkoc <[email protected]>
(cherry picked from commit 789ae7b28f354f3b2c2b9549ff7cf42e7e6623f2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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