Skip to content

fix(browser): resolve context canceled errors on Windows#1168

Open
egany wants to merge 1 commit into
nextlevelbuilder:mainfrom
egany:fix/browser-tool-windows-context-handling
Open

fix(browser): resolve context canceled errors on Windows#1168
egany wants to merge 1 commit into
nextlevelbuilder:mainfrom
egany:fix/browser-tool-windows-context-handling

Conversation

@egany

@egany egany commented May 22, 2026

Copy link
Copy Markdown

Summary

  • Fix browser tool failing with context canceled errors on Windows
  • Root cause: browser object was bound to short-lived connect context that expired after Start() returned
  • Add Microsoft Edge auto-detection as fallback browser
  • Add Windows troubleshooting documentation

Changes

File Description
pkg/browser/browser.go Use goroutine + channel for connect timeout, Edge support, isolated profile
pkg/browser/browser_tabs.go WaitLoad instead of WaitStable, blank page creation
pkg/browser/browser_page.go WaitLoad for Navigate
cmd/gateway_setup.go Read leakless config
internal/config/config_channels.go Add Leakless field
docs/browser-tool-windows-troubleshooting.md Full troubleshooting guide
AGENTS.md Windows development setup

Test Plan

  • Standalone go-rod test passes on Windows
  • GoClaw browser tool loads vnexpress.net successfully
  • Edge auto-detected and used as browser
  • No more context canceled errors

Root cause: Browser object was bound to a short-lived connect context that expired after Start() returned, causing all subsequent operations to fail instantly with context canceled.

Changes:
- Use goroutine + channel for connect timeout instead of binding context
- Add Microsoft Edge auto-detection as fallback browser
- Add isolated user data directory to avoid profile conflicts
- Add leakless config option (disabled by default on Windows)
- Change WaitStable to WaitLoad for more reliable page loading
- Add Windows troubleshooting documentation

Tested on Windows 10 Pro with Edge, successfully loads vnexpress.net.
@egany egany force-pushed the fix/browser-tool-windows-context-handling branch from 1cecfb6 to 23affa2 Compare May 22, 2026 17:09

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

Summary: I reviewed this Windows browser context-canceled fix. The root-cause direction is valid, but this PR is not mergeable yet and has one implementation issue that should be fixed before merge.

Findings:

  • Important: The PR is currently merge-conflicted (mergeStateStatus=DIRTY) and has no reported CI checks on the branch, so it cannot be merged from the bounded maintainer lane.
  • Important: pkg/browser/browser.go now uses a fixed profile path under os.TempDir()/goclaw-browser-profile for every local browser launch. That creates cross-run/profile lock contention and can leak cookies/session state between browser manager restarts. Please use a per-manager/per-process temp directory and clean it up with the launcher lifecycle, or let rod/launcher create an isolated profile.

Gates:

  • Duplicate/prior implementation: no duplicate PR/issue found for this exact Windows context-canceled fix.
  • Project standards: existing browser manager structure found; the fix is in the right area.
  • Strategic necessity: clear value, especially given related browser-context-canceled reports.

Verdict: Request changes. Resolve conflicts, restore CI, and replace the global user-data-dir with an isolated lifecycle-scoped profile before this can be approved.

@mrgoonie mrgoonie added agent:github-maintain Processed by github-maintain automation maintain:triaged Triaged by maintain workflow status:blocked Blocked by external dependency or decision labels Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:github-maintain Processed by github-maintain automation maintain:triaged Triaged by maintain workflow status:blocked Blocked by external dependency or decision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants