Skip to content

Add Fabric chat session entrypoint - #21

Merged
AjayThorve merged 5 commits into
NVIDIA:mainfrom
AjayThorve:ajay/fabric-35-chat-session-id
Jun 26, 2026
Merged

Add Fabric chat session entrypoint#21
AjayThorve merged 5 commits into
NVIDIA:mainfrom
AjayThorve:ajay/fabric-35-chat-session-id

Conversation

@AjayThorve

@AjayThorve AjayThorve commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add fabric chat for session-mode profiles using the native runtime lifecycle.
  • Thread caller-provided session_id through SDK/CLI session turns into adapter runtime context.
  • Enforce runtime.mode=session for fabric chat and SDK Session entrypoints.

Validation

  • cargo test
  • cargo check -p fabric-python
  • python3 tests/smoke_cli.py
  • PYTHONPATH=python/src pytest -q tests/test_session.py
  • PYTHONPATH=python/src python3 python/tests/smoke_sdk.py
  • PYTHONPATH=python/src python3 python/tests/smoke_sdk_sessions.py
  • PYTHONPATH=python/src python3 python/tests/smoke_readme_examples.py
  • python3 tests/smoke_hermes_cli.py && python3 tests/smoke_hermes_config_mapping.py && python3 tests/smoke_swebench_style.py
  • PYTHONPATH=adapters/common/src:adapters/hermes-sdk/src:python/src pytest -q tests/test_adapaters_hermes_common.py tests/test_hermes_sdk_adapter.py tests/test_hermes_cli.py
  • printf 'hello from manual check\n/exit\n' | cargo run -q -p fabric-cli -- chat tests/fixtures/hermes-shim-agent --profile env_local --session-id cli-session-123 --verbose exits 0 with empty stdout and chat UI on stderr.
  • cargo run -q -p fabric-cli -- chat examples/code-review-agent --profile hermes_sdk </dev/null exits 1 with fabric chat requires runtime.mode=session; use \fabric run` for oneshot profiles`.
  • git diff --check

Summary by CodeRabbit

  • New Features

    • Added explicit multi-turn session_id support across the SDK and Hermes adapter flow (including per-turn context propagation).
    • Introduced an interactive fabric chat command for session-mode runtimes, supporting resumable sessions and optional per-turn verbose output.
  • Bug Fixes

    • Improved session resumption to consistently prefer caller-provided session_id, with clear validation/errors when not using runtime.mode: session.
  • Documentation

    • Expanded README multi-turn and interactive CLI chat guidance with updated examples.
  • Tests / Chores

    • Extended smoke tests and examples coverage; added ctrlc for clean interrupt handling.

@linear

linear Bot commented Jun 26, 2026

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds session_id plumbing across runtime contracts, Python and Hermes session handling, and adapter payloads. Also introduces fabric chat, updates the README session docs, and extends smoke coverage for multi-turn sessions and CLI interaction.

Changes

Session Identity and Chat Flow

Layer / File(s) Summary
Session id runtime contract
schemas/adapter-invocation.schema.json, schemas/runtime-context.schema.json, crates/fabric-core/src/runtime.rs, python/src/nemo_fabric/client.py, python/tests/smoke_sdk_sessions.py, tests/test_session.py
session_id is added to runtime schemas and carried through RuntimeContext, FabricClient.start*, and Session, with tests covering fallback behavior and session-mode validation.
Hermes session continuation
adapters/common/src/.../hermes.py, adapters/hermes-cli/src/.../adapter.py, tests/fixtures/hermes-shim-agent/.../adapter.py, tests/test_adapaters_hermes_common.py, tests/smoke_hermes_session.py
Hermes helpers and adapters switch to caller session_id, use it for session lookup and continuation, and surface it in fixture and smoke outputs.
Interactive chat command
Cargo.toml, crates/fabric-cli/Cargo.toml, crates/fabric-cli/src/main.rs, tests/smoke_cli.py
fabric chat adds session-mode runtime orchestration, stdin-driven REPL handling, Ctrl-C support, verbose turn metadata, and CLI smoke coverage.
Session docs and examples
README.md, python/tests/smoke_readme_examples.py
README session guidance and examples now describe explicit session_id use and the fabric chat flow, with matching smoke expectations.

Sequence Diagram(s)

See hidden review stack artifact.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • NVIDIA/NeMo-Fabric#12: Extends the Python SDK Session boundary and per-turn request context handling that this PR builds on.
  • NVIDIA/NeMo-Fabric#15: Introduces the Hermes payload context flow that this PR updates to prefer session_id.
  • NVIDIA/NeMo-Fabric#17: Covers adjacent Hermes session plumbing and CLI continuation logic that this PR further propagates.

Suggested labels

enhancement

Suggested reviewers

  • dagardner-nv
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.92% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a new Fabric chat session entrypoint.
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 PR with unit tests

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

@AjayThorve
AjayThorve requested a review from dagardner-nv June 26, 2026 00:48
@AjayThorve
AjayThorve marked this pull request as ready for review June 26, 2026 00:55

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
README.md (1)

177-233: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make the session-mode requirement explicit in the examples.

The prose says sessions/chat require runtime.mode: session, but neither snippet shows that field. Copy/paste users can end up with a profile that looks valid and then fail at startup if it isn't session-mode.

🤖 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 `@README.md` around lines 177 - 233, Make the session-mode requirement explicit
in both the `FabricClient().start(...)` example and the `fabric chat` example by
showing that the referenced profile must use `runtime.mode: session`. Update the
`chat()` snippet and the CLI snippet so users can see the needed session-mode
configuration in context, matching the prose already under the “Multi-Turn SDK
Sessions” and “Interactive CLI Chat” sections.
🧹 Nitpick comments (2)
python/tests/smoke_readme_examples.py (1)

36-43: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Tighten the README smoke anchors.

These checks only prove that a few literals exist; they do not protect the chat/session transcript contract described in the README. If the banner, prompt, or /verbose metadata output drifts, this test will still pass.

Consider anchoring on a couple of stable lines from the actual example (session.runtime_id, agent>, /info) so the smoke fails when the user-facing flow changes.

🤖 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 `@python/tests/smoke_readme_examples.py` around lines 36 - 43, The README smoke
test is too loose because it only checks for a few standalone literals and can
miss regressions in the chat/session transcript contract. Update the assertions
in smoke_readme_examples.py to anchor on stable, user-facing lines from the
actual example, such as session.runtime_id, agent>, and /info, so the test fails
when the banner, prompt, or verbose metadata flow changes. Keep the checks tied
to the example’s transcript rather than generic strings like session_id or
fabric chat.
tests/test_session.py (1)

167-167: 📐 Maintainability & Code Quality | 🔵 Trivial

Optional: silence RUF043 by marking the match= pattern as raw or escaping the dot.

The . in runtime.mode is a regex metacharacter. It happens to match the literal dot, so behavior is unaffected, but Ruff flags it.

♻️ Suggested tweak
-    with pytest.raises(RuntimeError, match="requires runtime.mode=session"):
+    with pytest.raises(RuntimeError, match=r"requires runtime\.mode=session"):

Also applies to: 206-206, 613-613

