← Commit history

Upload 1 file(s)

John Lauer ·3e74076aa3 ·2mo ago ·parent 1c9c86d
1 file changed +20
SKILL.md+20
@@ -461,3 +461,23 @@ but they CAN share the **warm browser SSO session**. So: Caption (`desktop_caption`, <= 3s) ONLY for steps that take over the screen - launching/restoring Fusion. Do NOT caption background work; unnecessary captions are their own kind of rude. Always say WHY, and whether you need anything from the user.++### Clean up after yourself: the sign-in window janitor++John, 2026-07-22: *"if you open a browser window for sign in, you must run a loop on a schedule to+know when to close it so you never leave the user's desktop messy."*++Any browser window WE open for OAuth is ours to close. Do not assume the flow closes it.++- `_track_signin_window(sessionId, profile, kind)` registers every window we open+  (`kind` = `fusion` | `aps`).+- `_signin_janitor_loop()` runs as a daemon thread started in `main()` and polls every 20s. It+  closes a tracked window as soon as its goal is met (`fusion_readiness.ready` for `fusion`,+  APS `signedIn` for `aps`) or it exceeds `_JANITOR_MAX_AGE` (15 min - an OAuth window older than+  that is dead weight, the request expires in ~2 min anyway).+- Closing uses `nbrowser_close_window`, which only closes OUR OWN sessions. **Never** close a+  window the user opened: `nbrowser_force_close` refuses other threads' windows by design, and+  the user's own tabs are off limits.++Same discipline applies to captions: `desktop_caption` auto-clears, but if you ever pass+`persist:true` YOU must hide it.