Skip to content

docs(browser): document where to find bridge.json on the host#48

Merged
stephane-segning merged 1 commit into
mainfrom
claude/docs-bridge-json
Jun 14, 2026
Merged

docs(browser): document where to find bridge.json on the host#48
stephane-segning merged 1 commit into
mainfrom
claude/docs-bridge-json

Conversation

@stephane-segning

Copy link
Copy Markdown
Contributor

What

Documents where to find bridge.json on the host — the per-user file the plugin and MCP server use to persist the bridge port + token across sessions. It previously had only a one-line inline mention.

docs/browser.md — new "The bridge state file (bridge.json)" section

  • Exact per-OS path in a table, including the env-var defaults:
    • macOS — ~/Library/Application Support/opencode-browser/bridge.json
    • Linux — $XDG_STATE_HOME/opencode-browser/bridge.json (default ~/.local/state/...)
    • Windows — %APPDATA%\opencode-browser\bridge.json (default %USERPROFILE%\AppData\Roaming\...)
  • The file's JSON shape ({ "port", "token" }), the 0600/0700 permissions.
  • Copy-paste read commands (cat for macOS/Linux, Get-Content for PowerShell) so you can grab the token without digging through the log.
  • How to reset the token (delete the file or set an explicit token), explicit-token precedence, and the legacy temp-dir fallback ($TMPDIR/opencode-browser-bridge.json) that older builds used — the reason the token used to change on reboot.

Cross-links

Wired the new section into the token-sharing bullet, the troubleshooting "no token set" row, and the package README.md (which also gets a short three-path summary).

Verification

  • Anchors checked: heading ### The bridge state file (\bridge.json`)→ all#the-bridge-state-file-bridgejsonlinks match; README../../docs/browser.md` target resolves.
  • pnpm lint + pnpm format:check → clean.

Docs only; no behavior change, no version bump.

🤖 Generated with Claude Code

The persistent bridge state file (port + token) had only a terse inline
mention. Add a dedicated "The bridge state file (bridge.json)" section to
docs/browser.md with the exact per-OS path (macOS / Linux / Windows, incl.
defaults), the file's JSON shape, the 0600/0700 perms, read-it commands
(sh + PowerShell), how to reset the token, explicit-token precedence, and
the legacy temp-dir fallback. Cross-link it from the token-sharing bullet,
the troubleshooting "no token set" row, and the package README.

Docs only; no version bump.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the documentation in docs/browser.md and packages/opencode-browser/README.md to detail how the bridge port and token are persisted in the bridge.json state file across macOS, Linux, and Windows. It adds a new section explaining the file's location, structure, and usage, as well as how to retrieve or reset the token. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@stephane-segning stephane-segning merged commit f4b7a26 into main Jun 14, 2026
3 checks passed
@stephane-segning stephane-segning deleted the claude/docs-bridge-json branch June 14, 2026 14:08

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 04455c8916

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/browser.md
Comment on lines +373 to +375
- **Reset the token.** Delete `bridge.json` (or set an explicit `token` / `OCB_TOKEN`). The next
launch generates a fresh token, rewrites the file, and logs it once as `browser_bridge_token` —
re-paste it into the extension dashboard.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include the legacy file in reset instructions

For upgraded installs that still have $TMPDIR/opencode-browser-bridge.json / %TEMP%\opencode-browser-bridge.json, deleting only the new bridge.json does not reset the token: readBridgeFile() falls back to the legacy file when the persistent file is missing, then writes that old token back to the new path. Users following this reset advice after an upgrade will keep reusing the old secret instead of getting a fresh one, so the instructions should also tell them to delete the legacy temp file or set an explicit token.

Useful? React with 👍 / 👎.

Comment thread docs/browser.md
Comment on lines +376 to +377
- **Explicit token wins.** An explicit `token` (plugin option) / `OCB_TOKEN` (MCP) overrides
whatever is in the file; it's still written back so other adapters on the host converge on it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clarify explicit-token changes require replacing the host

When an adapter is already hosting with a different token, setting token/OCB_TOKEN in a new adapter does not make everyone converge: the new adapter writes the new token to bridge.json before election, then connects as a guest with that token while the existing broker still validates against its in-memory token and closes the handshake. This can leave all subsequent adapters that read the file unable to join until the old host is restarted, so the docs should say to stop/restart the current host rather than implying a live override.

Useful? React with 👍 / 👎.

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