Add httpx[socks] to fix hook failure under SOCKS proxy - #75
Open
supertony1990 wants to merge 1 commit into
Open
supertony1990 wants to merge 1 commit into
supertony1990 wants to merge 1 commit into
Conversation
httpx requires the optional socksio dependency to talk through a SOCKS proxy. When ALL_PROXY/all_proxy is set to a socks5:// URL (a common setup alongside HTTP_PROXY for HTTP/HTTPS), Langfuse client creation fails with: ImportError: Using SOCKS proxy, but the 'socksio' package is not installed. Since the hook's PEP 723 dependency block only declares `langfuse`, uv's isolated script environment never installs socksio, so every turn fails silently and no traces are exported. Declaring `httpx[socks]` alongside `langfuse` pulls it in automatically.
|
|
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.
Problem
When
ALL_PROXY/all_proxyis set to asocks5://URL (a common setup alongsideHTTP_PROXY/HTTPS_PROXY, e.g. via Clash/sing-box mixed ports), Langfuse client creation fails silently every turn with:Since the hook's PEP 723 dependency block only declares
langfuse, uv's isolated script environment never installssocksio, and the failure is swallowed by the fail-open design (logged to~/.claude/state/langfuse_hook.log, turn continues normally). Users under a SOCKS proxy get zero traces exported with no visible error.Fix
Add
httpx[socks]to the script's inline dependency block sosocksiois installed automatically.Testing
Verified locally: reproduced the ImportError with the proxy env vars set, confirmed the patched dependency block resolves it (
Langfuse(...)client construction succeeds under the same proxy env).