Repository navigation
PLANNOTATOR_BROWSER=none opens nothing - #1940
Merged
Merged
Conversation
Every Bun session now writes one stable stderr line on start, before it launches a browser: Plannotator session ready: <url> Remote forwarding advice and a failed browser launch become follow-up lines under it, so the URL appears exactly once. A local session whose browser opened fine used to print nothing (#1134), and a launcher that never exits hid the URL until it did. - shared-handlers: SESSION_READY_LINE_PREFIX, an `announce` option, the line printed before the launch; isCodexDesktopHost removed (its case is covered). - --tailscale: announceTailscaleSession prints the ready line once, then the tailnet line and QR. - OpenCode embedded runtime: announce: false (its toast or transcript notice carries the URL); an OpenCode 2 host without session.synthetic logs the URL instead. The CLI bridge's stderr filter also forwards the remote follow-up and the "Could not open a browser" line. - Pi: the in-turn "opened" message always carries the URL; the after-turn notify runs only for the archive and the event API, or after a failed launch (remote no longer shows the URL twice). Re-applies the design of #1184 by @technicalpickles on current main. Co-authored-by: Josh Nichols <[email protected]>
A "none" value on PLANNOTATOR_BROWSER (or --browser): none, false, 0, off, no, true, 1 or :, trimmed and any case, now opens nothing at all, local or remote: no VS Code IPC, no Glimpse, no BROWSER, no system opener. Since #756 these values were read as "unset" and opened the system default (or ran BROWSER, or Glimpse), so there was no way to say "never open". The rule lives in one module, packages/shared/browser-intent.ts (resolveBrowserIntent: none | default | explicit), vendored to Pi. Bun's openBrowser and shouldTryRemoteBrowserFallback and Pi's openBrowser use it, so every caller follows it (sessions, the Inbox, sessions --open, t3 login). The Bun CLI prints " Not opening a browser (PLANNOTATOR_BROWSER=none)." under the ready line; Pi says it in its opened message. BROWSER keeps #756: its no-op values are still ignored and the default chain runs, because hosts set it (Claude Code's agent view sets BROWSER=true). Tests: a pure table for the intent; one process test per runtime whose PATH holds only stand-in open, xdg-open and glimpseui scripts (and a recording VS Code IPC server on Bun), proving nothing launches for none (BROWSER set, local and remote) and that BROWSER=true still runs the default opener.
… unused quiet option, comment fixes
…thing # Conflicts: # apps/opencode-plugin/server.ts # apps/pi-extension/plannotator-browser.test.ts # apps/pi-extension/plannotator-browser.ts # apps/pi-extension/session-opened.ts # packages/server/shared-handlers.test.ts
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #1938 (merged); this branch has main merged in.
What changes
A "none" value on
PLANNOTATOR_BROWSER, or--browser, which sets it:none,false,0,off,no,true,1or:(trimmed, any case), now opens nothing at all, local or remote:BROWSERopen,xdg-open,start)Since #756 these values were read as "unset", so
PLANNOTATOR_BROWSER=noneopened the system default, ranBROWSERwhen it was set, or opened Glimpse. Before #756 every one of them opened nothing. This was seen in #1923, where our own tests opened real tabs.Instead of opening, the session says why, once:
Pi shows the same sentence in its "opened" message, and in the after-turn notice for callers that have no opened message.
BROWSERis unchanged. Hosts set it for their own reasons (Claude Code's agent view setsBROWSER=true), so its #756 values (true,false,none,0,1,:) are still read as unset and the default chain runs.PLANNOTATOR_BROWSER/--browserBROWSERnone false 0 off no true 1 :How
packages/shared/browser-intent.ts, vendored to Pi:resolveBrowserIntent(env)returnsnone,defaultorexplicit. One rule for both runtimes.packages/server/browser.ts:openBrowserreturns false at once fornoneand prints the reason line (so the Inbox,sessions --openandt3 loginfollow it too);shouldTryRemoteBrowserFallbackasks VS Code only for the default chain.handleServerReadyprints the reason under the ready line and never calls the opener, so no "Could not open a browser" line follows. A host that opens the browser itself (PLANNOTATOR_SKIP_BROWSER_OPEN) gets no reason line.sessions --openno longer says "Opened … in browser" when nothing opened.apps/pi-extension/server/network.ts:openBrowserreturns{ opened: false, notOpening }fornone, local or remote;sessionOpenedMessageand the after-turn notice show the sentence; a choice to open nothing is never reported as a failed launch.Changes users will notice
PLANNOTATOR_BROWSERor--browseropen nothing, including for the Inbox andsessions --open.--browser noneis now the per-run "don't open" switch.Unchanged:
BROWSER=truefrom Claude Code's agent view still opens a browser; app names, paths and scripts work as before; Glimpse stays the default.Tests
packages/shared/browser-intent.test.ts: the table for every value,BROWSER's fix(browser): treat no-op BROWSER values as unset so headless sessions can fall back #756 values, explicit handlers, and the approved list exactly. Each sentinel line carriesno-browser-guard: sentinel under test.packages/server/browser-intent-launch.test.ts(Bun) andapps/pi-extension/server/browser-intent-launch.test.ts(Pi): a child process with an explicit environment (nothing inherited), a scratch data dir, and a PATH holding only stand-inopen,xdg-openandglimpseuiscripts that log their calls. On Bun a VS Code IPC registry points at a recording server in the test. Asserts nothing launches forPLANNOTATOR_BROWSER=nonewithBROWSER=<script>, local and remote, and thatBROWSER=truestill launches the default opener (Bun remote: still asks VS Code). Checked that both fail when the "none" rule is switched off.packages/server/shared-handlers.test.ts: exact bytes of the ready line plus the reason line, local and remote; the opener is never called; no reason line withskipBrowserOpen.packages/server/browser.test.ts: the remote case now expects no IPC fornone.apps/pi-extension/plannotator-browser.test.ts: the opened message and the after-turn notice say why; no failure notice.tests/no-browser-sentinel.test.tsstill passes: tests keep usingNO_BROWSER, since older binaries (the version matrix) still read a sentinel as unset. Its comments and the Testing Rules bullet now say so.Ran:
bun run typecheck;bun test packages/server apps/hook/server packages/shared tests apps/opencode-plugin packages/t3-code(4456 pass);bun testinapps/pi-extension(542 pass). No test opened a browser.Docs
CLAUDE.md (the
PLANNOTATOR_BROWSERrow and the Testing Rules bullet); marketingenvironment-variables,configuration,remote-and-devcontainers,troubleshooting; theplannotatorskill's environment table; the root, hook, OpenCode, Codex, Gemini and Copilot READMEs andportal/ANNOTATE.md. Release notes are left for the release.