Skip to content

fix(chrome): debounce sync-to-chrome export and set the exported profile's display name - #504

Merged
ankitranjan7 merged 2 commits into
mainfrom
fix/chrome-export-followups
Sep 8, 2026
Merged

fix(chrome): debounce sync-to-chrome export and set the exported profile's display name#504
ankitranjan7 merged 2 commits into
mainfrom
fix/chrome-export-followups

Conversation

@ankitranjan7

Copy link
Copy Markdown
Contributor

Summary

Two follow-up fixes found while manually testing the just-shipped v0.8.3 Chrome-profile-export feature:

1. Export was gated on the browser being fully idle-closed, which in practice almost never happens

  • scheduleProfileIdle's idle timer never even gets set while any tab from the profile is still open (hasVisiblePages guard) — and browser run doesn't close its own resulting tab. Confirmed live: a profile sat "connected" for 4+ minutes with a tab open and only exported once its session was explicitly closed, which nobody would know to do.
  • Fix: export is decoupled from closing the browser entirely. A new, independent per-profile debounce timer (3s, reset on every command, not gated on open tabs) triggers the export — copy cookies, register if new — without touching the browser or any open page. The existing close-triggered export remains as a harmless, idempotent backstop.

2. Exported profiles show up in Chrome as "Person 2", "Person 3", etc. instead of their real webcmd alias

  • Chrome auto-registers a newly exported profile-directory but assigns it a generic name, since nothing goes through Chrome's own profile-creation UI.
  • Fix: after the invisible registration-trigger process has actually exited (waiting briefly post-signal, to avoid Chrome's own shutdown flush clobbering our edit), write the profile's Local State display name to match the webcmd alias exactly (e.g. test1 shows as test1). Best-effort and silent on failure — purely cosmetic, never blocks the export. Documented limitation: if native Chrome was already running (registration got absorbed into the existing process rather than spawning a separate one), there's nothing safe to wait on, and the name write may later get overwritten by Chrome's own state flush.

Test plan

  • Full suite: 206 test files, typecheck clean (confirmed under reduced worker concurrency — full-parallelism hits the same pre-existing runner.test.ts browser-context flakiness under high system load documented in prior PRs; all three files this PR touches pass 106/106 in isolation)
  • New tests cover: export firing ~3s after a command with the tab still open, a burst of rapid commands collapsing into one export, the debounced export never closing the browser/page, no debounce for non-sync-to-chrome profiles, display name being set after a spawned registration process is confirmed killed, the best-effort case when Chrome was already running, and display name never being set when registration times out

🤖 Generated with Claude Code

Export cookies ~3s after the last command on a sync-to-chrome profile,
even while tabs stay open. Idle-close export remains as a backstop.
Chrome auto-registers exported profiles as "Person N". Wait for the
registration process to exit, then write Local State name to the alias.
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

🟠 Maintainer review suggested — low confidence

The automated review could not reach a fully supported conclusion.

Limitations

  • The automated review returned an invalid structured result.

This review is advisory and does not block merging.

@ankitranjan7
ankitranjan7 merged commit 186b98b into main Sep 8, 2026
15 checks passed
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.

1 participant