Repository navigation
Studio: tighten browser use gates and fix floating browser window state - #17594
Conversation
Browser use: ordinary request words no longer approve a made-up site, a click by ref on text inside a custom button is gated on that button, and a page's links stop vouching for addresses once the tab moves on. Floating window: arrow keys can move it off the right edge, and a browser floated by a close mid-run keeps that state across a chat switch. Page fetch: an oversized max-age no longer fails the page. Desktop: macOS content rules also block trailing-dot loopback names.
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 468b876796
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| floating: saved?.floating ?? false, | ||
| floatedForAgent: false, | ||
| // A close mid-run stays a close on return: still floated for the agent, not docked open. | ||
| floatedForAgent: (saved?.floating && saved.floatedForAgent) ?? false, |
There was a problem hiding this comment.
Preserve the agent-floating flag in background chat updates
On Desktop, if the user floats the browser mid-run and switches chats, the next background browser action calls showTab() → revealIn(). The off-screen revealIn implementation replaces the saved chat state without copying floatedForAgent; openTab does the same when opening another background tab. Returning to the chat therefore restores floating: true but floatedForAgent: false, so closing the preview no longer resets the floating layout and reopening the browser incorrectly keeps it floating. Preserve the new flag in both saved-state update paths and cover a background action between switching away and returning.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 7c910ba: both background update paths (openTab for another chat and revealIn) now carry floatedForAgent, with a test that runs a background action between switching away and returning.
…her chat's browser
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
The driver fills |
|
Correction to my note above: this is not specific to this branch. The same |
… port-aware (#17596) ## What changed Follow-ups from a review of the Studio browser and browser use. Separate from #17594, no overlap in behaviour. **Browser tabs survive a reload** - Reloading the page used to close the browser panel and drop every tab. Open tabs and each chat's panel state (open, active tab, full view, floating) are now kept in `sessionStorage` and restored on load. - `sessionStorage` on purpose: a reload brings the tabs back, a new window or a fresh launch starts without a browser, and two windows do not share one tab list. - Only what can be loaded again is kept: new tab pages, internal pages and GET web pages. Files (their bytes live in memory), form posts and pages opened beside a temporary chat are dropped from a tab's history. - A chat that was never saved gets a new key on reload, so its tabs follow it to the new chat. A saved chat keeps its own tabs. - Saved under an account-scoped key, and an account switch already clears `sessionStorage`. **Browser use approvals are port-aware** - Approvals were keyed on hostname only, so approving `example.edu` also covered `example.edu:8081`, and an Always allow for submit or sign-in carried to any port. A non-default port is now its own site and asks again. http and https on their default ports remain one site, so an upgrade does not ask twice. - Site patterns in Settings and the request's website policy are unchanged. **Browser use refuses the port Studio is really on** - The guard that keeps the model off Studio's own address was a fixed range (8888 to 8908). It now also refuses the port this server is bound to, for example `-p 8000`. ## How it was verified - Frontend: `npm run typecheck`, `npm test` (15755 pass, 0 fail), `npm run build`. New `browser-tab-session` tests, plus port cases in `browser-agent-gate` and `browser-agent-always-allow`. - Backend: `pytest studio/backend/tests/test_browser_agent.py studio/backend/tests/test_browser_routes.py` (200 passed), with a new own-port case. - Live, in an isolated Studio on macOS: opened the browser in a new chat, loaded a page, reloaded the window; the panel came back open on the same tab. ## Not verified here - The port-aware approvals and the own-port guard are covered by unit tests only; they were not exercised with a live model (CPU-only host). - Tab restore was checked in web Studio, not in a Desktop build, where pages show in native views. - `biome check` reports pre-existing formatting errors repo-wide; none are on lines this PR touches. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…local links (#17646) ## What changed Three additions to the Studio browser settings. Independent of #17594 and #17596. **Import browsing history** - Settings > Browser > Browsing data has a new Import history row, next to the existing bookmark import. - Accepts Safari's `History.json` (File > Export Browsing Data) and Chrome's history from Google Takeout. Both arrive as a ZIP; unzip and pick the JSON. - Only http and https visits with a sane date are imported. Importing the same file twice adds nothing, and the "Keep history for" setting and the history limit still apply. The import works with history saving turned off, since it is an explicit action. **Camera and microphone site settings (Desktop app)** - A new section sets Ask or Block for camera and for microphone, as a default and per site. A site rule wins over the default. - Block only: the app still never grants a page a capture device itself. Ask is the system's own prompt, as before. The existing test that proves no path returns Allow now runs over every rule combination. - Rules are stored per account in the app and sent to the shell at startup and on change. Until the first send, requests get the system prompt. **Links to local addresses** - With "Open links in: Unsloth browser" on, a link to `localhost` used to open a panel tab that cannot load, because a local page only opens in the panel when its address is typed there. Such links now go to the default browser, and the setting's description says so. ## How it was verified - Frontend: `npm run typecheck`, `npm test` (15884 pass, 0 fail), `npm run build`. New `browser-history-import` and `browser-capture-sites` tests. - Rust: `cargo test page_` (5 passed) and `cargo test capture` (8 passed) on macOS. - Live, in an isolated web Studio on macOS: the Import history row is present; importing a small Safari-format file added the one valid visit and dropped a `javascript:` entry and one dated 1970. The camera and microphone section is hidden outside the Desktop app, as intended. ## Not verified here - The camera and microphone settings screen and the real block behaviour need a running Desktop app, which was not built or driven. The Rust change has no platform-specific code, but Windows and Linux were not compiled. - A site that WebView2 has already been told to allow may not reach the handler, so Block may not apply to it until that saved answer is reset. - The import formats follow Apple's and Google's published schemas; no real export file was available. - Other locales fall back to English for the new strings. - `biome check` reports pre-existing formatting errors repo-wide; the new files add none at error level. Schemas: https://developer.apple.com/documentation/safariservices/importing-data-exported-from-safari and https://developers.google.com/data-portability/schema-reference/chrome
What changed
A review of the Studio browser, browser use and the floating browser window turned up a handful of real defects. No change to normal flows.
Browser use (model driving the browser)
notes.com/?d=...without asking. Brand names ("search wikipedia") and written addresses (notes.com) still approve as before.role="button"element is now gated on that control, as clicks by point already were. Before, "Place" inside a custom "Place order" button was clicked with no prompt.Floating browser window
Page fetch
Cache-Control: max-ageof thousands of digits made the whole page fail with a 500. The value is now bounded.Desktop (macOS)
localhost.,x.localhost.,x.local.).How it was verified
npm run typecheck,npm test(15749 pass, 0 fail),npm run build. New cases inbrowser-agent-gate,browser-floating-preview,browser-floating-layout.pytest studio/backend/tests/test_browser_routes.py test_browser_agent.py test_browser_page_request.py(257 passed), with a new oversized max-age case.cargo test content_rules_block_private_hostspasses with the new trailing-dot cases.Not verified here
biome checkreports pre-existing formatting errors repo-wide; none are on lines this PR touches.Found, not fixed in this PR