Skip to content

Persist before pagehide teardown - #881

Merged
wieslawsoltes merged 1 commit into
mainfrom
fix/beforeunload-pagehide-persistence-880
Sep 20, 2026
Merged

wieslawsoltes merged 1 commit into
mainfrom
fix/beforeunload-pagehide-persistence-880

Conversation

@wieslawsoltes

Copy link
Copy Markdown
Collaborator

VS Code schedules its immediate shutdown storage flush from beforeunload, then disposes and cancels that timer from pagehide. WebScene dispatched both events synchronously, so freshly accepted MCP secrets never reached IndexedDB before reload.

This splits the terminal lifecycle at the existing bounded #878 persistence boundary: veto-capable beforeunload remains synchronous, its zero-delay/IndexedDB lineage drains, pagehide runs once as the next browser task, and the terminal host request follows only after bounded descendants complete. Delayed timers, intervals, rAF, unrelated work, and tasks beyond the 1,024-task budget remain excluded.

Closes #880.

Validation:

  • webscene_native_terminal_indexeddb_navigation: 1/1 passed in 1.21 seconds
  • regression order: beforeunload,flush-timer,commit,continuation,pagehide
  • restarted engine reads the committed value
  • the retained self-refilling lifecycle test consumes the bounded budget and cannot starve navigation

@wieslawsoltes
wieslawsoltes merged commit ba71aa1 into main Sep 20, 2026
1 of 7 checks passed
@wieslawsoltes
wieslawsoltes deleted the fix/beforeunload-pagehide-persistence-880 branch September 20, 2026 22:38
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.

Run bounded beforeunload persistence tasks before pagehide teardown

1 participant