None of the InteractiveBrowser methods (Navigate, Screenshot, Cookies, MouseClick, etc.) accept a context.Context or have timeouts. If the Playwright process crashes or the remote server becomes unresponsive, these operations block forever.
This is a significant issue for the captcha proxy system in Mort, where a hung Playwright operation causes the entire captcha session to appear frozen. The user sees a stalled browser with no recourse but restarting the bot.
Current Workaround
A watchdog timer in the captcha proxy's screenshot loop detects when no successful screenshot has been produced for 30 seconds and force-closes the session. This is a blunt workaround — ideally each operation would respect a context/timeout natively.
Proposed Change
Add context.Context as the first parameter to InteractiveBrowser methods, or add timeout variants:
This would be a breaking API change. An alternative is adding a SetTimeout(d time.Duration) method or a WithContext(ctx context.Context) InteractiveBrowser wrapper.
Related
Filed from mort issue steve/mort#1159 (captcha proxy reliability overhaul, Bug 4).
## Problem
None of the `InteractiveBrowser` methods (`Navigate`, `Screenshot`, `Cookies`, `MouseClick`, etc.) accept a `context.Context` or have timeouts. If the Playwright process crashes or the remote server becomes unresponsive, these operations block forever.
This is a significant issue for the captcha proxy system in Mort, where a hung Playwright operation causes the entire captcha session to appear frozen. The user sees a stalled browser with no recourse but restarting the bot.
## Current Workaround
A watchdog timer in the captcha proxy's screenshot loop detects when no successful screenshot has been produced for 30 seconds and force-closes the session. This is a blunt workaround — ideally each operation would respect a context/timeout natively.
## Proposed Change
Add `context.Context` as the first parameter to `InteractiveBrowser` methods, or add timeout variants:
```go
type InteractiveBrowser interface {
Navigate(ctx context.Context, url string) (string, error)
Screenshot(ctx context.Context, quality int) ([]byte, error)
Cookies(ctx context.Context) ([]Cookie, error)
MouseClick(ctx context.Context, x, y float64, button string) error
// ... etc
}
```
This would be a breaking API change. An alternative is adding a `SetTimeout(d time.Duration)` method or a `WithContext(ctx context.Context) InteractiveBrowser` wrapper.
## Related
Filed from mort issue https://gitea.stevedudenhoeffer.com/steve/mort/issues/1159 (captcha proxy reliability overhaul, Bug 4).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
None of the
InteractiveBrowsermethods (Navigate,Screenshot,Cookies,MouseClick, etc.) accept acontext.Contextor have timeouts. If the Playwright process crashes or the remote server becomes unresponsive, these operations block forever.This is a significant issue for the captcha proxy system in Mort, where a hung Playwright operation causes the entire captcha session to appear frozen. The user sees a stalled browser with no recourse but restarting the bot.
Current Workaround
A watchdog timer in the captcha proxy's screenshot loop detects when no successful screenshot has been produced for 30 seconds and force-closes the session. This is a blunt workaround — ideally each operation would respect a context/timeout natively.
Proposed Change
Add
context.Contextas the first parameter toInteractiveBrowsermethods, or add timeout variants:This would be a breaking API change. An alternative is adding a
SetTimeout(d time.Duration)method or aWithContext(ctx context.Context) InteractiveBrowserwrapper.Related
Filed from mort issue steve/mort#1159 (captcha proxy reliability overhaul, Bug 4).