fix: repair Hermes shutdown-only ATIF artifacts#182
Conversation
WalkthroughThe PR adds filtering to the Hermes adapter that suppresses ChangesHermes pre-tool-call correlatability gating
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
7d735ed to
8d15d20
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/cli/src/adapters/hermes.rs`:
- Around line 249-257: The check in has_explicit_hermes_tool_call_id that calls
hermes_string_at(payload, "id") is too broad and can match unrelated top-level
or extra.id fields; remove that fallback (the hermes_string_at(payload, "id")
check) or replace it with a more specific path check (e.g., only accept
["tool","id"] / ["tool_input","id"] or a documented version-specific key) and
add a short comment in has_explicit_hermes_tool_call_id explaining why the
generic "id" check was removed or when a bare "id" is allowed so future readers
know the rationale.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: ed3eb128-887e-4097-8c1b-50605ed5a0f0
📒 Files selected for processing (3)
crates/cli/src/adapters/hermes.rscrates/cli/tests/coverage/adapters_tests.rscrates/cli/tests/coverage/session_tests.rs
📜 Review details
🧰 Additional context used
📓 Path-based instructions (6)
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Use
snake_casenaming convention for Rust identifiers (e.g.,nemo_relay_tool_call)
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node work
**/*.rs: Runcargo fmt --allto format all Rust code
Runcargo clippy --workspace --all-targets -- -D warningsto enforce all clippy lints as errors
**/*.rs: Runcargo fmt --allwhen Rust files changed as part of WebAssembly work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files changed as part of WebAssembly work
**/*.rs: If any Rust code changed, always runjust test-rust
If any Rust code changed, also runcargo fmt --all
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings
Run Rust formatting withcargo fmt --all
Run Rust linting withcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Keep SPDX headers on Rust source files. The project is Apache-2.0.
Usesnake_casefor Rust binding naming conventions.
UseJson = serde_json::Valuein Rust-facing runtime APIs where the existing code expects JSON payloads.
UseResult<T>withFlowErrorin core runtime paths. Keep errors explicit and binding-appropriate at the wrapper layer.
Preserve async behavior on the existing tokio-based model i...
Files:
crates/cli/src/adapters/hermes.rscrates/cli/tests/coverage/session_tests.rscrates/cli/tests/coverage/adapters_tests.rs
**/{Cargo.toml,**/*.rs}
📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Maintain consistency between Rust package names in
Cargo.tomland their actual usage across the codebase
Files:
crates/cli/src/adapters/hermes.rscrates/cli/tests/coverage/session_tests.rscrates/cli/tests/coverage/adapters_tests.rs
**/*.{h,hpp,c,cpp,rs}
📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Ensure FFI header and library naming follows consistent conventions across platform-specific builds
Files:
crates/cli/src/adapters/hermes.rscrates/cli/tests/coverage/session_tests.rscrates/cli/tests/coverage/adapters_tests.rs
**/*.{rs,toml}
📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Update Rust crate names and module prefixes during coordinated rename operations
Files:
crates/cli/src/adapters/hermes.rscrates/cli/tests/coverage/session_tests.rscrates/cli/tests/coverage/adapters_tests.rs
{crates/adaptive/**/*.rs,**/*test*.{rs,py,go,ts,js},**/*adaptive*test*.{rs,py,go,ts,js},docs/plugins/adaptive/**}
📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Maintain documented and tested validation and report behavior for adaptive surfaces
Files:
crates/cli/tests/coverage/session_tests.rscrates/cli/tests/coverage/adapters_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}
⚙️ CodeRabbit configuration file
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.
Files:
crates/cli/tests/coverage/session_tests.rscrates/cli/tests/coverage/adapters_tests.rs
🔇 Additional comments (8)
crates/cli/src/adapters/hermes.rs (4)
51-56: LGTM!
230-236: LGTM!
238-247: LGTM!
259-264: LGTM!crates/cli/tests/coverage/adapters_tests.rs (2)
282-309: LGTM!
311-326: LGTM!crates/cli/tests/coverage/session_tests.rs (2)
1454-1499: LGTM!
1454-1499: Re-run required Rust validation for this change (just test-rust,cargo fmt --all,cargo clippy ... -D warnings)
just test-rustcargo fmt --all --checkcargo clippy --workspace --all-targets -- -D warnings
|
/ok to test 8d15d20 |
|
/merge |
#### Overview Fixes a Hermes CLI hook-forward issue where sparse `pre_tool_call` payloads could create a separate task-id session and export a one-step ATIF trajectory containing only `gateway_shutdown`. - [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 Public Hermes releases can emit `pre_tool_call` hooks with a task id but without enough stable session/tool-call identity to pair the hook with the eventual `post_tool_call`. NeMo Relay previously treated the task id as a session id, opened a synthetic Hermes session, and later closed it during gateway shutdown. This PR drops uncorrelatable Hermes `pre_tool_call` hooks unless they include both a real session identifier and a stable tool-call id. The `post_tool_call` hook still records the tool result and attaches it to the main trajectory. Added regression coverage for the sparse `pre_tool_call` case and updated adapter coverage for correlatable Hermes tool payloads. #### Where should the reviewer start? Start with `crates/cli/src/adapters/hermes.rs`, especially the `pretoolcall` guard and `hermes_pre_tool_call_is_correlatable` helper. The key regression test is `hermes_uncorrelatable_pre_tool_call_does_not_create_shutdown_trajectory` in `crates/cli/tests/coverage/session_tests.rs`. #### Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to) - Relates to NVIDIA#176 ## Summary by CodeRabbit * **Improvements** * Hermes adapter now filters pre-tool-call events that lack valid session and tool call identifiers, reducing noise in the event stream. * **Tests** * Added test coverage validating proper filtering of uncorrelatable Hermes payloads and session trajectory behavior. [](https://app.coderabbit.ai/change-stack/NVIDIA/NeMo-Relay/pull/182?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) Authors: - Bryan Bednarski (https://github.com/bbednarski9) Approvers: - Will Killian (https://github.com/willkill07) URL: NVIDIA#182 Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
#### Overview Fixes a Hermes CLI hook-forward issue where sparse `pre_tool_call` payloads could create a separate task-id session and export a one-step ATIF trajectory containing only `gateway_shutdown`. - [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 Public Hermes releases can emit `pre_tool_call` hooks with a task id but without enough stable session/tool-call identity to pair the hook with the eventual `post_tool_call`. NeMo Relay previously treated the task id as a session id, opened a synthetic Hermes session, and later closed it during gateway shutdown. This PR drops uncorrelatable Hermes `pre_tool_call` hooks unless they include both a real session identifier and a stable tool-call id. The `post_tool_call` hook still records the tool result and attaches it to the main trajectory. Added regression coverage for the sparse `pre_tool_call` case and updated adapter coverage for correlatable Hermes tool payloads. #### Where should the reviewer start? Start with `crates/cli/src/adapters/hermes.rs`, especially the `pretoolcall` guard and `hermes_pre_tool_call_is_correlatable` helper. The key regression test is `hermes_uncorrelatable_pre_tool_call_does_not_create_shutdown_trajectory` in `crates/cli/tests/coverage/session_tests.rs`. #### Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to) - Relates to NVIDIA#176 ## Summary by CodeRabbit * **Improvements** * Hermes adapter now filters pre-tool-call events that lack valid session and tool call identifiers, reducing noise in the event stream. * **Tests** * Added test coverage validating proper filtering of uncorrelatable Hermes payloads and session trajectory behavior. [](https://app.coderabbit.ai/change-stack/NVIDIA/NeMo-Relay/pull/182?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) Authors: - Bryan Bednarski (https://github.com/bbednarski9) Approvers: - Will Killian (https://github.com/willkill07) URL: NVIDIA#182 Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
Overview
Fixes a Hermes CLI hook-forward issue where sparse
pre_tool_callpayloads could create a separate task-id session and export a one-step ATIF trajectory containing onlygateway_shutdown.Details
Public Hermes releases can emit
pre_tool_callhooks with a task id but without enough stable session/tool-call identity to pair the hook with the eventualpost_tool_call. NeMo Relay previously treated the task id as a session id, opened a synthetic Hermes session, and later closed it during gateway shutdown.This PR drops uncorrelatable Hermes
pre_tool_callhooks unless they include both a real session identifier and a stable tool-call id. Thepost_tool_callhook still records the tool result and attaches it to the main trajectory.Added regression coverage for the sparse
pre_tool_callcase and updated adapter coverage for correlatable Hermes tool payloads.Where should the reviewer start?
Start with
crates/cli/src/adapters/hermes.rs, especially thepretoolcallguard andhermes_pre_tool_call_is_correlatablehelper. The key regression test ishermes_uncorrelatable_pre_tool_call_does_not_create_shutdown_trajectoryincrates/cli/tests/coverage/session_tests.rs.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit
Improvements
Tests