Repository navigation
Every session prints its URL (re-applies #1184) - #1938
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]>
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.
This re-applies the design of #1184 by @technicalpickles (Josh Nichols) on current main, with credit: the commit carries his
Co-authored-bytrailer. #1184 conflicts with main after about 50 later commits to the same files, so the change was rebuilt here rather than rebased. The design, the stable line format and the OpenCode filter work are his; the review feedback from #1184 is folded in. Part of #1134 (criterion 1, the URL). The port half of #1134 is not in this PR.What changes
Every Bun session now prints one stable line on stderr when it starts, before it launches a browser:
Two leading spaces, the prefix (
SESSION_READY_LINE_PREFIX), then the URL last. Anything else goes on its own line under it, so the URL appears exactly once:Open it on your local machine (forward port N if needed).(orOpen it on your device (the URL above).plus the QR for an overridden host)Could not open a browser automatically — open the URL above.Before, a local session whose browser opened fine printed no URL, so a closed tab left neither the person nor the agent a way back; and because the URL was printed only after the launcher exited, a launcher that never exits hid it (probably #746).
Per host:
isCodexDesktopHostis gone (the new line covers it).--tailscaleannounceTailscaleSession: the ready line once, then the tailnet line and QR.announce: false(its toast or transcript notice already carries the URL, and raw stderr would land in OpenCode's TUI). An OpenCode 2 host withoutsession.syntheticgets the URL throughapp.loginstead, whichOPENCODE_PRINT_LOGS=1shows, as the plugin README promises.sessionOpenedMessage, now its own module) always carries the URL. The after-turn notify runs only for callers without that message (archive, the event API) or after a failed launch. Remote no longer shows the URL twice. This is the one change from #1184, which used the after-turn notify.stdout is untouched in every mode:
--json,--hookand--gatekeep it for the decision record.Things people may notice
Plannotator session ready —(with the dash) must matchPlannotator session readyinstead; the OpenCode filter (old and new plugins) and Amp keep working.Tests
packages/server/shared-handlers.test.ts: the exact bytes for local, remote and failed launches; the URL once; the line is out before the launch;announce: falseprints nothing but still writes the ready file; stdout empty in every branch; the prefix pinned to its literal text.packages/server/tailscale-serve.test.ts: one ready line, above the tailnet line, no browser.apps/hook/server/annotate-cli.test.ts: a real session under--gate --json,--hookand--gatewrites the line to stderr and nothing to stdout.apps/opencode-plugin/cli-bridge.test.ts: the filter on the new lines, an old binary's line, and a line built from the server's own constant;server.test.ts: the OpenCode 2 fallback log.apps/pi-extension/plannotator-browser.test.ts: the opened message carries the URL locally and remotely; no second notice when the caller already showed it; the after-turn notice for callers without one (RPC included).Ran:
bun run typecheck;bun test packages/server apps/hook/server(2198 pass),bun test apps/opencode-plugin(372 pass),bun testinapps/pi-extension(537 pass). Every test opens no browser (NO_BROWSER).PR B (
PLANNOTATOR_BROWSER=noneopens nothing) is stacked on this branch.