Skip to content

fix(test): Edge startup intermittently blocks Gateway route proof - #2049

Merged
shanselman merged 3 commits into
openclaw:mainfrom
karkarl:karkarl-fix-edge-e2e-startup
Nov 11, 2026
Merged

shanselman merged 3 commits into
openclaw:mainfrom
karkarl:karkarl-fix-edge-e2e-startup

Conversation

@karkarl

@karkarl karkarl commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes intermittent Edge startup stalls that block the released-Gateway search/Dashboard E2E proof and alpha release validation before either Dashboard route is visited.

User Impact

No product UI or runtime change. Developers get a smaller browser startup path and sanitized failure-stage diagnostics. The intermittent runner trigger was not reproduced locally; one passing hosted replay is evidence, not proof that all intermittent failures are eliminated.

Why This Change Was Made

Discover and connect directly to the initial about:blank page launched inside the unique owned Edge profile. This removes the browser-level WebSocket, second-target creation and flattened attachment where failures were observed.

Keep the existing 30-second budget, owned-process cleanup, browser-profile artifact exclusions, authenticated handshake observation and strict route assertions. Loopback discovery disables proxies and redirects and validates the page endpoint. Drain stderr with a fixed buffer and report only coarse startup facts, never raw browser output or URLs. Fixture-free discovery regressions and an opt-in real Edge evaluation/PNG smoke run under the existing hosted setup/connect filter.

Evidence

Current-head hosted setup/connect proof: 63 passed, 7 unrelated skips. The exact previously failing test passed in 14 seconds; Edge page CDP was ready in 1,864ms and both authenticated / and /skills routes rendered. All 10 new startup cases passed.

The overall run is failed, not green: CurrentModel_NativeUiaRespectsActionAvailability(disabled: True) expected an exact COMException but received ElementNotAvailableException. The user reports that a separate session is fixing this unrelated UI test; it is deliberately not changed here. CI Gate also failed as a consequence.

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required proof pools

  • none: test-only Edge adapter and documentation change. The existing hosted WSL setup/connect lane directly exercises the changed browser path; no product setup, pairing, node command, native UI or custom-host capability changes.

Validation

Local final source corresponds to commit c9409d52c5f02a179e68b417725011801bba68c8. OPENCLAW_REPO_ROOT pointed at the task worktree; Shared/Tray used task-isolated OPENCLAW_TRAY_DATA_DIR. Both test projects were built first to prevent fresh-worktree no-op results.

  • .\build.ps1: passed, all five projects, host default win-arm64.
  • dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: passed, 4,867 passed, 24 existing skips, 0 failed.
  • dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: passed, 5,234 passed, 0 skipped/failed.
  • With scoped OPENCLAW_RUN_E2E=1, dotnet test .\tests\OpenClaw.E2ETests\OpenClaw.E2ETests.csproj --no-restore --filter 'FullyQualifiedName~SetupAndConnectTestsBrowserStartup|FullyQualifiedName~SetupAndConnectTestsArtifactPolicy': passed, 19 passed, 0 skipped/failed, including native Edge and browser-profile exclusion.
  • .\scripts\validate-docs.ps1: passed, 72 Markdown files.
  • .\scripts\validate-agent-skills.ps1: passed, 16 skills and 25 Markdown files.
  • .\scripts\test-agent-skills-validator.ps1: passed, 27 fixtures plus repository skills.
  • git diff --check: passed.
  • Branch CI at this exact commit: setup/connect, recovery, core, tray, release builds and MSIX jobs passed; overall failure is the separate UI test described above. No alpha tag or release was published.

Author simplification pass retained the single adapter, bounded diagnostics and distinct endpoint/cancellation/native-browser regressions. Independent review was not run; this is test harness work, not a change to product UI, setup, permissions or diagnostics. No independent review approval is claimed.

Real Behavior Proof

  • Environment tested: hosted Windows x64 WSL Gateway setup/connect lane; local Windows ARM64 host, x64 .NET test host, Edge 157.0.4341.42.
  • PR head or commit tested: c9409d52c5f02a179e68b417725011801bba68c8, branch workflow dispatch, attempt 1.
  • Exact steps or command run: hosted .\scripts\Invoke-CiE2e.ps1 -Name setup-connect -Filter "FullyQualifiedName~OpenClaw.E2ETests.Setup.SetupAndConnectTests|FullyQualifiedName~OpenClaw.E2ETests.Setup.MxcSetupAndConnectTests|FullyQualifiedName~OpenClaw.E2ETests.Setup.MirroredWslPortLeaseTests|FullyQualifiedName~OpenClaw.E2ETests.Setup.SshOwnershipAdversarialProofTests|FullyQualifiedName~OpenClaw.E2ETests.Setup.TrayExecutableResolutionTests" with OPENCLAW_RUN_E2E=1.
  • Evidence after fix: [Search proof] Edge page CDP ready in 1864ms., authenticated browser rendered /., authenticated browser rendered /skills., and ReleasedGateway_SearchDenialAndDashboardRoutes [14 s] passed.
  • Observed result: real authenticated Dashboard routes passed through the changed adapter; all 10 startup cases passed. Ten baseline and ten final standalone local startup/evaluation replays also passed.
  • Screenshot or artifact links verified? (Yes/No/N/A): Yes. Hosted job/log linked above; e2e-test-results-setup-connect artifact ID 13542105076 exists and is not expired. Screenshot pixels were not separately inspected.
  • Not verified or blocked: original intermittent runner trigger remains unproven; baseline startup did not fail locally. Overall CI is blocked by the unrelated onboarding UI test. Tag-only signing/release publication was not exercised. No native packaged-Gateway or full custom proof-pool acceptance is claimed.

Security Impact

  • New permissions or capabilities? (Yes/No): No
  • Secrets or tokens handling changed? (Yes/No): No
  • New or changed network calls? (Yes/No): Yes
  • Command or tool execution surface changed? (Yes/No): No
  • Data access scope changed? (Yes/No): No
  • If any answer is Yes, explain the risk and mitigation: test-only /json/list discovery and direct page CDP use the owned loopback debugger. Proxies and redirects are disabled; the page endpoint must match host/port/path and contain no user info, query or fragment. Credentials remain off command lines; raw stderr, profiles and credential-bearing URLs are not emitted.

Compatibility and Migration

  • Backward compatible? (Yes/No): Yes
  • Config or environment changes? (Yes/No): No
  • Migration needed? (Yes/No): No
  • If yes, list the exact upgrade steps: N/A

Review Conversations

  • I replied to or resolved every bot review conversation addressed by this PR.
  • I left unresolved only conversations that still need maintainer judgment.

@clawsweeper

clawsweeper Bot commented Nov 6, 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. clawsweeper:intake:needs-repro 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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 6, 2026
@clawsweeper

clawsweeper Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR connects Gateway browser proof directly to Edge’s initial page and adds bounded startup diagnostics and focused coverage.

Example: The released-Gateway proof opens authenticated Dashboard routes / and /skills.

  • Before: Startup creates and attaches a second browser target before either route can run.
  • After: Startup discovers the owned about:blank page and connects directly; the supplied hosted output reports both routes rendered.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, focused harness repair with real browser/Gateway evidence and no actionable findings; elimination of the intermittent trigger remains unproven.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): At c9409d5, supplied hosted Windows output exercises the changed adapter with real Edge and the released WSL Gateway, reporting authenticated / and /skills rendering; exact-head job success and artifact identity were verified, while raw logs were inaccessible through the sandbox allowlist.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Developers can lose Gateway route validation to intermittent browser startup stalls before either Dashboard route is visited.
Reason: Maintainer-authored direction is established, and the focused change reduces startup machinery while retaining strict proof assertions.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it provides a focused, maintainer-authored improvement that current main lacks, with no actionable correctness findings.

Priority: P2
Reviewed head: c9409d52c5f02a179e68b417725011801bba68c8

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: A deterministic failing-base/passing-head reproduction of the original intermittent startup stall is not shown and is explicitly disclosed.
Agent review details

How this fits together

The E2E browser adapter launches isolated headless Edge, sends CDP commands, observes Gateway authentication, and captures route screenshots.

flowchart LR
  A[Setup connect proof] --> B[Owned Edge profile]
  B --> C[Loopback page discovery]
  C --> D[Direct page CDP]
  D --> E[Released Gateway Dashboard]
  E --> F[Authentication and route assertions]
Loading

Technical review

Best possible solution:

Retain the direct-page change in the existing adapter and preserve its authentication, endpoint-isolation, timeout, and cleanup contracts.

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

There is no deterministic reproduction of the intermittent stall: the author explicitly reports passing baseline replays and an unproven original trigger.

Is this the best way to solve the issue?

The patch is a proportionate simplification: it removes second-target creation and attachment from the existing owner without weakening the downstream proof.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Browser target discovery and attachment changes intended behavior with a stated reason (4ea07e8: The original feature deliberately created a dedicated browser target instead of relying on page-list discovery or a single startup tab.)
  • Browser stderr collection keeps the original intent (4ea07e8: The adapter drained redirected stderr while owning the browser lifetime; the patch preserves draining and replaces retained raw text with a bounded buffer and character count.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Barbara Kudiess: Raw commit 4ea07e8 adds tests/OpenClaw.E2ETests/Setup/GatewaySearchBrowserProof.cs:33 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4ea07e858b81; files: tests/OpenClaw.E2ETests/Setup/GatewaySearchBrowserProof.cs)

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
Change footprint Product code: 0; test harness and tests: +167/-11; docs: +13 Growth stays within the existing adapter and distinct readiness, endpoint-isolation, cancellation, and native-browser coverage.

Labels

Label changes:

  • add P2: Improves internal Gateway proof reliability with limited blast radius and no product runtime change.
  • 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 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Improves internal Gateway proof reliability with limited blast radius and no product runtime change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • 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 6, 2026, 5:43 PM ET / 22:43 UTC.

@roboclaw-bot

Copy link
Copy Markdown
Contributor

PR cleanup review

Reviewed head: 8ee4b4e68678b410c9f04045023826f06b80d413. Main comparison: e59374c064f43d68f5c72d070d4c89ef2d20ec3b.

Thanks for keeping the browser change focused. The direct-page startup is still missing from main. Current main also gained WaitForEndpointAsync in #2066 to handle partial/locked DevToolsActivePort publication, so this branch needs a small integration update that preserves that helper while retaining the direct-page connection and bounded diagnostics. The body currently cites c9409d5, before the cleanup follow-up at 8ee4b4e. Please refresh focused startup and authenticated-route evidence on the integrated head; I would prioritize this as a bounded repair rather than close it as superseded.

Action in this cleanup pass: leaving this PR open. No branch changes or runtime-proof waiver. The findings above come from source, discussion and recorded-CI review; Windows validation was not rerun in this pass.

Keep main's WaitForEndpointAsync (tolerates a partial or locked DevToolsActivePort, openclaw#2066) together with this branch's direct about:blank page connection and bounded startup diagnostics. The browser-level session id is no longer needed because the socket attaches to the page itself.

Co-authored-by: Copilot App <[email protected]>
@shanselman

shanselman commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Hi @karkarl. I'm a Copilot triage agent working through PRs for Scott overnight (not Scott himself).

main had moved and this branch had a conflict in tests/OpenClaw.E2ETests/Setup/GatewaySearchBrowserProof.cs. The roboclaw-bot review asked for exactly this integration, so I merged origin/main into your branch and pushed it as a fast-forward (8ee4b4e6..6991dba7). It is a merge commit only; none of your commits changed.

How I resolved it: StartAsync keeps main's WaitForEndpointAsync(portFile, () => browser._process.HasExited, timeout.Token), builds the debugger origin, then uses your WaitForPageEndpointAsync and connects straight to the about:blank page endpoint before Network.enable. Both helpers stay. _sessionId goes away because the page socket no longer needs it.

Local check on the merged head (Windows ARM64, separate worktree, isolated Tray data dir):

  • Focused browser-startup and search-proof E2E tests: 20 passed, 0 failed, 0 skipped.
  • ./build.ps1: succeeded.
  • Shared tests: 5761 passed, 0 failed, 27 skipped.
  • Tray tests: 6276 passed, 0 failed.

Update: CI Gate came back green on 6991dba7 (every job completed, none failing) and the PR had no open review requests, so I squash-merged it as d6f8a885. Thank you for the Edge startup fix, Karen. If anything looks off on main after this, tell me and I will help sort it out.

@shanselman
shanselman merged commit d6f8a88 into openclaw:main Nov 11, 2026
26 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.

3 participants