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
fix(browser): keep the shell responsive during leave confirmation #48
Unsaved-page confirmation preserves Stay/Leave behavior while unrelated browser and bridge work can continue.
Acceptance criteria
The confirmation lifecycle does not synchronously block the Electron main process.
Stay preserves the tab and unsaved page; Leave completes the requested navigation/closure once.
Concurrent close/navigation requests are handled without duplicate dialogs or stale approval.
Revocation, cancellation and absolute deadlines remain enforced after the answer.
A native fixture holds the confirmation while demonstrating independent main-process progress and tests Stay, Leave and cancellation.
Blocked by
None - can start immediately.
Context
Source: revised CM_Browser review and whole-tab Agent Access requirement, 2 October 2026. This is follow-up work to the previously completed bounded browser implementation; existing issues remain closed.
Preserve main-process ownership, explicit revocation, stale-target protection and isolation from unrelated tabs. Coordinate with ongoing browser changes and the separate Microsoft sign-in fix. Native validation must distinguish fixture results from actual authenticated-site evidence. Do not restart the installed app or server, modify real calendar events, or enter/change/submit timesheets.
Implementation checkpoint saved; remaining acceptance work stays open.
Nonblocking asynchronous confirmation for known address/history/reload/close intents is committed and its native fixture was rerun successfully. Unknown page-originated requests, including form submissions, are vetoed with guidance because they cannot be safely replayed. Keeping this broader issue open for that remaining limitation.
Local commit: 7f746e8fcb7d2ad819b107aac2c0d7d9462d1361 on branch browser-gaps. This commit has not been pushed, merged or released.
Fresh checkpoint validation: 410 tests / 6,620 assertions pass; all five affected package typechecks and the browser plugin build pass; native navigation and leave-confirmation reruns pass; scoped lint has 0 errors and 356 style warnings; formatting and whitespace checks pass. Earlier native fixture results are documented in the committed cm-browser README. These checks do not qualify authenticated Teams, macOS or a packaged app.
The remaining page-origin Leave continuation is still open. No checked stock Electron upgrade provides an asynchronous beforeunload response handle: the pinned 44.3.0, stable 44.5.1, prerelease 45.0.0-alpha.14 and pinned upstream main all settle the native callback immediately.
The concrete native API proposal is pushed in ae22424368. It specifies original callback retention, one-shot settlement, cancellation/deadline ownership, original POST preservation, renderer-sharing and CDP arbitration limits, a native qualification matrix, and the custom runtime build/distribution boundary. It is a design proposal; no custom binary or CookieMonster adapter was implemented or qualified.
The existing synthetic native qualification remains valid for main-owned navigation and the safe veto of unsupported page-origin requests. Those requests preserve unsaved state but cannot continue after an asynchronous Leave answer in stock Electron. This issue remains open until the runtime capability and real native tests exist. No real account data, calendar changes or report transmission were used for this investigation.
Validation of this documentation commit: formatting and whitespace checks passed; the push hook completed 31 typecheck tasks successfully (30 cached). Branch and remote commit were independently matched.
Stock-runtime cancellation follow-up is pushed in 538805a5f5. Issue #48 remains open.
Stop now dismisses the exact pending leave confirmation and cannot be undone by a late Leave answer. Waiting confirmations actively cancel on captured task/access changes, document/window/renderer lifecycle loss, agent cancellation and the original absolute deadline. Dialog and native-operation leases stay held until settlement. A pre-existing router bug was reproduced against unchanged committed sources and fixed: normal tab destruction now reports a successful native close, while explicit revocation of a live tab still cancels.
Validation:
178 focused desktop unit tests / 1,212 assertions pass.
Native leave-confirmation and the complete tab-lifecycle fixtures pass on Windows Electron 44.3.0 / Chromium 152.0.7977.78, including paused-renderer cancellation, media revocation/recovery and actual Windows lifecycle-consent dialog abortion.
Desktop typecheck and the push hook's 31 package typecheck tasks pass, with 30 cached tasks. Scoped lint has zero errors and 111 warnings; formatting and whitespace checks pass.
Local HEAD and the remote branch were independently matched. Only the ten coherent browser files were committed; unrelated mode changes and artifacts remain untouched.
Qualification and limitations record the red/green reproductions, stale synchronous fixture controls corrected during validation, and a concurrent GUI-fixture timeout followed by a passing serial rerun.
This does not implement native callback retention for page links/forms. They continue to preserve drafts through safe veto. The current leave dialog is parent-modal and suspends browser views, so main-process progress alone does not qualify physical interaction with other tabs or the parent shell. No custom runtime/adapter, macOS or packaged qualification, authenticated-site unsaved-state qualification, or release was added. The signed-in live app was not restarted; no real calendar, timesheet or chat data changed.
Stock Electron shell checkpoint: implemented and pushed in 6539847.
Leave confirmation now uses an independent native dialog owner, so the shell and other browser tabs remain usable while the decision waits. The source tab is excluded from conflicting agent operations until the dialog settles. Stop, cancellation, access revocation, task changes, and stale-document handling preserve the existing decision safeguards.
Validation completed:
Physical Windows keyboard input reached both the shell and another browser tab, with an explicit assertion that the real Leave dialog was still waiting.
Native leave-confirmation and tab-lifecycle fixtures passed, covering Stay, Leave, cancellation, and unrelated-tab agent input.
182 unit tests passed; desktop typecheck, scoped lint (zero errors), formatting checks, and branded desktop build passed.
Local HEAD and the remote browser-gaps branch both resolve to the exact commit above.
The running signed-in app has not been restarted; this build will take effect after restart. macOS, packaged runtime, and authenticated-site qualification were not performed for this checkpoint.
Keeping this issue open for the page-origin link/form continuation that requires custom Electron work. The user explicitly deferred that runtime rebuild; stock Electron still vetoes these navigations rather than replaying site actions. Details are recorded in packages/desktop/src/main/browser/leave-confirmation-qualification.md and async-leave-native-proposal.md.
Investigated again on 17 October 2026. This issue is not complete and remains open.
A real macOS history retry bug was reproduced twice on unchanged sources: an immediate asynchronous Leave answer could retry back/forward before Chromium finished unwinding its unload-veto callback, returning with the original page still loaded. Fixed locally in 3bc4e39cd8fca399c78ae594e0be0aaddab9a655 (fix(browser): defer approved history retries) on branch leave-history. The commit has not been pushed or merged.
The two-line production fix yields to the next event-loop iteration, then revalidates authority before retrying the captured main-owned intent. The existing history regression is now independently runnable with bun scripts/browser-smoke.ts --leave-history and remains included in the full fixture.
Focused results from packages/desktop:
Native history fixture: failed before the fix; passes afterward for back, forward and reload on macOS arm64 / Electron 44.3.0.
bun test src/main/browser/leave-confirmation.test.ts: eight tests pass, including cancellation, authority revalidation and absolute deadlines.
bun typecheck: passes.
Scoped lint: zero errors, 94 warnings. Changed fixture/document formatting and whitespace pass; existing unrelated formatting differences in tabs.ts were preserved.
A separate temporary entry point ran the existing page-origin fixture against production browser code on macOS. Link/GET/POST requests were immediately vetoed, exact drafts survived, late CDP acceptance failed, independent HTTP work progressed, and a new explicit submission delivered the expected payload once. This confirms the stock runtime limitation; it does not qualify asynchronous Leave continuation. The complete leave-confirmation fixture was not qualified on this Mac: its baseline failed in history, and probes advancing past history did not complete subsequent cancellation checks.
The remaining page-origin link/form continuation needs the native callback capability described in async-leave-native-proposal.md, a compiled runtime and native qualification. No patch or binary was fabricated. This Mac has roughly 20 GB free and no Electron/Chromium build checkout; a build host/path has been requested. No installed app/server was restarted, no authenticated account data was touched, and no custom runtime was adopted. Windows and packaged qualification remain outstanding.
Paused the remaining custom Electron work at the user's request. The verified history retry fix is now pushed on leave-history at 3bc4e39cd8. Its required push hook passed all 32 typecheck tasks. Nothing was merged or released; #48 remains open for the native page-origin continuation described above.
Activity
trmosala commentedon Oct 2, 2026
Implementation checkpoint saved; remaining acceptance work stays open.
Nonblocking asynchronous confirmation for known address/history/reload/close intents is committed and its native fixture was rerun successfully. Unknown page-originated requests, including form submissions, are vetoed with guidance because they cannot be safely replayed. Keeping this broader issue open for that remaining limitation.
Local commit:
7f746e8fcb7d2ad819b107aac2c0d7d9462d1361on branchbrowser-gaps. This commit has not been pushed, merged or released.Fresh checkpoint validation: 410 tests / 6,620 assertions pass; all five affected package typechecks and the browser plugin build pass; native navigation and leave-confirmation reruns pass; scoped lint has 0 errors and 356 style warnings; formatting and whitespace checks pass. Earlier native fixture results are documented in the committed cm-browser README. These checks do not qualify authenticated Teams, macOS or a packaged app.
Native UI screenshot and validation archive. No installed app/server was restarted and no real account data was modified.
trmosala commentedon Oct 3, 2026
The remaining page-origin Leave continuation is still open. No checked stock Electron upgrade provides an asynchronous beforeunload response handle: the pinned 44.3.0, stable 44.5.1, prerelease 45.0.0-alpha.14 and pinned upstream main all settle the native callback immediately.
The concrete native API proposal is pushed in
ae22424368. It specifies original callback retention, one-shot settlement, cancellation/deadline ownership, original POST preservation, renderer-sharing and CDP arbitration limits, a native qualification matrix, and the custom runtime build/distribution boundary. It is a design proposal; no custom binary or CookieMonster adapter was implemented or qualified.The existing synthetic native qualification remains valid for main-owned navigation and the safe veto of unsupported page-origin requests. Those requests preserve unsaved state but cannot continue after an asynchronous Leave answer in stock Electron. This issue remains open until the runtime capability and real native tests exist. No real account data, calendar changes or report transmission were used for this investigation.
Validation of this documentation commit: formatting and whitespace checks passed; the push hook completed 31 typecheck tasks successfully (30 cached). Branch and remote commit were independently matched.
fix(browser): cancel stale leave confirmations
trmosala commentedon Oct 3, 2026
Stock-runtime cancellation follow-up is pushed in
538805a5f5. Issue #48 remains open.Stop now dismisses the exact pending leave confirmation and cannot be undone by a late Leave answer. Waiting confirmations actively cancel on captured task/access changes, document/window/renderer lifecycle loss, agent cancellation and the original absolute deadline. Dialog and native-operation leases stay held until settlement. A pre-existing router bug was reproduced against unchanged committed sources and fixed: normal tab destruction now reports a successful native close, while explicit revocation of a live tab still cancels.
Validation:
Qualification and limitations record the red/green reproductions, stale synchronous fixture controls corrected during validation, and a concurrent GUI-fixture timeout followed by a passing serial rerun.
This does not implement native callback retention for page links/forms. They continue to preserve drafts through safe veto. The current leave dialog is parent-modal and suspends browser views, so main-process progress alone does not qualify physical interaction with other tabs or the parent shell. No custom runtime/adapter, macOS or packaged qualification, authenticated-site unsaved-state qualification, or release was added. The signed-in live app was not restarted; no real calendar, timesheet or chat data changed.
trmosala commentedon Oct 3, 2026
Stock Electron shell checkpoint: implemented and pushed in 6539847.
Leave confirmation now uses an independent native dialog owner, so the shell and other browser tabs remain usable while the decision waits. The source tab is excluded from conflicting agent operations until the dialog settles. Stop, cancellation, access revocation, task changes, and stale-document handling preserve the existing decision safeguards.
Validation completed:
The running signed-in app has not been restarted; this build will take effect after restart. macOS, packaged runtime, and authenticated-site qualification were not performed for this checkpoint.
Keeping this issue open for the page-origin link/form continuation that requires custom Electron work. The user explicitly deferred that runtime rebuild; stock Electron still vetoes these navigations rather than replaying site actions. Details are recorded in packages/desktop/src/main/browser/leave-confirmation-qualification.md and async-leave-native-proposal.md.
trmosala commentedon Oct 17, 2026
Investigated again on 17 October 2026. This issue is not complete and remains open.
A real macOS history retry bug was reproduced twice on unchanged sources: an immediate asynchronous Leave answer could retry back/forward before Chromium finished unwinding its unload-veto callback, returning with the original page still loaded. Fixed locally in
3bc4e39cd8fca399c78ae594e0be0aaddab9a655(fix(browser): defer approved history retries) on branchleave-history. The commit has not been pushed or merged.The two-line production fix yields to the next event-loop iteration, then revalidates authority before retrying the captured main-owned intent. The existing history regression is now independently runnable with
bun scripts/browser-smoke.ts --leave-historyand remains included in the full fixture.Focused results from
packages/desktop:bun test src/main/browser/leave-confirmation.test.ts: eight tests pass, including cancellation, authority revalidation and absolute deadlines.bun typecheck: passes.tabs.tswere preserved.A separate temporary entry point ran the existing page-origin fixture against production browser code on macOS. Link/GET/POST requests were immediately vetoed, exact drafts survived, late CDP acceptance failed, independent HTTP work progressed, and a new explicit submission delivered the expected payload once. This confirms the stock runtime limitation; it does not qualify asynchronous Leave continuation. The complete leave-confirmation fixture was not qualified on this Mac: its baseline failed in history, and probes advancing past history did not complete subsequent cancellation checks.
Current upstream Electron still resolves the beforeunload callback synchronously in
WebContents::RunBeforeUnloadDialog:https://github.com/electron/electron/blob/main/shell/browser/api/electron_api_web_contents.cc
The remaining page-origin link/form continuation needs the native callback capability described in
async-leave-native-proposal.md, a compiled runtime and native qualification. No patch or binary was fabricated. This Mac has roughly 20 GB free and no Electron/Chromium build checkout; a build host/path has been requested. No installed app/server was restarted, no authenticated account data was touched, and no custom runtime was adopted. Windows and packaged qualification remain outstanding.trmosala commentedon Oct 17, 2026
Paused the remaining custom Electron work at the user's request. The verified history retry fix is now pushed on
leave-historyat3bc4e39cd8. Its required push hook passed all 32 typecheck tasks. Nothing was merged or released; #48 remains open for the native page-origin continuation described above.fix(browser): defer approved history retries