Skip to content

fix: block on fail-closed hook delivery errors - #1289

Merged
willkill07 merged 1 commit into
NVIDIA:release/0.10from
willkill07:fix/relay-1021-hook-delivery-fail-closed
Oct 12, 2026
Merged

willkill07 merged 1 commit into
NVIDIA:release/0.10from
willkill07:fix/relay-1021-hook-delivery-fail-closed

Conversation

@willkill07

@willkill07 willkill07 commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Overview

Fail-closed hooks currently exit 1 on delivery errors, which does not block Claude Code's permission-bearing hooks. Return exit 2 for these errors across gateway and managed daemon execution, including hooks routed through daemon workers.

  • 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

  • Map the existing HookDelivery error to exit 2 and wrap gateway setup failures consistently.
  • Preserve fail-open behavior, structured guardrail rejections, configuration defaults, and public APIs. No breaking API or configuration changes.
  • Cover connection errors under both policies, verified gateway failures, response limits, timeouts, and a real --require-worker daemon returning HTTP 503. Document the exit statuses.
  • Verified a clean three-way merge with fix/relay-1020-gateway-hook-timeout (fix: align gateway hook timeout with daemon execution #1288).

Validation: eight focused CLI tests passed. just test-rust ran 5,797 tests: 5,795 passed initially; the two diagnostic failures passed when rerun with isolated configuration and inherited logging overrides removed. just docs and staged uv run pre-commit run passed. Language binding suites were not run because their contracts are unchanged.

Where should the reviewer start?

Start with crates/cli/src/commands/mod.rs for exit-status mapping and crates/cli/src/hooks/delivery.rs for gateway setup error wrapping. The strict-routing regression in crates/cli/tests/cli_tests.rs verifies exit 2 when a required daemon worker is unavailable.

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

Summary by CodeRabbit

  • Bug Fixes
    • Hook delivery failures now return exit code 2 when fail-closed behavior is configured, including connection errors, timeouts, and HTTP errors. Fail-open delivery failures continue to return 0.
    • Guardrail rejections continue to return exit code 2.
  • Documentation
    • Updated hook forwarding guidance to clarify exit codes for fail-open and fail-closed policies across gateway and daemon hooks.

Return exit 2 for fail-closed hook delivery failures across gateway and managed daemon hooks, including unavailable daemon workers. Preserve failure policy configuration and guardrail rejection behavior.

Fixes RELAY-1021.

Signed-off-by: Will Killian <[email protected]>
@willkill07
willkill07 requested review from a team as code owners October 12, 2026 18:10
@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 12, 2026
@coderabbitai

coderabbitai Bot commented Oct 12, 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: 9bec3cb9-ad10-490d-8b01-8d1139dd46aa

📥 Commits

Reviewing files that changed from the base of the PR and between 933e362 and d5a479f.


📒 Files selected for processing (5)
  • crates/cli/src/commands/mod.rs
  • crates/cli/src/hooks/delivery.rs
  • crates/cli/tests/cli_tests.rs
  • crates/cli/tests/coverage/shared/installer_tests.rs
  • docs/nemo-relay-cli/basic-usage.mdx

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


📜 Recent review details
⏰ Context from checks skipped due to timeout. (14)
  • GitHub Check: Rust / Package (linux-arm64)
  • GitHub Check: Rust / Package (windows-arm64)
  • GitHub Check: Rust / Test (linux-arm64)
  • GitHub Check: Rust / Package (linux-amd64)
  • GitHub Check: Rust / Package (macos-arm64)
  • GitHub Check: Rust / Test (linux-amd64)
  • GitHub Check: Check / Run
  • GitHub Check: Rust / Test (macos-arm64)
  • GitHub Check: Rust / Package (windows-amd64)
  • GitHub Check: Rust / Test (windows-amd64)
  • GitHub Check: Rust / Test (windows-arm64)
  • GitHub Check: Rust / Package (linux-musl-amd64)
  • GitHub Check: Rust / Package (linux-musl-arm64)
  • GitHub Check: Preview docs

🧰 Additional context used
📚 Code guidelines (5)
.agents/skills/contribute-docs/SKILL.md — configured
.agents/skills/review-doc-style/SKILL.md — configured
CONTRIBUTING.md — configured
.agents/skills/prepare-code-freeze/SKILL.md — configured
.agents/skills/draft-release-notes/SKILL.md — configured

📓 Path-based instructions (8)
Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.

⚙️ CodeRabbit configuration file

Files:

  • docs/nemo-relay-cli/basic-usage.mdx

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/shared/installer_tests.rs
  • crates/cli/tests/cli_tests.rs

Source excerpt: In MDX files, top-of-file comments must use JSX comment delimiters: `{/*` to open and `*/}` to close.

📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)

Files:

  • docs/nemo-relay-cli/basic-usage.mdx

Source excerpt: Verify MDX files use JSX delimiters for top-of-file SPDX comments.

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

Files:

  • docs/nemo-relay-cli/basic-usage.mdx

Source excerpt: **Formatting**: `cargo fmt` (rustfmt defaults) Source excerpt: **Linting**: `cargo clippy -- -D warnings` -- all warnings are treated as errors

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Files:

  • crates/cli/src/hooks/delivery.rs
  • crates/cli/tests/coverage/shared/installer_tests.rs
  • crates/cli/src/commands/mod.rs
  • crates/cli/tests/cli_tests.rs

Source excerpt: Search documentation source for references to the old version and update current-version install commands, package examples, and configuration examples to `` where appropriate: Review matches before changing th...

📄 CodeRabbit inference engine (.agents/skills/prepare-code-freeze/SKILL.md)

Files:

  • docs/nemo-relay-cli/basic-usage.mdx

Source excerpt: Use the naming conventions appropriate to each language: Rust `snake_case`, C FFI exports prefixed `nemo_relay_`, Go `PascalCase`, Node.js `camelCase`, Python `snake_case`.

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Files:

  • crates/cli/src/hooks/delivery.rs
  • crates/cli/tests/coverage/shared/installer_tests.rs
  • crates/cli/src/commands/mod.rs
  • crates/cli/tests/cli_tests.rs

Source excerpt: Preserve MDX front matter and the JSX SPDX comment.

📄 CodeRabbit inference engine (.agents/skills/draft-release-notes/SKILL.md)

Files:

  • docs/nemo-relay-cli/basic-usage.mdx

🔇 Additional comments (5)
crates/cli/src/hooks/delivery.rs (1)

195-197: LGTM!


crates/cli/src/commands/mod.rs (1)

45-47: LGTM!


crates/cli/tests/cli_tests.rs (1)

1382-1382: LGTM!

Also applies to: 1389-1389, 1477-1477, 5567-5567, 5596-5640, 5663-5663, 6379-6418


crates/cli/tests/coverage/shared/installer_tests.rs (1)

463-508: LGTM!


docs/nemo-relay-cli/basic-usage.mdx (1)

715-721: LGTM!



Walkthrough

Fail-closed hook delivery errors now map to CLI exit code 2. Tests cover hook routes, clients, failure policies, timeouts, and worker activation. The documentation describes exit codes for hook delivery failures and guardrail rejections.

Changes

Hook Delivery Exit Codes

Layer / File(s) Summary
Classify and map hook delivery failures
crates/cli/src/hooks/delivery.rs, crates/cli/src/commands/mod.rs
Fail-closed hook errors are returned as CliError::HookDelivery. The top-level CLI handler maps these errors to exit code 2.
Validate and document policy outcomes
crates/cli/tests/cli_tests.rs, crates/cli/tests/coverage/shared/installer_tests.rs, docs/nemo-relay-cli/basic-usage.mdx
Tests check explicit exit codes and hook diagnostics across delivery routes, clients, and policies. Timeout tests check both failure policies. The documentation states the exit codes for hook delivery failures and guardrail rejections.

Priority: ⬇️ Low

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to d5a47

Fail-closed hook delivery failures are classified for exit code 2 across the inspected gateway and managed-daemon paths. No actionable issue remains before normal merge checks.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title follows Conventional Commits format, uses the allowed lowercase type fix, clearly describes the fail-closed hook delivery change, and is 46 characters without a trailing period.
Description check Passed The description includes all required sections, completed overview confirmations, implementation details, reviewer guidance, a related issue with the Fixes keyword, and validation results.
Docstring Coverage Passed Docstring coverage is 84.62% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 4 files. (1 skipped: 1 …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

✨ 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 willkill07 added this to the 0.10 milestone Oct 12, 2026
@willkill07 willkill07 self-assigned this Oct 12, 2026
@github-actions

Copy link
Copy Markdown

@mnajafian-nv mnajafian-nv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@greysonlalonde greysonlalonde left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅

@willkill07
willkill07 merged commit aed71bb into NVIDIA:release/0.10 Oct 12, 2026
46 checks passed
willkill07 added a commit that referenced this pull request Oct 14, 2026
#### Overview

Add 0.10.1 release notes covering the fifteen PRs merged into
`release/0.10` since `0.10.0`, plus the anticipated merge of #1317, with
matching patch-upgrade guidance. Preserve the 0.10.0 notes and follow
the NVIDIA documentation style guide.

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

#### Details

- Cover daemon-worker LLM middleware (#1281), the YAML dependency update
(#1282), hook timeout and failure-policy fixes (#1288, #1289, #1290),
and request-edit preservation (#1296).
- Cover Anthropic streaming storage (#1303), Python typed reconstruction
(#1304), Go native handle lifetimes (#1302), authenticated Pi hooks and
session ownership (#1306), dynamic plugin trust failures (#1305), and
verified native plugin loading (#1307).
- Cover Pi named-upstream restrictions (#1314), LangChain tool-schema
edits (#1316), and the configurable ChatGPT Codex endpoint (#1319).
- Assume #1317 will merge: document plugin HTTP error helpers and
prefixes, preservation of remote Guardrails and forwarded hook HTTP
error statuses, verified reporting identities, and streaming limits.
Verified against its current head
`b61bb7da0bc6de7b7d5d27a569981867b7b2fcb9`; its implementation is not
merged into this branch.
- Add upgrade guidance for hook credentials and registration, generated
hooks, daemon response behavior, request edits, Pi extensions and
private provider endpoints, native plugin dependencies, stored Python
typed values, ChatGPT endpoints, and HTTP error handling.
- Keep PR references and counts out of user-facing release notes.
Preserve the prior CodeRabbit corrections for MCP route registration,
forwarded-stream observation limits, sanitizer-only behavior, and 0.10.1
installation pins.
- Merge the latest `release/0.10` into the PR branch. Distinguish
personal hook refresh commands from administrator-managed daemon
bundles.

Validation: `just docs`, `uv run pre-commit run`, and `git diff --cached
--check` passed. Fern skipped the published redirect-history check
because FDR returned HTTP 403. Verified the merged release range against
source and public documentation, and the assumed #1317 behavior against
its current PR source and docs.
Language test suites were not run because the PR diff only updates
documentation prose and installation version pins. Package installation
commands, live daemon upgrades, plugin activations, and hook refreshes
were not executed. Validation runs on the current release branch; #1317
remains an explicit release-content assumption.

#### Where should the reviewer start?

Start with `Release 0.10.1` in
`docs/about-nemo-relay/release-notes/index.mdx`, then review `Update
from NeMo Relay 0.10.0 to 0.10.1` in
`docs/reference/migration-guides.mdx`. Review the new Pi endpoint,
ChatGPT endpoint, LangChain tool-edit, and HTTP error guidance,
including the #1317 merge assumption. Check matching version pins in
`docs/getting-started/installation.mdx`.

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

- Relates to: none


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Added NeMo Relay 0.10.0 and 0.10.1 release notes, including feature
highlights, compatibility updates, fixes, and known issues.
* Expanded migration guidance with upgrade steps and details on hook
credentials and delivery, daemon-worker middleware behavior, request
editing, plugin requirements, and Python value handling.
* Updated installation examples across supported platforms, packages,
and integrations to reference version 0.10.1.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Will Killian <[email protected]>
@willkill07
willkill07 deleted the fix/relay-1021-hook-delivery-fail-closed branch October 30, 2026 14:47

This branch was previously deployed

1 inactive deployment
fern — d5a479f9 Deployed Oct 12, 2026 by willkill07 via Clean up docs preview #5604
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.

3 participants