fix: use ~/.agent-browser for socket files instead of TMPDIR#180
Merged
Conversation
This fixes issue vercel-labs#163 where different TMPDIR values (common with tmux/screen/VSCode/IntelliJ) caused the CLI and daemon to use different socket paths. Socket directory priority: 1. AGENT_BROWSER_SOCKET_DIR (explicit override) 2. $XDG_RUNTIME_DIR/agent-browser (Linux standard) 3. ~/.agent-browser (fallback, like Docker Desktop) Both CLI (Rust) and daemon (Node.js) now use the same logic. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
|
@mmhiyoko is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
| } | ||
|
|
||
| // 3. Home directory fallback (like Docker Desktop's ~/.docker/run/) | ||
| if let Some(home) = dirs::home_dir() { |
Contributor
| } | ||
|
|
||
| // 3. Home directory fallback (like Docker Desktop's ~/.docker/run/) | ||
| return path.join(os.homedir(), '.agent-browser'); |
Contributor
- Make get_socket_dir() public in connection.rs
- Update session list to use get_socket_dir() instead of temp_dir()
- Update pid file pattern from agent-browser-{session}.pid to {session}.pid
- Add tmpdir fallback to daemon.ts when homedir is unavailable
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add comprehensive tests for get_socket_dir/getSocketDir to verify: - AGENT_BROWSER_SOCKET_DIR takes priority - Empty strings are ignored (fixes Rust/TypeScript consistency) - XDG_RUNTIME_DIR fallback works correctly - Home directory fallback when env vars unset Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Collaborator
|
Great call, thanks for your contribution! |
timothywangdev
pushed a commit
to timothywangdev/banana-browser
that referenced
this pull request
Mar 17, 2026
…labs#180) * fix: use ~/.agent-browser for socket files instead of TMPDIR This fixes issue vercel-labs#163 where different TMPDIR values (common with tmux/screen/VSCode/IntelliJ) caused the CLI and daemon to use different socket paths. Socket directory priority: 1. AGENT_BROWSER_SOCKET_DIR (explicit override) 2. $XDG_RUNTIME_DIR/agent-browser (Linux standard) 3. ~/.agent-browser (fallback, like Docker Desktop) Both CLI (Rust) and daemon (Node.js) now use the same logic. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: session list now looks in correct socket directory - Make get_socket_dir() public in connection.rs - Update session list to use get_socket_dir() instead of temp_dir() - Update pid file pattern from agent-browser-{session}.pid to {session}.pid - Add tmpdir fallback to daemon.ts when homedir is unavailable Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * test: add unit tests for socket directory resolution Add comprehensive tests for get_socket_dir/getSocketDir to verify: - AGENT_BROWSER_SOCKET_DIR takes priority - Empty strings are ignored (fixes Rust/TypeScript consistency) - XDG_RUNTIME_DIR fallback works correctly - Home directory fallback when env vars unset Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
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.
Summary
Fix socket path to use
~/.agent-browser/instead ofTMPDIR. Fixes #163.Different tools (tmux, VSCode, IntelliJ) set different
TMPDIRvalues, causing CLI and daemon to lookfor sockets in different locations.
Socket directory priority:
AGENT_BROWSER_SOCKET_DIR(explicit override)$XDG_RUNTIME_DIR/agent-browser(Linux standard)~/.agent-browser/(fallback, like Docker Desktop)Test plan
npm testpasses--sessionoption works with different TMPDIRAGENT_BROWSER_SOCKET_DIRoverride worksNotes
Breaking Change
Socket files are now stored in
~/.agent-browser/instead of$TMPDIR/.Old CLI + new daemon (or vice versa) won't work together.
Backward Compatibility Considered
I considered adding fallback to check old paths (similar to docker-modem's approach),
but decided against it because:
Let me know if you'd prefer backward compatibility added.
🤖 Generated with Claude Code