Repository navigation
fix(browser): open the browser in a project its server has only just started - #65720
Conversation
There was a problem hiding this comment.
The change looks sound to me, but I couldn't verify it by running it. Electron won't start in the review sandbox (libnspr4.so is missing), so electron-open.test.ts couldn't run, and the pane can't be reached from the TUI. tsc -b in packages/gui-plugins passes, and so do the pane-machine.test.ts tests (53).
From reading the code: the retry only applies to rpc.unavailable while the binding is still connecting. An attachment that was accepted and then dropped still suspends. If the second attach also fails, the pane ends unsupported as before. Built-in plugins, the browser's among them, are turned on in the supervisor's first batch, so waiting for any plugin to be listed is enough. The 10 s wait fits inside the 15 s register timeout. The fixture's counters depend on the request count, not on timers, so the check shouldn't be flaky.
Public API: unchanged (client-side desktop pane only).
If you haven't already, could you confirm the cold-start case once in the desktop app, since it couldn't be exercised here?
The browser pane now attaches to a project that its server has only just started. The first
attachto such a project is refused, because its plugins are still loading, and the pane took that answer for a server with no browser: "The browser couldn't open".sequenceDiagram participant P as Pane participant S as Server P->>S: attach Note over S: starts the project, plugins still loading S-->>P: 400 rpc.unavailable Note over P: before: browser.pane.unsupported loop until the project lists its plugins, 10 s at most P->>S: plugin.list S-->>P: none yet end P->>S: attach S-->>P: attachedattach. One week of my desktop logs has 17 of these, 5 within 4 s of an app start and 12 mid-run: eachbrowser.pane.unsupportedpairs with anattach400 at most 513 ms afterlocation services booted.plugin.updatedorserver.connectedwoke it. In the logs its nextattachcame 0.8 to 2.6 s later, and once not within 3 minutes. Meanwhile the pane said the browser could not open andavailable(session)was false.rpc.unavailablebefore the handshake, the pane waits until the project lists its plugins, then attaches once more. This is the client-side waitAGENTS.mdasks for under Plugin Loading, the same poll aswaitForPluginsin the CLI.plugin.updatedwakes it as today. A server that started every open project at once took up to 6 s in the logs.electron-open.test.tsnow starts cold. It refusesattachand lists no plugin until its third answer to the plugin list, and the test checks that the pane was refused once and listed three times.