🤖 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_session.py` at line 167, Update the pytest.raises assertions in
test_session to avoid Ruff RUF043 by making the match patterns raw strings or
escaping the dot in runtime.mode; locate the affected assertions around the
RuntimeError checks in the session tests and adjust the match= values
consistently for all mentioned occurrences.

Source: Linters/SAST tools

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

Outside diff comments:
In `@README.md`:
- Around line 177-233: Make the session-mode requirement explicit in both the
`FabricClient().start(...)` example and the `fabric chat` example by showing
that the referenced profile must use `runtime.mode: session`. Update the
`chat()` snippet and the CLI snippet so users can see the needed session-mode
configuration in context, matching the prose already under the “Multi-Turn SDK
Sessions” and “Interactive CLI Chat” sections.

---

Nitpick comments:
In `@python/tests/smoke_readme_examples.py`:
- Around line 36-43: The README smoke test is too loose because it only checks
for a few standalone literals and can miss regressions in the chat/session
transcript contract. Update the assertions in smoke_readme_examples.py to anchor
on stable, user-facing lines from the actual example, such as
session.runtime_id, agent>, and /info, so the test fails when the banner,
prompt, or verbose metadata flow changes. Keep the checks tied to the example’s
transcript rather than generic strings like session_id or fabric chat.

In `@tests/test_session.py`:
- Line 167: Update the pytest.raises assertions in test_session to avoid Ruff
RUF043 by making the match patterns raw strings or escaping the dot in
runtime.mode; locate the affected assertions around the RuntimeError checks in
the session tests and adjust the match= values consistently for all mentioned
occurrences.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2bd9a11d-560d-4141-905b-bed19b60d368

📥 Commits

Reviewing files that changed from the base of the PR and between 21c27cf and 3c3f794.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (17)
  • Cargo.toml
  • README.md
  • adapters/common/src/nemo_fabric_adapters/common/hermes.py
  • adapters/hermes-cli/src/nemo_fabric_adapters/hermes_cli/adapter.py
  • crates/fabric-cli/Cargo.toml
  • crates/fabric-cli/src/main.rs
  • crates/fabric-core/src/runtime.rs
  • python/src/nemo_fabric/client.py
  • python/tests/smoke_readme_examples.py
  • python/tests/smoke_sdk_sessions.py
  • schemas/adapter-invocation.schema.json
  • schemas/runtime-context.schema.json
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/smoke_cli.py
  • tests/smoke_hermes_session.py
  • tests/test_adapaters_hermes_common.py
  • tests/test_session.py

@dagardner-nv dagardner-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving with questions:

When we resume a session in Fabric, the session id is the runtime id of the initial run correct?

When we resume, the second run has a new runtime id?

It's unclear from the README.md if the user is allowed to supply their own session_id or not.

I think this is OK, but let's just document it.

Comment thread adapters/common/src/nemo_fabric_adapters/common/hermes.py Outdated
@AjayThorve

Copy link
Copy Markdown
Collaborator Author

Approving with questions:

When we resume a session in Fabric, the session id is the runtime id of the initial run correct?

When we resume, the second run has a new runtime id?

It's unclear from the README.md if the user is allowed to supply their own session_id or not.

I think this is OK, but let's just document it.

User is allowed to now supply the session_id yes. I will.make sure its clearer in documentation

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
adapters/hermes-sdk/src/nemo_fabric_adapters/hermes_sdk/adapter.py (1)

55-66: 🗄️ Data Integrity & Integration | 🟠 Major

Use the resolved Hermes session ID for agent resume.
load_runtime_history() resolves compressed sessions, but AIAgent(..., session_id=...) still gets the original Fabric key. That can split history lookup and future writes across different Hermes sessions; resolve once and pass that same Hermes ID through both paths. Also applies to lines 116-118 and 138-140.

🤖 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-sdk/src/nemo_fabric_adapters/hermes_sdk/adapter.py` around
lines 55 - 66, Use the resolved Hermes session ID consistently for resume: in
load_runtime_history() resolve the Fabric session key once via
resolve_resume_session_id and return/pass that Hermes ID instead of the original
fabric_session_id. Update the AIAgent(session_id=...) call sites and the resume
path around the referenced adapter logic so both history loading and future
writes use the same resolved session identifier, preventing split session state.
🤖 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.

Outside diff comments:
In `@adapters/hermes-sdk/src/nemo_fabric_adapters/hermes_sdk/adapter.py`:
- Around line 55-66: Use the resolved Hermes session ID consistently for resume:
in load_runtime_history() resolve the Fabric session key once via
resolve_resume_session_id and return/pass that Hermes ID instead of the original
fabric_session_id. Update the AIAgent(session_id=...) call sites and the resume
path around the referenced adapter logic so both history loading and future
writes use the same resolved session identifier, preventing split session state.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 41a7b3c7-c51b-4506-978a-2a03ccaa4b78

📥 Commits

Reviewing files that changed from the base of the PR and between 3c3f794 and 67c2de1.

📒 Files selected for processing (3)
  • adapters/common/src/nemo_fabric_adapters/common/hermes.py
  • adapters/hermes-cli/src/nemo_fabric_adapters/hermes_cli/adapter.py
  • adapters/hermes-sdk/src/nemo_fabric_adapters/hermes_sdk/adapter.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • adapters/common/src/nemo_fabric_adapters/common/hermes.py

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
adapters/hermes-cli/src/nemo_fabric_adapters/hermes_cli/adapter.py (1)

95-113: 🎯 Functional Correctness | 🟠 Major

Use the Hermes session id returned by ensure_hermes_session(). build_command() still passes harness_session_id to --continue, so a compressed session can resume the wrong record. Thread session["session_id"] through the command builder and keep harness_session_id only as the caller-facing id.

🤖 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 95 - 113, `build_command()` is still using the caller-facing
`harness_session_id` for `--continue` instead of the session id returned by
`ensure_hermes_session()`, which can resume the wrong record. Update
`adapter.py` so the result from `ensure_hermes_session()` is captured and its
`session["session_id"]` is threaded into `build_command()`. Keep
`harness_session_id` only for external/caller-facing use, and make sure the
continuation flag is built from the Hermes session id.
🤖 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.

Outside diff comments:
In `@adapters/hermes-cli/src/nemo_fabric_adapters/hermes_cli/adapter.py`:
- Around line 95-113: `build_command()` is still using the caller-facing
`harness_session_id` for `--continue` instead of the session id returned by
`ensure_hermes_session()`, which can resume the wrong record. Update
`adapter.py` so the result from `ensure_hermes_session()` is captured and its
`session["session_id"]` is threaded into `build_command()`. Keep
`harness_session_id` only for external/caller-facing use, and make sure the
continuation flag is built from the Hermes session id.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a866ecab-13d5-482d-a996-e3ea01a1c63b

