You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ending a session can close the user's Chrome window and kill the profile's extension host: no last-tab guard when closing agent tabs #148
A Chrome profile's cua extension host dies, and the next session's profiles list reports host_not_live, after an agent session ends in a window whose remaining tabs were all agent-created. Chrome keeps running, but the profile has no window, so its extension service worker and native host stop. Seen four times on the mini's ssfs profile during #116's parity sittings (M0, M2 twice, M5), each fixed only by reopening a window of that profile by hand.
Cause (read-only sweep at 86471c6, #116 M5 plan-executor)
Every close path respects ownership: it closes only tabs the run created or claimed. None checks whether the tab is the last in its window:
src/chrome/host.mjs:229, endTurn's tabs.remove at end_task, at case end and on client disconnect;
src/browser-service/cdp.mjs:540, tab.close();
extension/background.js:291, a bare chrome.tabs.remove.
Agent tabs open inactive in the focused or first normal window, which is usually a pre-existing user window. Once that window's own tabs are gone (the user closed them, another session on the same profile did, or a model-driven cleanup did), the agent's ordinary cleanup closes the window. The standalone spec recorded the same effect (docs/doperpowers/specs/2026-10-02-standalone-cua-design.md:537).
Fix
In the extension's tabs.remove handler, the single point all three paths reach, check the tab's window. If it is the window's last tab, keep the window open: create a New Tab page in that window first (inactive, not agent-owned, not grouped), then remove. Apply this only to normal windows the agent did not create; a window cua itself created may close. MAWS client mode has its own primitive server and is out of scope unless the same effect shows there.
Acceptance
Unit test in the extension and host tests: closing the last agent tab in a pre-existing window leaves the window with one New Tab page; closing a non-last tab is unchanged; a cua-created window still closes.
Live: on a profile whose only window holds only agent tabs, end_task leaves the window open and profiles list stays ready.
[board] ready-for-implementer: Found during #116 M5 (mini ssfs window lost four times). Cause is the cua extension/host close path from #10/#113, not #116's REPL host.
Second mechanism to investigate alongside the last-tab guard (2026-10-16, #116 M5 on the mini): both bound profiles (ssfs and school) went host_not_live between 10:35:14Z and 10:50:37Z with no cua activity at all. No harness run, prepare, cleanup or tab operation was active. Both MAWS runner jobs in that window were e2e:design-spike, which doesn't touch Chrome. The ida-solution runner has been idle since August. The resident agent's log hasn't been written since 2026-10-15 02:39, so no remote session ran. Chrome's main process had been up since 02:12:51Z with no restart, and no native-messaging host process was alive for either profile. Opening a window of the profile restores it. So besides an agent closing the last tab of a window, the extension's service worker or its native port can apparently end while Chrome keeps running. Check the extension's reconnect path in extension/background.js: does it reconnect the native host without a window event? Check too what ends the port with no client activity (MV3 service-worker lifetime, host exit on idle).
[board] in-progress: Building it in the host (src/chrome/host.mjs), not the extension: the agent's own tab.close() reaches Chrome as Target.closeTarget through debugger.sendCommand, which the extension's tabs.remove never sees, and the host ships with the checkout while an unpacked extension updates only when its user reloads it. Branch fix/last-tab-guard.
Live proof on the mini (ssfs = Profile 1, Chrome running with --no-startup-window), the same scenario before and after #150.
Scenario. The profile had no window. A runner opened its own loopback page there with open -n -a "Google Chrome" --args --profile-directory="Profile 1" <url>, so that page was the profile's only window. A backend client of the profile's cua host, speaking the protocol the browser service speaks, then:
created a tab;
claimed the runner's page and closed it with Target.closeTarget (what the service's tab.close() sends), leaving the agent's tab as the window's only tab;
0 user tabs (the page close was not the window's last, so no New Tab)
window 1030418007 kept open with a New Tab page: tab 1030418034 was its last; 1 user tab, a New Tab page
socket live
ready (still at 05:02Z)
The after leg's host also kept the before leg's log as d7060f0099ce.prev.log. Raw results and logs are in ~/cua-148-evidence/ on the mini (before.json, after.json, the pre-run copy of the host log).
The second mechanism (the comment above). After 2026-10-16 10:51Z, the ssfs host served sessions until 00:52Z on 10-17. Then, at 01:39:03Z, its port closed with no cua activity: the last session had ended 47 minutes earlier. The launcher log shows no reconnect attempt at all, before or after that close. While a profile is loaded, the extension retries every 5 s and on its minute alarm, so no attempts means the profile was unloaded, i.e. it had no window. A local Terminal login on the mini (login -pf, ttys007) began 39 s later, at 01:39:42Z, so someone was at the mini's screen. The extension's reconnect path is not at fault. I've asked the owner whether they closed that window. If no person did, a new ticket tracks what closes windows. The .prev.log now kept beside each host log will show how the next drop ended.
Review: reviewer-medium, two rounds. Round 1 found five issues: four fixed in 191de7d, one accepted by design (a refused beforeunload costs at most one extra New Tab page). Round 2 found a late check past its bound, logged in tech-debt-tracker.md together with the about:blank guard refusal seen in the mini's host log. CI is green on a1005c2.
Follow-up on the second drop (2026-10-17 01:39:03Z, ssfs host port_closed 47 min after the last cua session, launcher.log with no reconnect attempt, i.e. the profile unloaded because it had no window): the owner does not remember whether they closed the window. Not treated as a defect yet. On the next ssfs drop on the mini, read ~/Library/Application Support/cua/chrome/d7060f0099ce.prev.log (the host that ended) and launcher.log: a host built at 76c3b84 or later logs window W kept open with a New Tab page whenever a cua close would have taken a window's last tab, so a drop with no such line and no cua session open around it means something outside cua closed the window (a person, Chrome itself, or another client). If that is what the log shows, register a ticket for it then.
Activity
SSFSKIM commentedon Oct 16, 2026
[board] ready-for-implementer: Found during #116 M5 (mini ssfs window lost four times). Cause is the cua extension/host close path from #10/#113, not #116's REPL host.
SSFSKIM commentedon Oct 16, 2026
Second mechanism to investigate alongside the last-tab guard (2026-10-16, #116 M5 on the mini): both bound profiles (ssfs and school) went host_not_live between 10:35:14Z and 10:50:37Z with no cua activity at all. No harness run, prepare, cleanup or tab operation was active. Both MAWS runner jobs in that window were e2e:design-spike, which doesn't touch Chrome. The ida-solution runner has been idle since August. The resident agent's log hasn't been written since 2026-10-15 02:39, so no remote session ran. Chrome's main process had been up since 02:12:51Z with no restart, and no native-messaging host process was alive for either profile. Opening a window of the profile restores it. So besides an agent closing the last tab of a window, the extension's service worker or its native port can apparently end while Chrome keeps running. Check the extension's reconnect path in extension/background.js: does it reconnect the native host without a window event? Check too what ends the port with no client activity (MV3 service-worker lifetime, host exit on idle).
SSFSKIM commentedon Oct 17, 2026
[board] in-progress: Building it in the host (src/chrome/host.mjs), not the extension: the agent's own tab.close() reaches Chrome as Target.closeTarget through debugger.sendCommand, which the extension's tabs.remove never sees, and the host ships with the checkout while an unpacked extension updates only when its user reloads it. Branch fix/last-tab-guard.
Host last-tab guard: review fixes (#148)
Merge pull request #150 from SSFSKIM/fix/last-tab-guard
SSFSKIM commentedon Oct 17, 2026
Live proof on the mini (
ssfs= Profile 1, Chrome running with--no-startup-window), the same scenario before and after #150.Scenario. The profile had no window. A runner opened its own loopback page there with
open -n -a "Google Chrome" --args --profile-directory="Profile 1" <url>, so that page was the profile's only window. A backend client of the profile's cua host, speaking the protocol the browser service speaks, then:Target.closeTarget(what the service'stab.close()sends), leaving the agent's tab as the window's only tab;Only counts of tabs were recorded.
profiles listssfsnative port closed (end)in the same ms as the close;tabs.removerefused "extension disconnected"host_not_livewindow 1030418007 kept open with a New Tab page: tab 1030418034 was its last; 1 user tab, a New Tab pageready(still at 05:02Z)The after leg's host also kept the before leg's log as
d7060f0099ce.prev.log. Raw results and logs are in~/cua-148-evidence/on the mini (before.json,after.json, the pre-run copy of the host log).The second mechanism (the comment above). After 2026-10-16 10:51Z, the ssfs host served sessions until 00:52Z on 10-17. Then, at 01:39:03Z, its port closed with no cua activity: the last session had ended 47 minutes earlier. The launcher log shows no reconnect attempt at all, before or after that close. While a profile is loaded, the extension retries every 5 s and on its minute alarm, so no attempts means the profile was unloaded, i.e. it had no window. A local Terminal login on the mini (
login -pf, ttys007) began 39 s later, at 01:39:42Z, so someone was at the mini's screen. The extension's reconnect path is not at fault. I've asked the owner whether they closed that window. If no person did, a new ticket tracks what closes windows. The.prev.lognow kept beside each host log will show how the next drop ended.Review: reviewer-medium, two rounds. Round 1 found five issues: four fixed in 191de7d, one accepted by design (a refused beforeunload costs at most one extra New Tab page). Round 2 found a late check past its bound, logged in
tech-debt-tracker.mdtogether with the about:blank guard refusal seen in the mini's host log. CI is green on a1005c2.SSFSKIM commentedon Oct 17, 2026
[board] done: Merged in #150 (76c3b84); live before/after proof on the mini in the comment above.
SSFSKIM commentedon Oct 17, 2026
Follow-up on the second drop (2026-10-17 01:39:03Z, ssfs host
port_closed47 min after the last cua session, launcher.log with no reconnect attempt, i.e. the profile unloaded because it had no window): the owner does not remember whether they closed the window. Not treated as a defect yet. On the next ssfs drop on the mini, read~/Library/Application Support/cua/chrome/d7060f0099ce.prev.log(the host that ended) andlauncher.log: a host built at 76c3b84 or later logswindow W kept open with a New Tab pagewhenever a cua close would have taken a window's last tab, so a drop with no such line and no cua session open around it means something outside cua closed the window (a person, Chrome itself, or another client). If that is what the log shows, register a ticket for it then.maws-selection: the Chrome-shaped peer starts with the person's tab, …
MAWS in-app browser: profile keys as browser ids, MAWS named, visible…