Repository navigation
fix(browser): Browser panel lags behind typing and the live view stutters - #197927
Conversation
Ack each screencast frame once every viewer socket has taken it instead of after a fixed 50 ms. Keep the 50 ms back-off only when every viewer is congested, so capture still never queues frames.
The Control UI browser panel sent every click, key and text insert as its own /act call. Each held the navigation request guard for 250 ms after the action and the panel waited for it, so typing landed at about one character per 265 ms. Add POST /operator/input for the panel. It takes an ordered burst of press, insertText and clickCoords inputs. A tab's operator input shares one guarded interaction (same request fence, download policy, dialog handling and quarantine as /act) while input keeps arriving; the post-action window and final checks run once when it ends. A main-frame navigation request or commit ends the session before any further input, and the next input waits until the guard has checked it. Invocation-bound policies never share a session. The panel sends input typed during an in-flight burst as the next burst and drops queued input after a reported navigation. Agent tools keep /act unchanged.
Lightpanda's engine admission rejected POST /operator/input with BROWSER_CAPABILITY_UNSUPPORTED before the route ran, so the Control UI panel showed an error instead of falling back to one /act per input. Admit the route on Lightpanda and let it answer from profile capabilities: existing-session profiles and profiles without visual actions get OPERATOR_INPUT_UNSUPPORTED, the code the panel falls back on.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR batches Browser-panel input under one navigation guard per request and acknowledges screencast frames after the first viewer’s write completes. Example: Type abcdefghijklmnopqrstuvwxyz1234 at 60 ms intervals in the Browser panel.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR addresses a confirmed Browser-panel backlog that remains on current main. The latest revision removes the long-lived session and deferred-error design behind the previous maintainer question; no blocking defect was found. Exact-head CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Control UI forwards human keyboard and pointer input through browser Gateway routes to Playwright; Chromium screencast frames return through plugin-owned WebSockets to the panel. flowchart LR
A[Browser panel] --> B[Ordered input bursts]
B --> C[Gateway browser admission]
C --> D[Shared interaction guard]
D --> E[Managed Chromium]
E --> F[Screencast session]
F --> A
Technical reviewBest possible solution: Retain the request-scoped burst implementation and delivery-paced screencast, then land through the existing exact-head checks. Do we have a high-confidence way to reproduce the issue? Current-main source establishes response-serialized input and its cumulative guard delay, supported by official-release reports and the contributor’s real-Gateway baseline measurements. Is this the best way to solve the issue? The latest revision is a focused solution: it amortizes the existing guard across ordered inputs without retaining a competing session lifecycle or passing failures to later requests. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d1c800bf9518. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +436, Tests +309, Docs +20. Total +765 across 20 files. Added test files: 1. View PR surface stats
Preflight sourceSource 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
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (6 earlier review cycles)
Reviewed November 13, 2026, 12:48 AM ET / 05:48 UTC (Revision 7). |
Reject a late session failure as an Error, build test key lists without spreading a string, and read operator input entries through the SDK record guard instead of a type assertion.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
- Acknowledge a screencast frame once the first viewer has taken it, so a slow viewer skips frames instead of stalling the others. - Keep an operator session registered until its guard has settled when it stopped for a navigation, dialog or abort; later input waits for that settlement and receives a late denial. Idle-ended sessions still release at once. - Panel: scope the unsupported-input fallback to the browser route that answered it, recheck input ownership before each fallback /act, clear focus uncertainty when a recovery click succeeds, and show the navigation notice when the active burst itself had input withheld.
Any HTTP(S) subframe navigation ended an operator input session, so an unrelated iframe reload (ads, embeds) stopped typing and showed the navigation notice. Only main-frame navigation ends the session now. Each committed subframe URL is still policy-checked at once; a denied one ends the session, and the guard rejects input with the denial when it settles. Document requests, including iframe requests and redirect hops, stay fenced as before.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Replace the long-lived operator input session (idle timer, post-burst wait, failure hand-off to the next request) with one navigation guard per request. The burst stops on a main-frame navigation request or commit, or on a subframe navigation whose URL is denied; allowed iframe navigations keep input flowing. Each request reports its own navigation, denial or dialog. Trade-offs, measured with the Browser panel typing harness (30 keys at 60 ms): key-to-page p50 163-321 ms and max 291-725 ms, against 56-84 ms and 138-447 ms for the session. A script navigation that starts about 200 ms or more after the last key can outlive the guard and reach a blocked address, as it can after a single POST /act action; the session kept the guard up for 1 s after input and blocked it.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Observe the ordered click and Enter requests on the human-input route introduced by #197927 while preserving existing-tab and route identity assertions.
…ters (openclaw#197927) * perf(browser): pace panel screencast acks to frame delivery Ack each screencast frame once every viewer socket has taken it instead of after a fixed 50 ms. Keep the 50 ms back-off only when every viewer is congested, so capture still never queues frames. * perf(browser): share one navigation guard across panel input bursts The Control UI browser panel sent every click, key and text insert as its own /act call. Each held the navigation request guard for 250 ms after the action and the panel waited for it, so typing landed at about one character per 265 ms. Add POST /operator/input for the panel. It takes an ordered burst of press, insertText and clickCoords inputs. A tab's operator input shares one guarded interaction (same request fence, download policy, dialog handling and quarantine as /act) while input keeps arriving; the post-action window and final checks run once when it ends. A main-frame navigation request or commit ends the session before any further input, and the next input waits until the guard has checked it. Invocation-bound policies never share a session. The panel sends input typed during an in-flight burst as the next burst and drops queued input after a reported navigation. Agent tools keep /act unchanged. * fix(browser): let operator input answer for profiles without sessions Lightpanda's engine admission rejected POST /operator/input with BROWSER_CAPABILITY_UNSUPPORTED before the route ran, so the Control UI panel showed an error instead of falling back to one /act per input. Admit the route on Lightpanda and let it answer from profile capabilities: existing-session profiles and profiles without visual actions get OPERATOR_INPUT_UNSUPPORTED, the code the panel falls back on. * fix(browser): satisfy static checks in operator input Reject a late session failure as an Error, build test key lists without spreading a string, and read operator input entries through the SDK record guard instead of a type assertion. * fix(browser): address operator input and screencast review findings - Acknowledge a screencast frame once the first viewer has taken it, so a slow viewer skips frames instead of stalling the others. - Keep an operator session registered until its guard has settled when it stopped for a navigation, dialog or abort; later input waits for that settlement and receives a late denial. Idle-ended sessions still release at once. - Panel: scope the unsupported-input fallback to the browser route that answered it, recheck input ownership before each fallback /act, clear focus uncertainty when a recovery click succeeds, and show the navigation notice when the active burst itself had input withheld. * fix(browser): keep dialog-interrupted panel input out of the old field When a page dialog stops an operator input burst, the panel treated the burst as delivered: a click the dialog withheld cleared focus uncertainty, so the next keys went to the previously focused field, and withheld or queued input was dropped without a word. Read blockedByDialog from the response, keep focus uncertain when a click was withheld, drop the queued input and tell the user the dialog stopped it. * fix(browser): keep a panel action's error visible through passive refreshes An action's error, such as a navigation blocked by policy, disappeared from the Browser panel while the page kept streaming: the automatic viewport sync runs through runAction, which cleared the error before every action, and refreshAll cleared it on every passive refresh. Viewport sync is now a passive action that leaves the error in place, and refreshAll keeps an error that came from the person's own action. The person's next action still clears it. * Revert "fix(browser): keep a panel action's error visible through passive refreshes" This reverts commit 7182806. The bug also exists on main, so the fix moves to its own pull request. * fix(browser): release stalled screencast frames and dropped dialog clicks - Screencast: when the only viewer's write is still pending, a viewer that joins would inherit its frozen capture. Acknowledge the outstanding frame when a new viewer becomes ready, so the next frame reaches everyone. - Panel: when a dialog stops a burst, a click still queued behind it is dropped too. Keep focus uncertain in that case, so later typing waits for a new click instead of reaching the previously focused field. * fix(browser): keep operator input through allowed iframe navigations Any HTTP(S) subframe navigation ended an operator input session, so an unrelated iframe reload (ads, embeds) stopped typing and showed the navigation notice. Only main-frame navigation ends the session now. Each committed subframe URL is still policy-checked at once; a denied one ends the session, and the guard rejects input with the denial when it settles. Document requests, including iframe requests and redirect hops, stay fenced as before. * refactor(browser): guard each operator input burst on its own Replace the long-lived operator input session (idle timer, post-burst wait, failure hand-off to the next request) with one navigation guard per request. The burst stops on a main-frame navigation request or commit, or on a subframe navigation whose URL is denied; allowed iframe navigations keep input flowing. Each request reports its own navigation, denial or dialog. Trade-offs, measured with the Browser panel typing harness (30 keys at 60 ms): key-to-page p50 163-321 ms and max 291-725 ms, against 56-84 ms and 138-447 ms for the session. A script navigation that starts about 200 ms or more after the last key can outlive the guard and reach a blocked address, as it can after a single POST /act action; the session kept the guard up for 1 s after input and blocked it.
Closes #165752
What Problem This Solves
Fixes: typing, clicking and the live view in the Control UI Browser panel lag far behind the person driving it, because every input waits for a 250 ms navigation-guard window and the screencast waits 50 ms before asking for each frame.
User Impact
User impact: in the Browser panel, typed characters reach the page in about 160 to 320 ms (median) instead of seconds, and the live view runs at a higher frame rate. Agent browser tools behave exactly as before.
Why This Change Was Made
POST /operator/inputroute instead of onePOST /actper input. A request carries an ordered burst of key presses, text inserts and clicks, and the panel sends whatever was typed while one burst was in flight as the next burst. Each request runs its burst inside one guarded interaction on the/actexecution path: the same document request fence, download policy, dialog handling and quarantine. The 250 ms post-action window and the final navigation checks run once per burst instead of once per input.navigated: true; the panel drops the withheld input with a notice. A subframe navigation (an ad or embed reloading) does not stop input; its committed URL is still policy-checked, and a denied one stops the burst. Each request reports its own policy denial orblockedByDialog.501 OPERATOR_INPUT_UNSUPPORTED, and the panel falls back to one/actper input there, as before.docs/tools/browser-control.mddocuments the route and the frame pacing.Trade-offs for review:
/actaction. A page script that starts a navigation later than that (for example from a timer about 200 ms or more after a key) is not fenced by this request, exactly as after an/actkey press.evaluatethrough/act) and hover are unchanged.Evidence
Typing 30 characters at 60 ms intervals into a field of a local test page, through an isolated Gateway and the Control UI Browser panel in headless Chromium, timed from each key press in the panel to the character arriving in the page:
main(one/actper input)All 30 characters arrived in order in every run.
Live view: an animated page streamed from headless Chromium through the screencast session to a local WebSocket client, 6 interleaved runs against
main: 18.2 fps on average onmain, 24.6 fps with this PR. This PR was faster in every pair.Tests on this head:
OPENCLAW_BROWSER_OPERATOR_INPUT_E2E=1), plus the interaction navigation-guard, policy-abort and batch tests and route admission: 5 files, 63 passed. The Chromium cases: keys after a main-frame navigation never reach the new document; typing continues through an allowed iframe reload; an iframe navigation to a blocked address rejects the burst; a blocked navigation started by a click in the burst stays blocked.Regression tests, each failing on the code without its fix and passing with it:
shares one JPEG message across viewers, acks once one viewer took it, and backs off when congested: with the acknowledgement waiting for every viewer, a slow viewer's pending write left 0 acknowledgements.releases a frame stalled on the only viewer when another viewer joins: 0 acknowledgements after the second viewer joined.answers operator input on Lightpanda with the panel's per-action fallback code: Lightpanda answeredBROWSER_CAPABILITY_UNSUPPORTED, so the panel had no fallback.notices input withheld from the burst that navigated: no notice.types again after a queued click recovers from a failed click: the key after the recovery click was dropped.stops per-action fallback input once the panel no longer owns it: the queuedcwas still sent after switching to Annotate.asks a new browser route for operator input after an unsupported one: input stayed on/act.keeps typing out of the old field when a dialog stops the clickandkeeps typing out of the old field when a dialog drops a queued click: the next key was sent to the previously focused field.Live proof limits:
blockedByDialogresponse is covered by committed tests.