GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(browser): keep the pane's tabs unless the person or the agent closes them by Hona · Pull Request #65313 · anomalyco/opencode Conversation
|
| The strip after the link's tab opened and the person typed | |
|---|---|
| Before | ![]() |
| After | ![]() |
tabs.open makes the tab, then runs its first navigation, and undoes the tab when that navigation rejects (pane.ts:1181, :1192 on dev; the agent's file preview does the same at :1120).
opening.defer(() => { if (page(binding, tabID) === opened) dispatchBinding(binding, { type: "tab.closed", tabID }) }) await opened.execute({ action: { type: "navigate", tabID, url: action.url }, files: [] }, signal, origin)
load within 15 s (navigation-deadline.ts:13, around loadURL at chromium.ts:1334). A page with slow ads or one hanging request has shown long before that.loadURL rejects with Chromium's error.pane.ts:580). By then the tab is gone.| Path | Who | |
|---|---|---|
tabs.close: strip button, shortcut, menu, "Leave site?", the agent's tool |
person, agent | kept |
window.close(), a pop-up whose first address is refused |
the page | kept |
A plugin closing the tab it opened, an extension's chrome.tabs.remove |
the person's plugin or extension | kept |
| Session deleted: main forgets its saved tabs | person | kept |
tabs.open undone when its first load rejects |
nobody | fixed |
| The agent's file preview undone the same way | nobody | fixed for a page still loading |
| A binding that closes (session switch, reconnect, idle eviction, reload): pages are released, the tabs come back unloaded | no removal since #63002 | unchanged |
| A registration that lands before a new tab's first report restores without it | nobody, a window of milliseconds | listed |
Host: the layout keeps 50 session strips and drops the rest, whole (layout.tsx prune) |
nobody | listed, host |
| Host: a strip key removed without the plugin is not added again in that run, since the window only appends tabs new to the inventory | nobody | listed |
One rule (keepsOpenedTab in errors.ts) decides what an open leaves behind when its first load rejects:
| The first load | The person's tab | A plugin's tab (experimental.open) |
The agent's tab |
|---|---|---|---|
| still under way at the deadline | stays, loading; the command settles | stays; the call resolves with the handle | stays, reported and shown as a tab that loaded; the agent's error names the tab |
| failed by Chromium | stays, with the page that says why and offers Reload | stays; the call resolves with the handle | undone; the agent gets the failure |
| committed no page (cancelled, became a download), or the pane could not open it | undone | undone; the call rejects | undone |
A tab that stays is an ordinary tab. One path (firstLoad in pane.ts) serves the tab that loaded and the tab that stays: its state is refreshed, it is announced and shown per the same options (focus: false keeps it in the background, a file preview takes the pane), and its opener holds it. No tab exists whose opener has neither a handle nor an undo.
The agent's error names its tab, in the message only (no tool schema changed): browser.tabs.open failed. The browser page did not finish starting or navigating. Reload the tab and inspect it before retrying. The tab stays open as tab_…: use that tabID with browser.wait, browser.reload or browser.tabs.close, and do not open the address again.
experimental.open documented a rejection only for an unavailable pane or a session not on screen. Its TSDoc and the guide now say that it resolves once the tab exists, also while the page loads or after the load failed, and rejects when the address opened no page.
Deadline as an input: the pane and its pages take navigationDeadlineMs for a navigate command's load. Production passes nothing and gets NAVIGATION_DEADLINE_MS, the same 15 s. Page start-up keeps the constant.
Log: main writes browser tab closed: its open failed when it undoes a tab, and browser pane closed with the reason when a binding closes. The desktop log had no line about either. The window's [browser] unmapped failure line now carries the failure's code and the action as text; it passed them as an object, which the desktop log wrote as [object Object]. No unmapped failure removes the pane or a tab that existed: the only removal behind one is an open undone as in the table, which main logs.
On dev |
Covers | |
|---|---|---|
electron-open.test.ts: the real pane in Electron, attached to a stand-in server, opening tabs as a conversation link, a plugin and the agent do |
fails: both tabs are gone from the inventory | Person: two tabs open, then a link to a page that shows and keeps loading past the deadline, and a link to a page that fails to load. Every tab is still reported, in order; the commands do not fail. Plugin: both of those opens resolve with a handle and closeTab on it closes the tab; an address that opens no page rejects and leaves no tab. Agent: a tab kept at the deadline is announced in front, in the background with focus: false, and a file preview takes the pane; each error names the tab. The fixture gives the pane a 300 ms deadline, so a run takes about 3.5 s |
browser-pane-model.test.ts |
fails: the log call gets an object | the unmapped-failure line holds the code and the action as text |
errors.test.ts |
new rule | each row of the table above, for the person and the agent |
navigation-deadline.test.ts |
passes | the default is still 15 s, to the millisecond |
client.closed, and main forgot the saved tabs. dev fixed that in feat(desktop): signed-in browser pane with extensions, previews, prompts and agent safeguards #63002: the window's close keeps them, and pane-machine.test.ts "only explicit deletion forgets the saved tabs" guards it. fix(browser): keep the pane's tabs when its window detaches #64742 targets the old code; on dev it would keep a deleted session's tabs.[browser] unmapped failure [object Object] line in the owner's log of 21 Nov cannot be decoded: its fields were not written.No feature flag: a fix.
Added by the opencode bot (AI-generated).
Related: #64734
Public API: Browser.experimental.open (experimental plugin SDK) now resolves with a handle when the tab's page is still loading or failed to load, and rejects only when no page opened (backwards compatible)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The rule itself makes sense: a tab whose page is still loading at the 15 s deadline stays, and a person's tab whose load Chromium failed stays and shows the error page. I checked it by reading the code and running errors.test.ts and tsc -b, both clean. I could not run the Electron test here (the sandbox lacks libnspr4.so), so the end-to-end behaviour is unverified.
Public API is unchanged. The only new outputs are two main-process log lines.
Concerns:
createTab: it runs tabs.open with origin "user", so a plugin's tab whose first load fails or runs past the deadline is now kept, but createTab still rejects. grant.settled() never runs, so the plugin gets no handle for a tab that now exists and cannot close it (see the inline comment).keepsOpenedTab table plus a smaller pane-level test? That would keep it fast and less timing-sensitive on loaded runners.Related: #64734
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The test-cost point is fixed: the pane takes a deadline input, and the Electron test runs with 300 ms and bounded polls instead of the real 15 s. Production keeps 15 s, and navigation-deadline.test.ts checks that. I ran navigation-deadline.test.ts and errors.test.ts (both pass) and tsc -b (clean). The Electron test still can't run in this sandbox.
Public API is unchanged. navigationDeadlineMs is an internal option of the built-in browser pane.
The open thread on plugin createTab is unchanged in code. The description now lists it under Limits: a plugin's tab kept after a slow or failed load still leaves the plugin with no handle to close it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The open thread is fixed. A kept tab now goes through the same path as one that loaded, so it is refreshed, announced and shown as asked. A plugin's createTab resolves with a usable handle, and the agent's error names the kept tab. I checked this by reading the code. errors.test.ts and navigation-deadline.test.ts pass, as do the app's browser-pane-model.test.ts and tsc -b for gui-plugins. The Electron test still can't run in this sandbox.
Public API: the plugin SDK's experimental Browser.experimental.open now resolves with a handle when the tab's page is still loading or failed to load. Before, it rejected and the tab was removed. It now rejects only when the address opened no page. The TSDoc and the guide are updated. This is backwards compatible: callers that treated a rejection as "no tab" still get that.
Nothing new blocks this. The Electron fixture has grown to cover the person, plugin and agent rows. If it gets slow or flaky on CI, trimming it to the person and plugin rows would keep it focused.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.