Skip to content

feat: load an agent's page on no desk and let its agent drive it - #2701

Merged
yansfil merged 12 commits into
feat/lane-deskfrom
m78-host
Nov 20, 2026
Merged

yansfil merged 12 commits into
feat/lane-deskfrom
m78-host

Conversation

@yansfil

@yansfil yansfil commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Related: PRD lane-desk-pair-view (B32, D-37); stacked on #2672 (core).

Summary

Problem

With a desk per Agent tab (#2672), a page an agent opens while the operator watches another pane lands on no desk.
The desktop app made a page only once a slot on screen showed it, so that page never loaded: hide browser open --wait timed out pending, and snapshot, fill and click had nothing to drive.
The same held for a page on the desk of a tab or Workspace not in front.
Found while building core; core parked its e2e on it (browser.spec.ts:275).

Before → After

Before After
What the user gets An agent's page on no desk stays pending; hide browser cannot drive it It loads hidden; snapshot, fill, click work on it
Screen (the page was never loaded) The page the other tab's agent opened, filled and clicked off screen, now on that tab's desk with the text and result kept
Flow Agent opens page → pending until shown → load Agent opens page → loaded off screen, driven → put on the desk → same page, nothing reloads

The Screen row is the candidate window after the operator puts the page on the desk (720 px run of the e2e).

Decide

  • Only a load asked after the window has the core's inventory loads off screen: the host keeps the newest load stamp of that inventory (core stamps rise strictly), so a relaunch, a shell reload or a device checkout that comes back loads none of its pages at once; they load when shown or when an agent drives them.
  • A page Chromium never showed has no pixels: hide browser screenshot on such a page fails display_hidden ("ask the operator to show it") after the 8 s step; input and reads work. Measured on Electron 44.4.5: neither CDP capture nor Electron's capturePage returns an image. OK to leave as is?

Hard to undo

  • Resident work: pages no slot shows now count in the existing 12 live pages (MAX_LIVE_VIEWS); past it the hidden page shown or loaded longest ago is unloaded, as before. No new timer: the off-screen check runs inside the existing sync over the retained rows and keeps one number.
  • Wire: browser_views[] rows gain url and load (additive). Core files are touched because that row is the only wire to the host; agreed with the mission's core node. Built on the existing inventory rebuild, which runs only on a View store generation change, outside the lock's serialization.

Not verified

  • Windows and Linux: the host change is platform-neutral (no OS branch) and the off-desk e2e is @platform, but it ran only on macOS here; CI runs it on Windows.
  • Only the browser, browser-agent and browser-cdp desktop specs ran locally (29 tests, all pass after the fixes here); the rest of the desktop and web e2e suites did not.
  • Rust: only the desk tests of hide-core (29) and the browser and new relay tests of hided (64) ran; full lanes and clippy are left to CI.
  • A device pane's page on no desk (B31): remote-browser-agent.spec.ts now has that case, but no CI lane runs this spec and it did not finish here: against a local isolated sshd the device link came up (after pointing the fixture's SSH config at its own known_hosts, which ssh otherwise reads from the account's home), then the device project's registration timed out, a step before the new case.
  • Follow-up: an off-desk page an agent keeps driving is not counted as used for the 12-page cap, so twelve newer pages can unload it and lose what was typed (the agent's next command loads it again). Counting an agent's connection as use is left for a follow-up.
Evidence
  • Verified: desktop/e2e/browser.spec.ts off-desk test, 1500 and 720 px, on a Playwright-launched candidate from this worktree's desktop/dist with private state: a fixture claude agent in a background tab opens form.html --wait → loaded, no tab on the front desk, the operator's page keeps its typed text; snapshot, fill, click succeed and the page shows sent: 한글 이름; from the agent's tab hide view select puts the same contents (same contents id) on the desk at the slot's size with the result kept.
  • browser.spec.ts hidden-page test: a background pane's page now loads hidden and the operator's keyboard target does not move.
  • browser.spec.ts and browser-cdp.spec.ts (21) pass; browser-agent.spec.ts 8/8 after entering with the lane up (its 3 page tests failed before, as their opens now wait on a closed desk).
  • Desktop unit 340 passed (+4 skipped); web browserViews* 32; hide-core desk tests 29; hided browser, relay and mobile tests 302; clippy on hided clean.
  • After review: the 1500 px off-desk e2e relaunches the app with another page on no desk and sees no browser.loaded_off_screen and no page until the agent's next command loads it.
  • Found on the way: a never-shown page has a 0 x 0 viewport (clicks land outside it), and emulating a page before its first commit stalls the Electron main process; both measured with a throwaway Electron probe, fixed by laying the page out by emulation from its first commit.
Tests
  • Layer: unit for the host's rules (browser.test.ts, driven through the sync channel in the shell's real order, browserSync.test.ts), the shell row and its inventoried mark (browserViews.test.ts, browserViews.attachment.test.ts), core's wire (a_page_on_no_desk_names_its_address_and_load_for_the_host), hided's input rule (a_page_on_no_desk_takes_input_and_another_checkouts_page_is_missing); e2e for the flow, since only a real Electron shows whether an off-screen page lays out and takes clicks (it did not, twice, while unit tests passed).
  • Catches: saved pages loaded at once after a relaunch, a reload or a device reconnect (planted: a baseline of 0 → the first unit test and the relaunch e2e fail; an empty pre-snapshot sync moving the baseline → the first unit test fails; no reset on shell reload → the reload test fails); a device-sized page emulated before its document (planted → the device test fails); a just-loaded page evicted first (the cap test); a page off screen that does not load or cannot be clicked (the e2e).
  • Repeat: CI's repeat job (run 44562857281) on the first head; locally the off-desk e2e passed 3 runs in a row at 720 px and 4 at 1500 px, and both widths again after the review fixes.
  • Waits: none added; one compositorPresents before the native capture.
Risky files
  • desktop/src/main/browser.ts - page lifetime: off-screen creation, the cap, release on close, emulation.
  • hided/src/server.rs takes_input - which displays take an agent's input and a phone's picture (mobile/page_shot.rs).
  • desktop/e2e/device-home.ts - the SSH fixture's config now names its own known_hosts.
  • hide-core/src/model.rs, runtime/workspace_view.rs - snapshot wire (additive fields).
Verification record

…host

A page on no desk has no slot on screen, so the host never learned its
address or the load the core asked of it. The browser_views rows now carry
both (additive; core files touched because the inventory row is the only
wire to the host, agreed with the mission's core node).
The desktop host made a page only once a slot on screen showed it, so a
page an agent opened while the operator watched another pane stayed
pending and hide browser could not drive it. The host now loads a retained
web page hidden when the core asks for a load, inside the 12-page cap, and
the desk later shows the same contents; hided lets a page on no desk take
input. The parked off-desk e2e is rewritten for the desk model and runs.
Chromium gives a page it never showed a 0x0 viewport, so a click on a page
loaded off screen landed outside it. Such a page is laid out at the lane's
width by device emulation once its document commits, until a slot shows it.
…k page's frame

Under per-tab desks an open with the lane closed waits on the desk, so the
agent page spec enters with the lane up as the other browser specs do. The
docs and the agent help say a page no slot has shown has no pixels yet.
@yansfil
yansfil marked this pull request as ready for review November 19, 2026 16:09
Base automatically changed from m78-core to feat/lane-desk November 19, 2026 22:48
…wser commands

A page on no desk takes page commands; the phone's picture now reads that rule from the one function the CLI relay uses.
…irst inventory

The host keeps the newest load stamp of the core's inventory and sets it from the first sync that carries that inventory, so a relaunch, a shell reload or a device checkout that comes back loads none of its pages at once. One step now creates, remakes or reloads a page on a slot or off screen, and a page with no document is never emulated.
@yansfil
yansfil merged commit 3475807 into feat/lane-desk Nov 20, 2026
48 checks passed
@yansfil
yansfil deleted the m78-host branch November 20, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant