Add multi-turn session support to hermes_cli - #17
Conversation
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
This reverts commit bafcc14. Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
…s_cli-session Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughHermes now supports session-based CLI execution backed by shared session helpers. The SDK uses the shared runtime session id helper, and a new profile plus fixtures drive a multi-turn test that validates Hermes session persistence. ChangesHermes session support
Estimated review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: David Gardner <dagardner@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
tests/test_hermes_cli.py (1)
50-50: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRebinding
sessionshadows the Fabric session.
session = session_db.get_session_by_title(...)reuses the name of theasync with ... as sessionobject. Harmless after the context exits, but renaming (e.g.session_record) improves readability.🤖 Prompt for 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. In `@tests/test_hermes_cli.py` at line 50, The local variable assignment in the test reuses the name of the Fabric session object, which makes the code harder to read; rename the result of get_session_by_title in the test to a distinct name like session_record and update the subsequent assertions/usages to match, so it no longer shadows the async with session binding.adapters/hermes-cli/src/nemo_fabric_adapters/hermes_cli/adapter.py (1)
126-152: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueStale comment vs. actual handling.
The comment claims the session_id is printed to stderr, but stderr is consumed only for
error_messageand the rawstderrfield;session_idin the output is alwaysfabric_runtime_id(never parsed from stderr). Given the design relies on title lookup, parsing stderr isn't needed—so the comment is misleading and should be dropped or corrected.🤖 Prompt for 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. In `@adapters/hermes-cli/src/nemo_fabric_adapters/hermes_cli/adapter.py` around lines 126 - 152, The comment in hermes_cli/adapter.py is misleading because `session_id` in the `output` dict comes from `fabric_runtime_id`, not from parsing `stderr`, so update or remove the stale note near the `response`/`stderr_output` handling to match the actual behavior. Keep the logic in `adapter.py` focused on `completed.stdout`, `completed.stderr`, and `fabric_runtime_id`, and ensure any documentation reflects that `stderr` is only used for `error_message`.
🤖 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 `@adapters/common/src/nemo_fabric_adapters/common/hermes.py`:
- Around line 336-357: ensure_hermes_session is declared to return str but
currently falls through without returning anything. Update the function in
hermes.py so it explicitly returns the resolved session identifier after
SessionDB.get_session_by_title, using the session object fetched from
get_session_by_title (for example its id field) on both the existing-session and
newly-created-session paths, or otherwise change the annotation if no value
should be returned. Keep the fix centered on ensure_hermes_session and the
SessionDB lookup/creation flow.
---
Nitpick comments:
In `@adapters/hermes-cli/src/nemo_fabric_adapters/hermes_cli/adapter.py`:
- Around line 126-152: The comment in hermes_cli/adapter.py is misleading
because `session_id` in the `output` dict comes from `fabric_runtime_id`, not
from parsing `stderr`, so update or remove the stale note near the
`response`/`stderr_output` handling to match the actual behavior. Keep the logic
in `adapter.py` focused on `completed.stdout`, `completed.stderr`, and
`fabric_runtime_id`, and ensure any documentation reflects that `stderr` is only
used for `error_message`.
In `@tests/test_hermes_cli.py`:
- Line 50: The local variable assignment in the test reuses the name of the
Fabric session object, which makes the code harder to read; rename the result of
get_session_by_title in the test to a distinct name like session_record and
update the subsequent assertions/usages to match, so it no longer shadows the
async with session binding.
🪄 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: CHILL
Plan: Enterprise
Run ID: e7d189cd-2758-4e4f-8063-63d60e902631
📒 Files selected for processing (6)
adapters/common/src/nemo_fabric_adapters/common/hermes.pyadapters/hermes-cli/src/nemo_fabric_adapters/hermes_cli/adapter.pyadapters/hermes-sdk/src/nemo_fabric_adapters/hermes_sdk/adapter.pyexamples/code-review-agent/profiles/hermes-cli-session.yamltests/conftest.pytests/test_hermes_cli.py
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
AjayThorve
left a comment
There was a problem hiding this comment.
Could use a smoke test for cli_session profile, but otherwise looks good.
Signed-off-by: David Gardner <dagardner@nvidia.com>
ensure_hermes_sessionto create the session before hand.runtime_session_idto the common moduletests/test_hermes_cli_fields.py ->tests/test_hermes_cli.pyto reflect the expanded test scope.Summary by CodeRabbit
Summary