Repository navigation
fix(browser): start an agent's browser command the turn the server announces it - #657
Merged
Merged
Conversation
…nounces it Stream events wake the window for its next frame, so each agent command waited 5 ms median (12 ms p90 on blade) between the server announcing it and the app fetching it. Command frames now also come to their own stream subscription, woken by the browser's quiet waker; the frame's poll sees each again and the attachment ignores a request it already took, as it ignores the server's replays.
This was referenced Nov 21, 2026
…e after its command READER-12 (#657 should-fix): with commands on the quick path and cancels on the frame path, a command could start before the cancel of an earlier one ran its cleanup, or run before its own cancel.
Hona
added a commit
that referenced
this pull request
Nov 21, 2026
…e after its command READER-12 (#657 should-fix): with commands on the quick path and cancels on the frame path, a command could start before the cancel of an earlier one ran its cleanup, or run before its own cancel.
|
PR test build retired — merged into |
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Each agent browser command waited for the window's next frame between the server announcing it and the app fetching it. This PR starts the fetch in the turn the announcement arrives.
What was slow
The server announces each agent command as an
rpc.experimental.browser.controlstream event. Stream events wake the window for a poll in its next frame (launch::inbox_waker). The probe build (#638) measured the time from the stream thread hearing the event toon_control_event: 4.7 ms median, 12.3 ms p90 per command on blade, as a window.What changes
EventHub::subscribe_to(ty, wake)(crates/opencode-kit/src/client/hub.rs): a subscriber that takes only one event type, woken only by batches that have one.subscribeis unchanged; every subscriber still gets every event it got before.rpc::express(new,apps/desktop/src/surfaces/browser/rpc/express.rs): the window subscribes torpc.experimental.browser.controlon its server's hub, woken by the browser's quiet waker from fix(browser): read the engine's messages in the turn they arrive, not the next frame #640 (launch::browser_waker). The quiet poll hands eachcommandframe toon_control_eventat once.machine.rs,ControlFrame::Command).commandandcancelframes take the quick path, so a cancel keeps its place after its command (READER-12);attachedandincompatiblestay on the frame path, and so does a cancel's replay, which does nothing.Proof
tools\smoke.ps1: in a comment.