Skip to content

fix: deliver managed daemon hooks without the system proxy - #1351

Merged
willkill07 merged 1 commit into
NVIDIA:release/0.10from
tianyangc-nvidia:fix/daemon-hook-ignore-proxy-env
Oct 14, 2026
Merged

willkill07 merged 1 commit into
NVIDIA:release/0.10from
tianyangc-nvidia:fix/daemon-hook-ignore-proxy-env

Conversation

@tianyangc-nvidia

@tianyangc-nvidia tianyangc-nvidia commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Overview

nemo-relay daemon hook built its reqwest client with reqwest's default system-proxy behavior, so a user's HTTP_PROXY/http_proxy/ALL_PROXY applied to the daemon's http://127.0.0.1 address unless NO_PROXY listed that exact IP. Any proxy that cannot connect back to the client's loopback made every managed hook fail; with 0.10.1's fail-closed exit code 2, that blocks all tool calls in Claude Code and Codex while the daemon is healthy. Disable the proxy for daemon hook delivery, matching the gateway hook client in hooks/delivery.rs and the MCP control connection, which already dial the daemon directly.

  • I confirm this contribution is my own work, or I have the right to submit it under this project's license.
  • I searched existing issues and open pull requests, and this does not duplicate existing work.

Details

  • crates/cli/src/daemon/hook/mod.rs: add .no_proxy() to the hook delivery client. No API, configuration, or exit-status changes; fail-open and fail-closed policies, timeouts, and redirect handling are unchanged.
  • crates/cli/tests/coverage/daemon/hook_tests.rs: add hook_forward_ignores_proxy_environment_for_the_daemon_address, which points HTTP_PROXY, HTTPS_PROXY, ALL_PROXY (and lowercase variants) at a closed loopback port, clears NO_PROXY, and asserts that delivery still reaches the daemon directly. The test holds the shared ENV_TEST_LOCK and restores the environment on drop; it fails without the fix with error sending request.
  • Targets release/0.10 because the regression is user-visible on 0.10.1 managed deployments; the code is identical on main.

Validation: cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings, and cargo test -p nemo-relay-cli --lib daemon::hook::tests (see PR comment for output).

Where should the reviewer start?

crates/cli/src/daemon/hook/mod.rs (forward), then the new test at the end of crates/cli/tests/coverage/daemon/hook_tests.rs. The design question is whether daemon hook delivery should ever use a forward proxy; the existing gateway client and the WebSocket control channel already say no.

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Daemon hook requests now connect directly, regardless of proxy settings configured for the process. This prevents proxy settings from interfering with delivery to the local daemon.
  • Tests
    • Added coverage verifying hook delivery succeeds when proxy settings are present.

`nemo-relay daemon hook` built its reqwest client with the default
system-proxy behavior, so a user's HTTP_PROXY/http_proxy/ALL_PROXY applied
to the daemon's http://127.0.0.1 address unless NO_PROXY listed that exact
IP. Any proxy that cannot connect back to the client's loopback made every
managed hook delivery fail; with the fail-closed exit code 2 this blocks
all tool calls in Claude Code and Codex while the daemon is healthy.

Disable the proxy for daemon hook delivery, matching the gateway hook
client in hooks/delivery.rs and the MCP control connection, which already
dial the daemon directly. Add a regression test that points every proxy
variable at a closed loopback port, clears NO_PROXY, and asserts delivery
still reaches the daemon.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Tianyang Che <[email protected]>
@tianyangc-nvidia
tianyangc-nvidia requested a review from a team as a code owner October 14, 2026 21:09
@tianyangc-nvidia

Copy link
Copy Markdown
Contributor Author

Local verification (macOS arm64, Rust 1.96.1):

Branch: fix/daemon-hook-ignore-proxy-env (base origin/release/0.10 a4be1251), worktree /Users/tianyangc/workspace/NeMo-Relay-hook-proxy
Toolchain: rust 1.96.1 (rust-toolchain.toml), macOS arm64

$ cargo test -p nemo-relay-cli --lib daemon::hook::tests
running 14 tests
test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 2018 filtered out; finished in 0.02s

Negative check (fix reverted, test kept):
test daemon::hook::tests::hook_forward_ignores_proxy_environment_for_the_daemon_address ... FAILED
thread 'daemon::hook::tests::hook_forward_ignores_proxy_environment_for_the_daemon_address' (9351824) panicked at crates/cli/src/daemon/hook/../../../tests/coverage/daemon/hook_tests.rs:468:10:
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 2031 filtered out; finished in 0.04s

$ cargo fmt --all -- --check
fmt ok

$ cargo clippy -p nemo-relay-cli --all-targets -- -D warnings
clippy exit=0
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 44.02s

Manual reproduction on the installed 0.10.0 binary (daemon healthy, PreToolUse payload, --fail-closed):
  no proxy vars                         -> {"continue":true}, exit 0
  HTTPS_PROXY only                      -> exit 0
  http_proxy=http://127.0.0.1:9         -> delivery failed, exit 1 (exit 2 on 0.10.1)
  ALL_PROXY=http://127.0.0.1:9          -> delivery failed
  all_proxy=socks5://127.0.0.1:9        -> delivery failed
  http_proxy + NO_PROXY=localhost       -> delivery failed
  http_proxy + NO_PROXY=*               -> delivery failed
  http_proxy + no_proxy=127.0.0.1       -> exit 0

@copy-pr-bot

copy-pr-bot Bot commented Oct 14, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added size:S PR is small Bug issue describes bug; PR fixes bug lang:rust PR changes/introduces Rust code labels Oct 14, 2026
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/NeMo-Relay/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 2a7a75b8-3abe-48b1-ad11-107f474f2310
📥 Commits

Reviewing files that changed from the base of the PR and between a4be125 and ad342e4.

📒 Files selected for processing: 2
  • crates/cli/src/daemon/hook/mod.rs
  • crates/cli/tests/coverage/daemon/hook_tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

📜 Recent review details
🧰 Additional context used
📚 Code guidelines: 1
CONTRIBUTING.md — configured
📓 Path-based instructions: 2
Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.

⚙️ CodeRabbit configuration file

Files:

  • crates/cli/tests/coverage/daemon/hook_tests.rs
Applicability reference: AGENTS.md: # NeMo Relay Repository Guidance See `CONTRIBUTING.md` and `docs/contribute/testing-and-docs.mdx` for contributor details, and `.agents/skills/README.md` for the maintainer skill boundary.

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Files:

  • crates/cli/src/daemon/hook/mod.rs
  • crates/cli/tests/coverage/daemon/hook_tests.rs

Walkthrough

The daemon hook client now disables proxy handling for its HTTP requests. A regression test sets proxy variables to a closed loopback port and verifies that a Claude Code hook request reaches the local daemon and returns its response.

Changes

Daemon hook proxy handling

Layer / File(s) Summary
Direct delivery and regression test
crates/cli/src/daemon/hook/mod.rs, crates/cli/tests/coverage/daemon/hook_tests.rs
forward builds its HTTP client with proxy handling disabled. The test temporarily sets proxy variables to a closed loopback port, clears NO_PROXY, and verifies hook delivery and the daemon response.

Priority: ⬆️ High

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to ad342

Daemon hook requests bypass shell-configured forward proxies, and the regression test verifies delivery to the local daemon under proxy settings. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description includes all required sections, completed confirmations, implementation details, reviewer guidance, validation results, and a related issue.
Title check Passed The title uses the required Conventional Commits format, has the allowed lowercase type "fix", stays under 72 characters, and has no trailing period.
Linked Issues check Passed Issue #1350 requires managed daemon hook delivery to bypass forward proxies and include automated coverage. crates/cli/src/daemon/hook/mod.rs now calls reqwest::Client::builder().no_proxy() before…
Out of Scope Changes check Passed The changes are limited to the daemon hook client and its focused regression test. The test environment scope and request capture support the linked issue's verification. No unrelated API, configurati…
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@willkill07

Copy link
Copy Markdown
Member

/ok to test ad342e4

@willkill07
willkill07 enabled auto-merge (squash) October 14, 2026 21:24
@willkill07
willkill07 disabled auto-merge October 14, 2026 21:36
@willkill07
willkill07 merged commit 9ec4cd3 into NVIDIA:release/0.10 Oct 14, 2026
39 of 40 checks passed

This branch was previously deployed

1 inactive deployment
fern — ad342e44 Deployed Oct 14, 2026 by willkill07 via Clean up docs preview #5798
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug issue describes bug; PR fixes bug lang:rust PR changes/introduces Rust code size:S PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants