fix: browse env inconsistently updates internal state
Merged
SH
8mo ago+8+8+0123456789-2-2-0123456789
Summary
browse envshowed stale "local" mode afterbrowse env remote- Root cause:
.modefile was only written during lazy browser init (ensureBrowserInitialized), not at daemon startup. Between daemon start and first command,readCurrentMode()returnednulland fell back to hardcoded"local" - Write
.modeeagerly inrunDaemon()at startup so it's immediately available - Fall back to
desiredModeinstead of"local"in theenvdisplay handler as a safety net
Test plan
- Reproduced bug:
browse env remote→browse envshowed"mode":"local" - Verified fix:
browse env remote→browse envnow shows"mode":"remote" -
mode.test.tspasses (3/3)
Summary by cubic
Fixes browse env showing stale "local" after browse env remote (STG-1547). The daemon now writes .mode at startup, the display falls back to desiredMode until mode is written, and a patch changeset is added for @browserbasehq/browse-cli.