Skip to content

fix: retry the post-update dashboard auto-open instead of trying once - #5616

Merged
atomantic merged 1 commit into
mainfrom
cos/task-mtiuw03i/agent-303c1c59
Sep 1, 2026
Merged

fix: retry the post-update dashboard auto-open instead of trying once#5616
atomantic merged 1 commit into
mainfrom
cos/task-mtiuw03i/agent-303c1c59

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

update.sh/update.ps1 already open the PortOS dashboard in the managed Chrome browser after an update finishes, but the auto-open script fired a single navigate attempt and gave up silently on failure. A full self-update does pm2 delete + pm2 start of the whole ecosystem (including portos-browser), so Chrome cold-launches right as CPU/disk are busiest from npm install/the client build — that race was regularly lost, leaving Chrome open with no tab pointed at the dashboard.

Changes

  • scripts/open-ui-in-browser.js: replaced the browser-health poll + single navigate attempt with one retry loop (navigateWithRetry) that keeps POSTing /api/browser/navigate for up to 60s, long enough to outlast a cold Chrome launch under load. Refactored into a testable main() guarded by isDirectlyInvoked, matching the pattern used by other scripts/*.js CLI gates (e.g. pm2-daemon-refresh.js).
  • scripts/open-ui-in-browser.test.js: new tests for navigateWithRetry covering an immediate success, retrying past transient connection failures, exhausting the retry budget, and treating a non-ok HTTP response (e.g. a blocked-URL 400) as retryable rather than a throw.

Test plan

  • npx vitest run scripts/open-ui-in-browser.test.js — 4/4 passing
  • npx vitest run (full server suite, which globs ../scripts) — 1808 files / 36809 tests passing

update.sh/update.ps1 already open the dashboard in the PortOS-managed
browser after a restart, but a full `pm2 delete` + `pm2 start` of the
ecosystem makes Chrome a cold launch racing the busiest moment of the
update (npm install, client build). The auto-open script fired one
navigate attempt and gave up silently on failure, so Chrome would come
up with no tab pointed anywhere whenever it lost that race.

Fold the browser-health poll and single navigate attempt into one
retry loop that keeps POSTing /api/browser/navigate for up to 60s,
long enough to outlast a cold Chrome launch under load.
@atomantic
atomantic merged commit 9eb0d63 into main Sep 1, 2026
7 checks passed
@atomantic
atomantic deleted the cos/task-mtiuw03i/agent-303c1c59 branch September 1, 2026 16:15
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