📥 Commits

Reviewing files that changed from the base of the PR and between 67c2de1 and 82cf863.

📒 Files selected for processing (2)
  • adapters/common/src/nemo_fabric_adapters/common/hermes.py
  • adapters/hermes-cli/src/nemo_fabric_adapters/hermes_cli/adapter.py

Signed-off-by: Ajay Thorve <athorve@nvidia.com>
Signed-off-by: Ajay Thorve <athorve@nvidia.com>
Signed-off-by: Ajay Thorve <athorve@nvidia.com>

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
adapters/hermes-cli/src/nemo_fabric_adapters/hermes_cli/adapter.py (1)

95-113: 🎯 Functional Correctness | 🟠 Major

Use the resolved Hermes session id for --continue. run_hermes_cli() ignores the session object returned by ensure_hermes_session(), and build_command() still passes Fabric’s key into chat --continue. If Hermes rotates the underlying session id after compression, resume can hit the wrong session; thread the returned Hermes session id into build_command() and keep fabric_session_id only for Fabric-facing output.

🤖 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 95 - 113, The `run_hermes_cli()` flow is still using Fabric’s
`fabric_session_id` when building the `chat --continue` command, even though
`ensure_hermes_session()` can return a resolved Hermes session id after
rotation. Update `run_hermes_cli()` to capture the session object/id returned by
`ensure_hermes_session()` and pass that resolved Hermes session id into
`build_command()` for `--continue`, while keeping `fabric_session_id` only for
Fabric-facing output and logging.
🤖 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.

Outside diff comments:
In `@adapters/hermes-cli/src/nemo_fabric_adapters/hermes_cli/adapter.py`:
- Around line 95-113: The `run_hermes_cli()` flow is still using Fabric’s
`fabric_session_id` when building the `chat --continue` command, even though
`ensure_hermes_session()` can return a resolved Hermes session id after
rotation. Update `run_hermes_cli()` to capture the session object/id returned by
`ensure_hermes_session()` and pass that resolved Hermes session id into
`build_command()` for `--continue`, while keeping `fabric_session_id` only for
Fabric-facing output and logging.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 88157d66-07bb-450e-85c2-58b9e2c07587

📥 Commits

Reviewing files that changed from the base of the PR and between 82cf863 and 94efa7c.

📒 Files selected for processing (2)
  • adapters/common/src/nemo_fabric_adapters/common/hermes.py
  • adapters/hermes-cli/src/nemo_fabric_adapters/hermes_cli/adapter.py

@AjayThorve
AjayThorve force-pushed the ajay/fabric-35-chat-session-id branch from 94efa7c to 7f1e6f2 Compare June 26, 2026 16:32
Signed-off-by: Ajay Thorve <athorve@nvidia.com>

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

🧹 Nitpick comments (3)
crates/fabric-core/src/runtime.rs (1)

1224-1258: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Silently dropping non-existent relay artifacts may hide adapter contract errors.

promote_relay_artifacts_to_manifest skips any candidate whose path doesn't exist via !path.exists(). That's a reasonable guard, but a missing file is just as likely a path-resolution bug in the adapter as it is an intentional omission, and the silent continue gives no signal. Consider emitting a debug/warn trace when a declared relay artifact can't be found so misconfigured adapters are diagnosable.

🤖 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 `@crates/fabric-core/src/runtime.rs` around lines 1224 - 1258, The
promote_relay_artifacts_to_manifest function is silently skipping relay
artifacts whose resolved path does not exist, which makes adapter path bugs hard
to diagnose. Update the !path.exists() branch in
promote_relay_artifacts_to_manifest to emit a debug or warn trace that includes
the missing artifact path and relevant kind before continuing, while keeping the
existing duplicate and empty-path guards unchanged.
tests/smoke_cli.py (1)

155-187: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Minor duplication between run, run_with_stdin, and run_raw.

run and run_with_stdin share identical non-zero return-code assertion logic; run could delegate to run_raw to dedupe. Optional cleanup. (The Ruff S603 / ast-grep subprocess hints are false positives here: COMMAND is a fixed constant, not request-derived input.)

