Skip to content

fix: isolate hooks from model response backpressure - #1769

Merged
greysonlalonde merged 4 commits into
NVIDIA:release/0.11from
bbednarski9:bbednarski/aep-278-release-0.11-hook-pool-isolation
Nov 20, 2026
Merged

greysonlalonde merged 4 commits into
NVIDIA:release/0.11from
bbednarski9:bbednarski/aep-278-release-0.11-hook-pool-isolation

Conversation

@bbednarski9

@bbednarski9 bbednarski9 commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Overview

Unread model responses can exhaust the shared daemon-to-worker HTTP/2 response window, stalling hook verdicts while /healthz remains healthy. Give hooks and readiness probes a separate persistent pool. The regression starves hooks with eight unread responses before the fix and completes hooks with 128 after it.

  • 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

  • Preserve worker credentials, pinned TLS trust, streaming backpressure, and cancellation cleanup.
  • Cache model and hook pools together under the existing root-cache bound; reuse both pools across requests.
  • This adds a persistent connection when both traffic classes are used; it does not shorten guardrail timeouts.

Validation: 30 focused transport/TLS tests, staged pre-commit hooks, and docs checks passed. Full NEXTEST_TEST_THREADS=4 just test-rust: 6,724 passed, 4 failed, 4 skipped. The same four HTTP-model provider timeouts reproduce on untouched release 6b7afd500 with workspace features; main stabilizes those unrelated paths in #1632. Fern skipped authenticated redirect checking.

Where should the reviewer start?

Start with WorkerClientPool in crates/cli/src/daemon/common/worker_tls.rs, forward_to_worker in crates/cli/src/daemon/broker/server.rs, and crates/cli/tests/coverage/daemon/hook_pool_isolation_tests.rs. The regression uses production worker staging.

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

  • Relates to AEP-278. The synthetic reproduction does not establish the original incident's trigger.

Summary by CodeRabbit

  • Reliability

    • Hook requests and worker readiness checks use connection pools separate from model traffic, helping them remain responsive when model responses are delayed or stalled.
    • Separate pools retain the worker authentication and TLS trust settings used for model traffic, and are reused rather than opened for each hook request.
    • Hook traffic uses its own connection pool for both cleartext and TLS connections, with TLS connections isolated by trusted certificate.
  • Documentation

    • Updated the daemon architecture guide to explain connection separation and its effects on traffic handling.

@bbednarski9
bbednarski9 requested review from a team as code owners November 18, 2026 17:25
@github-actions github-actions Bot added size:M PR is medium Bug issue describes bug; PR fixes bug lang:rust PR changes/introduces Rust code labels Nov 18, 2026
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The daemon maintains separate pooled worker clients for model traffic and hook/readiness traffic. Worker staging attaches both clients. Readiness probes and hook routes use the hook client; provider routes use the model client.

Changes

Worker traffic isolation

Layer / File(s) Summary
Separate clients and TLS cache
crates/cli/src/daemon/common/worker_tls.rs, crates/cli/tests/coverage/daemon/worker_tls_tests.rs
WorkerClientPool provides separate model and hook clients for cleartext and pinned TLS roots. TLS cache entries hold client pairs and retain the existing LRU behavior. Tests cover client reuse, TLS-root isolation, eviction, and invalid roots.
Hook client assignment and routing
crates/cli/src/daemon/broker/lifecycle.rs, crates/cli/src/daemon/broker/server.rs
WorkerTarget stores a hook client. Worker staging attaches it, readiness probes use it, and forwarding selects it for hook routes while provider routes use the model client.
Backpressure validation and architecture description
crates/cli/tests/coverage/daemon/hook_pool_isolation_tests.rs, crates/cli/tests/coverage/daemon/daemon_worker_e2e_tests.rs, docs/daemon/architecture.mdx
The daemon coverage tests exercise hook delivery while provider responses remain unread. The architecture documentation describes separate persistent pools and their TLS trust.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Broker as Daemon broker
  participant Pool as WorkerClientPool
  participant Worker
  Broker->>Pool: Get hook client for TLS root
  Pool-->>Broker: Return hook client
  Broker->>Worker: Send readiness or hook request using hook client
  Broker->>Worker: Send provider request using model client
Loading
Merge Risk: Minimal · up to c3e6f

Hook and readiness traffic now uses its own persistent worker connection pool, so unread model responses should no longer stall hook verdicts. No merge-blocking risk was identified.

