Force cursor-agent egress through node2 SOCKS5 via local CONNECT bridge
build-and-push / build (push) Successful in 8m40s
build-and-push / build (push) Successful in 8m40s
The Bun-based cursor-agent only honors http://-scheme HTTP(S)_PROXY values and silently ignores socks5(h):// — with the pod's socks5h env it egressed directly. Add devbox-proxy-bridge (loopback HTTP CONNECT -> node2 SOCKS5), run it supervised from the entrypoint, and shadow cursor-agent/agent with a wrapper that points at the bridge (fail-loud, no bypass). CI path triggers updated for the new files.
This commit is contained in:
@@ -56,6 +56,33 @@ for v in HTTP_PROXY HTTPS_PROXY http_proxy https_proxy NO_PROXY no_proxy ALL_PRO
|
||||
printf 'export %s=%q\n' "${v}" "${val}" >> "${proxy_env_file}"
|
||||
done
|
||||
|
||||
# Loopback HTTP-CONNECT proxy bridge backed by the node2 SOCKS5 upstream.
|
||||
# The Bun-based cursor-agent (and other SOCKS-blind HTTP clients) talk to
|
||||
# this bridge; it performs fail-loud SOCKS5 dialing on their behalf. The
|
||||
# kube-proxy env above stays socks5h:// for SOCKS-aware tools (curl, apt).
|
||||
install -m 755 /usr/local/share/devbox/devbox-proxy-bridge.js /usr/local/bin/devbox-proxy-bridge
|
||||
(
|
||||
# set -e (inherited) must not kill the respawn loop when the bridge exits non-zero.
|
||||
set +e
|
||||
while true; do
|
||||
node /usr/local/bin/devbox-proxy-bridge >>/var/log/devbox-proxy-bridge.log 2>&1
|
||||
rc=$?
|
||||
echo "$(date -Is) devbox-proxy-bridge exited rc=${rc} — respawning in 2s" >>/var/log/devbox-proxy-bridge.log
|
||||
sleep 2
|
||||
done
|
||||
) &
|
||||
|
||||
# cursor-agent wrapper: shadows ~/.local/bin/cursor-agent via PATH precedence.
|
||||
# Installs only when the real binary is present; the wrapper itself exits 127
|
||||
# if the agent is uninstalled later (fail-loud, never silent direct egress).
|
||||
if [ -x /home/developer/.local/bin/cursor-agent ]; then
|
||||
install -m 755 /usr/local/share/devbox/cursor-agent-wrapper.sh /usr/local/bin/cursor-agent
|
||||
# ~/.local/bin/agent is the agent's own alias for the same binary — shadow it too.
|
||||
[ -e /usr/local/bin/agent ] || ln -s cursor-agent /usr/local/bin/agent
|
||||
else
|
||||
rm -f /usr/local/bin/cursor-agent /usr/local/bin/agent
|
||||
fi
|
||||
|
||||
# Tiny HTTP for TrinityIngress / health (Traefik terminates TLS).
|
||||
python3 -m http.server 8080 --bind 0.0.0.0 --directory /usr/share/devbox-http >/tmp/http-8080.log 2>&1 &
|
||||
|
||||
|
||||
Reference in New Issue
Block a user