fix: Use OpenAI body session_id as gateway fallback#184
Closed
bbednarski9 wants to merge 6 commits into
Closed
Conversation
#### 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
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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>
cf1082b to
4fe00c2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds a gateway session-id fallback for OpenAI-compatible requests that carry a top-level
session_idin the request body, and tightens ATIF LLM de-dupe so complementary hook/gateway spans do not collapse concurrent distinct requests.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_idin 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_idfor 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, specificallygateway_session_idandopenai_body_session_id. Then reviewcrates/core/src/observability/atif.rs, specificallycomplementary_hook_and_gateway_spansand request correlation key extraction.Main coverage is in
crates/cli/tests/coverage/alignment_tests.rs,crates/cli/tests/coverage/gateway_tests.rs, andcrates/core/tests/unit/atif_tests.rs.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)