Architecture risk: Low · up to c3e6f

The change affects 2 systems.

Changed systems: crates, docs

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — crates (service) was modified; 6 changed files map to changed impact.
  • observed — docs (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in crates/cli/src/daemon/broker/lifecycle.rs: WorkerTarget gains a shared pooled client field for hook and readiness traffic.
  • observed — Modified behavior in crates/cli/src/daemon/broker/lifecycle.rs: with_shared_client initializes the hook client as a clone of the worker client.
  • observed — Modified behavior in crates/cli/src/daemon/broker/lifecycle.rs: with_hook_client sets the independent hook client and returns the target; hook_client provides a borrowed reference to it.
  • observed — Modified behavior in crates/cli/src/daemon/broker/server.rs: stage_worker now obtains a hook client from the worker client pool using the TLS root certificate; client construction errors return BAD_REQUEST.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title uses the type "fix" and a concise imperative summary. It is 51 characters, has no trailing period, and uses lowercase type. It matches the main change: hooks and readiness probes get a separ…
Description check Passed The description follows the repository template. It includes the Overview with both confirmation checkboxes checked, the Details section, the Where should the reviewer start section, and the Related I…
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.
Full details: Title check

Explanation

The title uses the type "fix" and a concise imperative summary. It is 51 characters, has no trailing period, and uses lowercase type. It matches the main change: hooks and readiness probes get a separate pool, so unread model responses no longer block hook verdicts. The title is accurate and conforms to the Conventional Commits format.

Full details: Description check

Explanation

The description follows the repository template. It includes the Overview with both confirmation checkboxes checked, the Details section, the Where should the reviewer start section, and the Related Issues section using the 'Relates to' keyword with AEP-278. It explains the problem, the fix, the persistent pool behavior, and the validation results, including four unrelated failing tests. The Related Issues entry uses 'Relates to' rather than a closing keyword, which fits the non-closing reference to AEP-278.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 21050f7 and c3e6f4d.

Files selected for processing: 1

  • crates/cli/tests/coverage/daemon/hook_pool_isolation_tests.rs

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

Recent review details

Context from checks skipped due to timeout: 15

  • GitHub Check: CodeRabbit
  • GitHub Check: Rust / Package (windows-arm64)
  • GitHub Check: Rust / Test (windows-arm64)
  • GitHub Check: Rust / Package (linux-arm64)
  • GitHub Check: Rust / Package (macos-arm64)
  • GitHub Check: Rust / Package (linux-musl-arm64)
  • GitHub Check: Rust / Test (linux-arm64)
  • GitHub Check: Rust / Package (linux-musl-amd64)
  • GitHub Check: Rust / Test (linux-amd64)
  • GitHub Check: Rust / Package (windows-amd64)
  • GitHub Check: Rust / Test (windows-amd64)
  • GitHub Check: Rust / Test (macos-arm64)
  • GitHub Check: Rust / Package (linux-amd64)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
Additional context used

Path-based instructions: 1

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_pool_isolation_tests.rs
Additional comments: 1

crates/cli/tests/coverage/daemon/hook_pool_isolation_tests.rs: 1

78-78: LGTM!

Also applies to: 91-91, 130-130, 135-135, 150-150

@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.

Non-blocking test suggestion.

@ptimizeroracle ptimizeroracle left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

i modelled the daemon to worker hop standalone (hyper 1.11.1 client with the pooled_builder() + http2_only settings, h2 server with the 8 MiB window) and held model responses unread. one shared pool: a tiny hook stalls from the 3rd unread stream (hyper client defaults are 5 MiB connection / 2 MiB stream). second pool: hook done in under 1.2 ms up to 32 unread, 2 tcp connections instead of 1. so the split does what it says. gap: diagnostic_collection::fetch (diagnostic_collection.rs:230) still uses target.client() under a 2s COLLECTION_REQUEST_TIMEOUT, so that poll should time out under the same backpressure. move it to hook_client() or say why not. i did not run the pr branch.

(ai-assisted, checked by me)

@greysonlalonde
greysonlalonde merged commit 56965db into NVIDIA:release/0.11 Nov 20, 2026
45 checks passed
@willkill07 willkill07 added this to the 0.11 milestone Nov 20, 2026

This branch was previously deployed

1 inactive deployment
fern — c3e6f4d0 Deployed Nov 20, 2026 by greysonlalonde via Clean up docs preview #7451
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:M PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants