Skip to content

Commit 2636454

Browse files
authored
fix(remote): support explicit local override (#481)
1 parent 70ad54d commit 2636454

File tree

23 files changed

+266
-44
lines changed

23 files changed

+266
-44
lines changed

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ claude --plugin-dir ./apps/hook
9797

9898
| Variable | Description |
9999
|----------|-------------|
100-
| `PLANNOTATOR_REMOTE` | Set to `1` or `true` for remote mode (devcontainer, SSH). Uses fixed port and skips browser open. |
100+
| `PLANNOTATOR_REMOTE` | Set to `1` / `true` for remote mode, `0` / `false` for local mode, or leave unset for SSH auto-detection. Uses a fixed port in remote mode; browser-opening behavior depends on the environment. |
101101
| `PLANNOTATOR_PORT` | Fixed port to use. Default: random locally, `19432` for remote sessions. |
102102
| `PLANNOTATOR_BROWSER` | Custom browser to open plans in. macOS: app name or path. Linux/Windows: executable path. |
103103
| `PLANNOTATOR_SHARE` | Set to `disabled` to turn off URL sharing entirely. Default: enabled. |
104104
| `PLANNOTATOR_SHARE_URL` | Custom base URL for share links (self-hosted portal). Default: `https://share.plannotator.ai`. |
105105
| `PLANNOTATOR_PASTE_URL` | Base URL of the paste service API for short URL sharing. Default: `https://plannotator-paste.plannotator.workers.dev`. |
106106

107-
**Legacy:** `SSH_TTY` and `SSH_CONNECTION` are still detected. Prefer `PLANNOTATOR_REMOTE=1` for explicit control.
107+
**Legacy:** `SSH_TTY` and `SSH_CONNECTION` are still detected when `PLANNOTATOR_REMOTE` is unset. Set `PLANNOTATOR_REMOTE=1` / `true` to force remote mode or `0` / `false` to force local mode.
108108

109109
**Devcontainer/SSH usage:**
110110
```bash

apps/codex/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ The message opens in the annotation UI where you can highlight text, add comment
5050

5151
| Variable | Description |
5252
|----------|-------------|
53-
| `PLANNOTATOR_REMOTE` | Set to `1` for remote mode (devcontainer, SSH). Uses fixed port and skips browser open. |
53+
| `PLANNOTATOR_REMOTE` | Set to `1` / `true` for remote mode, `0` / `false` for local mode, or leave unset for SSH auto-detection. Uses a fixed port in remote mode; browser-opening behavior depends on the environment. |
5454
| `PLANNOTATOR_PORT` | Fixed port to use. Default: random locally, `19432` for remote sessions. |
5555
| `PLANNOTATOR_BROWSER` | Custom browser to open. macOS: app name or path. Linux/Windows: executable path. |
5656

apps/copilot/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ When you use plan mode in Copilot CLI:
5252

5353
| Variable | Description |
5454
|----------|-------------|
55-
| `PLANNOTATOR_REMOTE` | Set to `1` for remote mode (devcontainer, SSH). Uses fixed port and skips browser open. |
55+
| `PLANNOTATOR_REMOTE` | Set to `1` / `true` for remote mode, `0` / `false` for local mode, or leave unset for SSH auto-detection. Uses a fixed port in remote mode; browser-opening behavior depends on the environment. |
5656
| `PLANNOTATOR_PORT` | Fixed port to use. Default: random locally, `19432` for remote sessions. |
5757
| `PLANNOTATOR_BROWSER` | Custom browser to open. macOS: app name or path. Linux/Windows: executable path. |
5858
| `PLANNOTATOR_SHARE` | Set to `disabled` to turn off URL sharing. |

apps/hook/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ When Claude Code calls `ExitPlanMode`, this hook intercepts and:
7575

7676
| Variable | Description |
7777
|----------|-------------|
78-
| `PLANNOTATOR_REMOTE` | Set to `1` for remote mode (devcontainer, SSH). Uses fixed port and skips browser open. |
78+
| `PLANNOTATOR_REMOTE` | Set to `1` / `true` for remote mode, `0` / `false` for local mode, or leave unset for SSH auto-detection. Uses a fixed port in remote mode; browser-opening behavior depends on the environment. |
7979
| `PLANNOTATOR_PORT` | Fixed port to use. Default: random locally, `19432` for remote sessions. |
8080
| `PLANNOTATOR_BROWSER` | Custom browser to open plans in. macOS: app name or path. Linux/Windows: executable path. |
8181
| `PLANNOTATOR_SHARE_URL` | Custom share portal URL for self-hosting. Default: `https://share.plannotator.ai`. |
8282

8383
## Remote / Devcontainer Usage
8484

85-
When running Claude Code in a remote environment (SSH, devcontainer, WSL), set these environment variables:
85+
When running Claude Code in a remote environment (SSH, devcontainer, WSL), set `PLANNOTATOR_REMOTE=1` (or `true`) and these environment variables:
8686

8787
```bash
8888
export PLANNOTATOR_REMOTE=1
@@ -91,7 +91,7 @@ export PLANNOTATOR_PORT=9999 # Choose a port you'll forward
9191

9292
This tells Plannotator to:
9393
- Use a fixed port instead of a random one (so you can set up port forwarding)
94-
- Skip auto-opening the browser (since you'll open it manually on your local machine)
94+
- Use remote-friendly port/browser handling for forwarded environments
9595
- Print the URL to the terminal for you to access
9696

9797
**Port forwarding in VS Code devcontainers:** The port should be automatically forwarded. Check the "Ports" tab.

apps/hook/server/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
* --browser <name> - Override which browser to open (e.g. "Google Chrome")
4848
*
4949
* Environment variables:
50-
* PLANNOTATOR_REMOTE - Set to "1" or "true" for remote mode (preferred)
50+
* PLANNOTATOR_REMOTE - Set to "1"/"true" for remote, "0"/"false" for local
5151
* PLANNOTATOR_PORT - Fixed port to use (default: random locally, 19432 for remote)
5252
*/
5353

apps/marketing/src/content/docs/getting-started/configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Plannotator is configured through environment variables and hook/plugin configur
1212

1313
| Variable | Default | Description |
1414
|----------|---------|-------------|
15-
| `PLANNOTATOR_REMOTE` | auto-detect | Set to `1` or `true` to force remote mode. Uses a fixed port and skips browser auto-open. |
15+
| `PLANNOTATOR_REMOTE` | auto-detect | Set to `1` or `true` to force remote mode, `0` or `false` to force local mode, or leave unset to auto-detect via `SSH_TTY` / `SSH_CONNECTION`. Uses a fixed port in remote mode; browser-opening behavior depends on the environment. |
1616
| `PLANNOTATOR_PORT` | random (local) / `19432` (remote) | Fixed server port. Useful for port forwarding in remote environments. |
1717
| `PLANNOTATOR_BROWSER` | system default | Custom browser or script to open the UI. |
1818
| `PLANNOTATOR_SHARE` | enabled | Set to `disabled` to turn off URL sharing entirely. |
@@ -65,7 +65,7 @@ Approved and denied plans are saved to `~/.plannotator/plans/` by default. You c
6565

6666
## Remote mode
6767

68-
When working over SSH, in a devcontainer, or in Docker, set `PLANNOTATOR_REMOTE=1` and `PLANNOTATOR_PORT` to a port you'll forward. See the [remote & devcontainers guide](/docs/guides/remote-and-devcontainers/) for setup instructions.
68+
When working over SSH, in a devcontainer, or in Docker, set `PLANNOTATOR_REMOTE=1` (or `true`) and `PLANNOTATOR_PORT` to a port you'll forward. Set `PLANNOTATOR_REMOTE=0` / `false` if you need to force local behavior even when SSH env vars are present. See the [remote & devcontainers guide](/docs/guides/remote-and-devcontainers/) for setup instructions.
6969

7070
## Custom browser
7171

apps/marketing/src/content/docs/guides/remote-and-devcontainers.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ sidebar:
66
section: "Guides"
77
---
88

9-
Plannotator works in remote environments — SSH sessions, VS Code Remote, devcontainers, and Docker. The key difference is that the browser can't auto-open on a headless server, so you need a fixed port and manual URL access.
9+
Plannotator works in remote environments — SSH sessions, VS Code Remote, devcontainers, and Docker. The key difference is that remote sessions benefit from a fixed port for forwarding, and browser-opening behavior depends on your environment.
1010

1111
## Remote mode
1212

13-
Set `PLANNOTATOR_REMOTE=1` to enable remote mode:
13+
Set `PLANNOTATOR_REMOTE=1` (or `true`) to force remote mode:
1414

1515
```bash
1616
export PLANNOTATOR_REMOTE=1
@@ -20,11 +20,11 @@ export PLANNOTATOR_PORT=9999 # Choose a port you'll forward
2020
Remote mode changes two behaviors:
2121

2222
1. **Fixed port** — Uses `PLANNOTATOR_PORT` (default: `19432`) instead of a random port, so you can set up port forwarding once
23-
2. **No browser auto-open**Prints the URL to the terminal instead of trying to open a browser
23+
2. **Browser handling changes**In headless setups you may need to open the forwarded URL manually instead of relying on browser auto-open
2424

2525
### Legacy detection
2626

27-
Plannotator also detects `SSH_TTY` and `SSH_CONNECTION` environment variables for automatic remote mode. However, `PLANNOTATOR_REMOTE=1` is preferred for explicit control.
27+
Plannotator also detects `SSH_TTY` and `SSH_CONNECTION` environment variables for automatic remote mode when `PLANNOTATOR_REMOTE` is unset. Use `PLANNOTATOR_REMOTE=1` / `true` to force remote mode or `PLANNOTATOR_REMOTE=0` / `false` to force local mode.
2828

2929
## VS Code Remote / devcontainers
3030

@@ -62,7 +62,7 @@ Or forward ad-hoc when connecting:
6262
ssh -L 9999:localhost:9999 your-server
6363
```
6464

65-
Then open `http://localhost:9999` locally when Plannotator prints the URL.
65+
Then open `http://localhost:9999` locally if Plannotator does not open a browser for you.
6666

6767
## Docker (without VS Code)
6868

apps/marketing/src/content/docs/reference/environment-variables.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ All Plannotator environment variables and their defaults.
1212

1313
| Variable | Default | Description |
1414
|----------|---------|-------------|
15-
| `PLANNOTATOR_REMOTE` | auto-detect | Set to `1` or `true` to force remote mode. Uses fixed port and skips browser auto-open. |
15+
| `PLANNOTATOR_REMOTE` | auto-detect | Set to `1` or `true` to force remote mode, `0` or `false` to force local mode, or leave unset to auto-detect via `SSH_TTY` / `SSH_CONNECTION`. Uses a fixed port in remote mode; browser-opening behavior depends on the environment. |
1616
| `PLANNOTATOR_PORT` | random (local) / `19432` (remote) | Fixed server port. When not set, local sessions use a random port; remote sessions default to `19432`. |
1717
| `PLANNOTATOR_BROWSER` | system default | Custom browser to open the UI in. macOS: app name or path. Linux/Windows: executable path. Can also be a script. Takes priority over `BROWSER`. Also settable per-invocation with `--browser`. |
1818
| `BROWSER` | (none) | Standard env var for specifying a browser. VS Code sets this automatically in devcontainers. Used as fallback when `PLANNOTATOR_BROWSER` is not set. |
@@ -46,11 +46,11 @@ When running your own paste service binary, these variables configure it:
4646

4747
## Remote mode behavior
4848

49-
When `PLANNOTATOR_REMOTE=1` or SSH is detected:
49+
When remote mode is forced with `PLANNOTATOR_REMOTE=1` / `true`, or SSH is detected while `PLANNOTATOR_REMOTE` is unset:
5050

5151
- Server binds to `PLANNOTATOR_PORT` (default `19432`) instead of a random port
52-
- Browser auto-open is skipped
53-
- The URL is printed to stderr for manual access
52+
- Browser-opening behavior depends on the environment and configured browser handler
53+
- In headless setups, you may need to open the forwarded URL manually
5454

5555
### Legacy SSH detection
5656

@@ -61,7 +61,7 @@ These environment variables are still detected for backwards compatibility:
6161
| `SSH_TTY` | Set by SSH when a TTY is allocated |
6262
| `SSH_CONNECTION` | Set by SSH with connection details |
6363

64-
If either is present, Plannotator enables remote mode automatically. Prefer `PLANNOTATOR_REMOTE=1` for explicit control.
64+
If either is present, Plannotator enables remote mode automatically when `PLANNOTATOR_REMOTE` is unset. Set `PLANNOTATOR_REMOTE=1` / `true` to force remote mode or `0` / `false` to force local mode.
6565

6666
## Port resolution order
6767

apps/opencode-plugin/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Restart OpenCode. The `submit_plan` tool is now available.
5656
5757
| Variable | Description |
5858
|----------|-------------|
59-
| `PLANNOTATOR_REMOTE` | Set to `1` for remote mode (devcontainer, SSH). Uses fixed port and skips browser open. |
59+
| `PLANNOTATOR_REMOTE` | Set to `1` / `true` for remote mode, `0` / `false` for local mode, or leave unset for SSH auto-detection. Uses a fixed port in remote mode; browser-opening behavior depends on the environment. |
6060
| `PLANNOTATOR_PORT` | Fixed port to use. Default: random locally, `19432` for remote sessions. |
6161
| `PLANNOTATOR_BROWSER` | Custom browser to open plans in. macOS: app name or path. Linux/Windows: executable path. |
6262
| `PLANNOTATOR_SHARE_URL` | Custom share portal URL for self-hosting. Default: `https://share.plannotator.ai`. |
@@ -76,7 +76,7 @@ Works in containerized environments. Set the env vars and forward the port:
7676
}
7777
```
7878
79-
Then open `http://localhost:9999` when `submit_plan` is called.
79+
If nothing opens automatically, open `http://localhost:9999` when `submit_plan` is called.
8080
8181
See [devcontainer.md](./devcontainer.md) for full setup details.
8282

apps/opencode-plugin/devcontainer.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Add these to your `devcontainer.json`:
1818

1919
| Variable | Purpose |
2020
|----------|---------|
21-
| `PLANNOTATOR_REMOTE=1` | Tells Plannotator not to open a browser (required in containers) |
21+
| `PLANNOTATOR_REMOTE=1` | Forces remote mode for container-friendly port/browser handling (required in containers) |
2222
| `PLANNOTATOR_PORT=9999` | Fixed port for the UI (required for port forwarding) |
2323

2424
Both are required. Just setting the port isn't enough.
@@ -35,7 +35,7 @@ Ensure port 9999 (or your chosen port) is forwarded to your host. In VS Code dev
3535
4. Open `http://localhost:9999` in your host browser
3636
5. Approve or deny the plan
3737

38-
**Note:** There's no browser auto-open or notification in remote mode. You'll need to manually navigate to the URL when you see the agent call `submit_plan`.
38+
**Note:** Browser opening depends on your container/browser setup. If nothing opens automatically, navigate to the forwarded URL manually when you see the agent call `submit_plan`.
3939

4040
## OpenCode Web
4141

@@ -49,7 +49,7 @@ Ensure port 9999 (or your chosen port) is forwarded to your host. In VS Code dev
4949

5050
## Legacy Support
5151

52-
If your environment already has `SSH_TTY` or `SSH_CONNECTION` set (common in SSH sessions), Plannotator will detect remote mode automatically. The `PLANNOTATOR_REMOTE` env var is preferred for Docker/devcontainer setups where those aren't present.
52+
If your environment already has `SSH_TTY` or `SSH_CONNECTION` set (common in SSH sessions), Plannotator will detect remote mode automatically when `PLANNOTATOR_REMOTE` is unset. You can also force local mode with `PLANNOTATOR_REMOTE=false` or `0`.
5353

5454
## Troubleshooting
5555

0 commit comments

Comments
 (0)