Skip to content

fix: Use OpenAI body session_id as gateway fallback#184

Closed
bbednarski9 wants to merge 6 commits into
NVIDIA:release/0.3from
bbednarski9:bbednarski/issue-176-gateway-session-fallback
Closed

fix: Use OpenAI body session_id as gateway fallback#184
bbednarski9 wants to merge 6 commits into
NVIDIA:release/0.3from
bbednarski9:bbednarski/issue-176-gateway-session-fallback

Conversation

@bbednarski9

@bbednarski9 bbednarski9 commented May 29, 2026

Copy link
Copy Markdown
Contributor

Overview

Adds a gateway session-id fallback for OpenAI-compatible requests that carry a top-level session_id in the request body, and tightens ATIF LLM de-dupe so complementary hook/gateway spans do not collapse concurrent distinct requests.

  • 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

Some CLI/plugin harnesses do not send an explicit NeMo Relay session header on gateway-observed OpenAI-compatible LLM requests, but they do include a top-level session_id in the request body. Without this fallback, those gateway-observed spans may not align with the intended session.

This PR updates gateway session-id resolution to use body session_id for OpenAI chat completions and OpenAI responses routes, while preserving precedence for explicit relay headers, Claude headers, and Codex prompt-cache routing. The fallback is ignored for non-OpenAI routes and for empty or non-string body values.

It also strengthens the ATIF complementary hook/gateway LLM de-dupe path. Non-exact hook spans and gateway spans now de-dupe only when they have complementary polarity plus either matching request signatures or a shared strong request correlation key. This preserves the Hermes hook/gateway de-dupe path while avoiding accidental collapse of overlapping concurrent LLM calls under the same parent/model.

Where should the reviewer start?

Start with crates/cli/src/alignment/mod.rs, specifically gateway_session_id and openai_body_session_id. Then review crates/core/src/observability/atif.rs, specifically complementary_hook_and_gateway_spans and request correlation key extraction.

Main coverage is in crates/cli/tests/coverage/alignment_tests.rs, crates/cli/tests/coverage/gateway_tests.rs, and crates/core/tests/unit/atif_tests.rs.

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

willkill07 and others added 2 commits May 28, 2026 22:47
#### Overview

Prepare the repository for the 0.3 code freeze by cutting the release branch, moving main to the next development version, and cleaning up current-version documentation references.

- [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

- Created and pushed `release/0.3` from `upstream/main` commit `932248c37e92d2918cde1c545c19662bc8b786bd`.
- Added `release/0.3` to `.github/nightly-alpha-branches.yaml` so nightly alpha tagging covers the frozen branch.
- Ran `just set-version 0.4.0` to bump main release-versioned package surfaces after the branch cut.
- Updated current-version docs examples from `0.3.0` to `0.4.0` for install commands, OpenClaw package examples, and observability service-version examples.
- Updated the code-freeze skill to search documentation source for old release-version references during future freezes.
- Release-bound PRs for 0.3 should now target `release/0.3`; main continues toward `0.4.0`.

Validation:

- `ruby -e 'require "yaml"; YAML.load_file(".github/nightly-alpha-branches.yaml"); YAML.load_file(".github/workflows/nightly-alpha-tag.yaml")'`
- `just set-version 0.4.0`
- `rg -n '0\.3\.0' README.md docs fern --glob '!docs/_build/**' || true` returned no source-doc matches
- `git diff --check`
- `cargo check --workspace`
- `just docs`
- Commit hook changed-file checks

#### Where should the reviewer start?

Start with `.github/nightly-alpha-branches.yaml`, then verify the `0.4.0` version bump in `Cargo.toml`, the package lockfiles, and the docs version-reference updates.

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

- Relates to: none

Signed-off-by: Will Killian <wkillian@nvidia.com>
Forward-merge release/0.3 into main
@copy-pr-bot

copy-pr-bot Bot commented May 29, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: c4e475f4-baaa-42fb-b43a-20a650d48a47

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@github-actions github-actions Bot added size:S PR is small lang:rust PR changes/introduces Rust code labels May 29, 2026
@willkill07 willkill07 added this to the 0.3 milestone May 29, 2026
@willkill07 willkill07 changed the title Use OpenAI body session_id as gateway fallback fix: Use OpenAI body session_id as gateway fallback May 29, 2026
@github-actions github-actions Bot added the Bug issue describes bug; PR fixes bug label May 29, 2026
GPUtester and others added 4 commits May 29, 2026 15:15
Forward-merge release/0.3 into main
Forward-merge release/0.3 into main
  Add a gateway session-id fallback for OpenAI-compatible requests that
  carry a top-level  in the request body. Explicit relay headers,
  Claude headers, and Codex prompt-cache routing still take precedence.

  This lets CLI/plugin harnesses keep gateway-observed LLM calls aligned to
  the intended session even when no relay session header is available.

  Also adds regression coverage for:
  - OpenAI chat completions body

Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
@bbednarski9 bbednarski9 force-pushed the bbednarski/issue-176-gateway-session-fallback branch from cf1082b to 4fe00c2 Compare May 29, 2026 20:59
@github-actions github-actions Bot added size:M PR is medium and removed size:S PR is small labels May 29, 2026
@github-actions

Copy link
Copy Markdown

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.

3 participants