🤖 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/smoke_cli.py` around lines 155 - 187, `run` and `run_with_stdin`
duplicate the same non-zero return-code assertion, so simplify the smoke CLI
helpers by centralizing subprocess execution and failure handling. Have `run`
delegate to `run_raw` (or extract a shared assertion helper used by both `run`
and `run_with_stdin`) and keep `run_raw` responsible only for calling
`subprocess.run`; use the existing `run`, `run_with_stdin`, and `run_raw`
symbols to update the test helper cleanly.

Source: Linters/SAST tools

crates/fabric-cli/src/main.rs (1)

247-254: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

run_chat lifecycle ordering is correct; clippy ? hint is a safe simplification.

The current shape guarantees stop_runtime always runs even when chat_loop fails, and prioritizes the chat error. The Clippy hint at Line 250 can be applied without changing semantics since stop_result is already evaluated.

♻️ Optional simplification
     let runtime = start_runtime(&plan)?;
     let chat_result = chat_loop(&plan, &runtime, session_id.as_deref(), verbose);
     let stop_result = stop_runtime(&plan, &runtime);
-    if let Err(error) = chat_result {
-        return Err(error);
-    }
+    chat_result?;
     stop_result?;
     Ok(())
🤖 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 `@crates/fabric-cli/src/main.rs` around lines 247 - 254, In run_chat, the
lifecycle ordering is already correct, so simplify the manual chat_result error
handling by using the `?`-style clippy suggestion only in a way that still
evaluates `stop_runtime` before returning; keep the existing behavior where
`chat_loop` errors are prioritized after `stop_runtime` runs, and adjust the
control flow around `chat_loop`, `stop_runtime`, and the final return to make
the intent clearer without changing semantics.

Source: Linters/SAST tools

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

Nitpick comments:
In `@crates/fabric-cli/src/main.rs`:
- Around line 247-254: In run_chat, the lifecycle ordering is already correct,
so simplify the manual chat_result error handling by using the `?`-style clippy
suggestion only in a way that still evaluates `stop_runtime` before returning;
keep the existing behavior where `chat_loop` errors are prioritized after
`stop_runtime` runs, and adjust the control flow around `chat_loop`,
`stop_runtime`, and the final return to make the intent clearer without changing
semantics.

In `@crates/fabric-core/src/runtime.rs`:
- Around line 1224-1258: The promote_relay_artifacts_to_manifest function is
silently skipping relay artifacts whose resolved path does not exist, which
makes adapter path bugs hard to diagnose. Update the !path.exists() branch in
promote_relay_artifacts_to_manifest to emit a debug or warn trace that includes
the missing artifact path and relevant kind before continuing, while keeping the
existing duplicate and empty-path guards unchanged.

In `@tests/smoke_cli.py`:
- Around line 155-187: `run` and `run_with_stdin` duplicate the same non-zero
return-code assertion, so simplify the smoke CLI helpers by centralizing
subprocess execution and failure handling. Have `run` delegate to `run_raw` (or
extract a shared assertion helper used by both `run` and `run_with_stdin`) and
keep `run_raw` responsible only for calling `subprocess.run`; use the existing
`run`, `run_with_stdin`, and `run_raw` symbols to update the test helper
cleanly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 5e8cdc96-9156-4c78-87f6-2d63a44cebd4

📥 Commits

Reviewing files that changed from the base of the PR and between 94efa7c and bb25d71.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (17)
  • Cargo.toml
  • README.md
  • adapters/common/src/nemo_fabric_adapters/common/hermes.py
  • adapters/hermes-cli/src/nemo_fabric_adapters/hermes_cli/adapter.py
  • crates/fabric-cli/Cargo.toml
  • crates/fabric-cli/src/main.rs
  • crates/fabric-core/src/runtime.rs
  • python/src/nemo_fabric/client.py
  • python/tests/smoke_readme_examples.py
  • python/tests/smoke_sdk_sessions.py
  • schemas/adapter-invocation.schema.json
  • schemas/runtime-context.schema.json
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/smoke_cli.py
  • tests/smoke_hermes_session.py
  • tests/test_adapaters_hermes_common.py
  • tests/test_session.py
✅ Files skipped from review due to trivial changes (3)
  • crates/fabric-cli/Cargo.toml
  • tests/smoke_hermes_session.py
  • README.md
🚧 Files skipped from review as they are similar to previous changes (8)
  • python/tests/smoke_readme_examples.py
  • schemas/adapter-invocation.schema.json
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • Cargo.toml
  • adapters/common/src/nemo_fabric_adapters/common/hermes.py
  • schemas/runtime-context.schema.json
  • adapters/hermes-cli/src/nemo_fabric_adapters/hermes_cli/adapter.py
  • python/tests/smoke_sdk_sessions.py

Signed-off-by: Ajay Thorve <athorve@nvidia.com>
@AjayThorve
AjayThorve merged commit 4b0488a into NVIDIA:main Jun 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants