Skip to content

fix: proxy race condition + IPC discovery for VS Code SSH Remote (#321)#322

Merged
backnotprop merged 2 commits into
backnotprop:mainfrom
7tg:fix/321-proxy-race-condition
Mar 17, 2026
Merged

fix: proxy race condition + IPC discovery for VS Code SSH Remote (#321)#322
backnotprop merged 2 commits into
backnotprop:mainfrom
7tg:fix/321-proxy-race-condition

Conversation

@7tg
Copy link
Copy Markdown
Contributor

@7tg 7tg commented Mar 17, 2026

Links

Closes #321

Summary

When running plannotator over VS Code SSH Remote, two issues prevented the webview from loading reliably:

  1. Proxy race condition: The cookie proxy connected to the upstream Bun server before it was ready, showing "proxy error". Fixed with retry + exponential backoff (200/400/800ms) in the proxy, plus a silent auto-reload fallback in the webview wrapper (3s timeout, max 1 reload).

  2. Webview not opening at all: VS Code's environmentVariableCollection injects PLANNOTATOR_BROWSER into terminal shells, but background processes spawned by Claude Code hooks don't inherit it. In remote sessions, handleServerReady() skipped openBrowser() entirely. Fixed with a file-based IPC registry (~/.plannotator/vscode-ipc.json) — the extension writes its IPC port keyed by workspace path, and openBrowser() reads it as a fallback. Multi-window support via longest-prefix workspace matching.

Validation

  • Install the VS Code extension (v0.5.2) on an SSH Remote session
  • Run /plannotator-review from a Claude Code terminal
  • Verify the webview panel opens automatically without "proxy error"
  • Open a second VS Code window on a different workspace and verify both windows route correctly

🤖 Generated with Claude Code

7tg added 2 commits March 17, 2026 17:20
…acknotprop#321)

When opening plannotator over VS Code SSH Remote, the webview could show
a "proxy error" because the cookie proxy connected before the upstream
Bun server was ready. Two layers of defense:

1. Retry with exponential backoff (200/400/800ms) in the cookie proxy,
   buffering the request body so retries can replay it
2. Silent iframe auto-reload in the webview wrapper if no "ready" signal
   is received within 3 seconds (max 1 reload to prevent loops)

Bump vscode extension to 0.5.2.
…prop#321)

VS Code's environmentVariableCollection only injects PLANNOTATOR_BROWSER
into interactive terminal shells — background processes spawned by Claude
Code hooks don't inherit it. In SSH Remote sessions this meant
openBrowser() was never called (handleServerReady skipped it when
isRemote=true and PLANNOTATOR_BROWSER was unset).

- Extension writes IPC port to ~/.plannotator/vscode-ipc.json keyed by
  workspace path; cleans up on deactivate
- openBrowser() falls back to IPC registry when shell-based open fails,
  using longest-prefix workspace match for multi-window support
- handleServerReady() always calls openBrowser() since the IPC fallback
  handles the remote case
@7tg 7tg marked this pull request as ready for review March 17, 2026 14:44
@backnotprop
Copy link
Copy Markdown
Owner

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@backnotprop backnotprop merged commit b4eb37f into backnotprop:main Mar 17, 2026
5 checks passed
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.

Proxy error on webview open: race condition with dev server startup

2 participants