Skip to content

fix(pii): preserve bounded trajectory status metadata - #1339

Merged
willkill07 merged 2 commits into
NVIDIA:release/0.10from
j-nolan:fix/trajectory-error-status
Oct 14, 2026
Merged

willkill07 merged 2 commits into
NVIDIA:release/0.10from
j-nolan:fix/trajectory-error-status

Conversation

@j-nolan

@j-nolan j-nolan commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Relay's trajectory_context preset removes sensitive content from telemetry before it is exported. It currently also removes the fields that say whether a model or tool call succeeded or failed. Both successful and failed calls therefore appear with UNSET status.

This PR preserves status and error classifications so that redacted telemetry still reports success and failure. For example, a timeout remains an error with the category timeout, while the detailed error message is removed because it may contain sensitive content.

  • 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

  • Keep the status values OK, ERROR, and UNSET. For errors, also keep Relay's predefined error categories, such as timeout and authentication, and the _OTHER fallback. Check the values as well as the field names, so arbitrary text cannot be exported through these fields.
  • Continue removing detailed error messages, application exception names, other metadata, and unrecognized error categories.
  • Add tests for successful calls, provider failures, callback exceptions, streaming failures, and tool failures. Verify the exported status in all three OpenTelemetry formats: full, gen_ai, and openinference. Also check that sample private content is absent from exported records and that the application still receives the original results and errors.
  • Update the documentation to explain which status fields remain after redaction. All new tests use synthetic inputs and require no model service or API key.

Validation on release/0.10 (base commit 005eb5bc):

  • Rebased the fix onto the release branch without conflicts. git range-diff confirms that the patch is unchanged.
  • Both new regression tests failed before the original implementation change. All 176 redaction tests pass on the release branch.
  • just test-rust: all 5,874 tests passed, with no skipped tests. The run used umask 077 so temporary test directories have private permissions.
  • just test-python: 83 Rust binding tests, 996 Python tests, and 24 example tests passed using Python 3.11.
  • just test-node: 5 Rust binding tests, 453 Node tests, and 26 example tests passed.
  • just docs: passed; the authenticated redirects check was skipped because no Fern token was configured.
  • Repository hooks run against the rebased commit: all applicable checks passed except cargo deny. It reports four advisories for rustls 0.23.45 (RUSTSEC-2026-0346 through RUSTSEC-2026-0349). The upstream release branch uses that same dependency version; this patch does not change it. Workspace Clippy/check, link checking, Python/npm audits, and attribution generation passed.

Where should the reviewer start?

Start with sanitize_scope_status_metadata in crates/pii-redaction/src/trajectory.rs. It keeps only the status values and error categories described above. Then read crates/pii-redaction/tests/unit/trajectory_status_tests.rs, which checks both status reporting and removal of sensitive content.

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

Summary by CodeRabbit

  • New Features
    • Trajectory exports now retain recognized scope status codes: OK, ERROR, and UNSET. For ERROR statuses, recognized error classifications are retained; unrecognized classifications are discarded or represented as _OTHER in supported projections.
  • Bug Fixes
    • Free-form status descriptions, exception types, and other unrecognized metadata continue to be excluded from sanitized exports.
  • Documentation
    • Updated the trajectory context and export documentation to describe which status metadata is retained.

@copy-pr-bot

copy-pr-bot Bot commented Oct 14, 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 Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⛔ Files ignored due to path filters: 1
  • Cargo.lock is excluded by !**/*.lock
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/NeMo-Relay/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 90eba5ff-fc6f-433f-9c90-9a41878e3f55
📥 Commits

Reviewing files that changed from the base of the PR and between 4b9c09c and 92a1da5.

⛔ Files ignored due to path filters: 1
  • Cargo.lock is excluded by !**/*.lock

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/NeMo-Relay/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 35c86a76-3772-41a7-b61a-4853f9617c68
📥 Commits

Reviewing files that changed from the base of the PR and between 005eb5b and 4b9c09c.

⛔ Files ignored due to path filters: 1
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing: 6
  • crates/pii-redaction/Cargo.toml
  • crates/pii-redaction/README.md
  • crates/pii-redaction/src/trajectory.rs
  • crates/pii-redaction/tests/unit/component_tests.rs
  • crates/pii-redaction/tests/unit/trajectory_status_tests.rs
  • docs/configure-plugins/pii-redaction/configuration.mdx

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

📜 Recent review details
🧰 Additional context used
📚 Code guidelines: 6
.agents/skills/contribute-docs/SKILL.md — configured
.agents/skills/review-doc-style/SKILL.md — configured
.agents/skills/prepare-code-freeze/SKILL.md — configured
.agents/skills/update-project-version/SKILL.md — configured
.agents/skills/maintain-packaging/SKILL.md — configured
.agents/skills/draft-release-notes/SKILL.md — configured
📓 Path-based instructions: 10
Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.

⚙️ CodeRabbit configuration file

Files:

  • docs/configure-plugins/pii-redaction/configuration.mdx
Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.

⚙️ CodeRabbit configuration file

Files:

  • crates/pii-redaction/tests/unit/component_tests.rs
  • crates/pii-redaction/tests/unit/trajectory_status_tests.rs
Source excerpt: In MDX files, top-of-file comments must use JSX comment delimiters: `{/*` to open and `*/}` to close.

📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)

Files:

  • docs/configure-plugins/pii-redaction/configuration.mdx
Source excerpt: Verify MDX files use JSX delimiters for top-of-file SPDX comments.

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

Files:

  • docs/configure-plugins/pii-redaction/configuration.mdx
Source excerpt: Search documentation source for references to the old version and update current-version install commands, package examples, and configuration examples to `` where appropriate: Review matches before changing th...

📄 CodeRabbit inference engine (.agents/skills/prepare-code-freeze/SKILL.md)

Files:

  • docs/configure-plugins/pii-redaction/configuration.mdx
Source excerpt: Run `just set-version ` to update all project-owned unified-release version surfaces on `main`, including Cargo, Python, Node, plugins, lockfiles, and coding-agent manifests.

📄 CodeRabbit inference engine (.agents/skills/prepare-code-freeze/SKILL.md)

Files:

  • crates/pii-redaction/Cargo.toml
Source excerpt: Python surfaces use PEP 440 translations where required; Cargo, npm, and plugin manifests use the repository SemVer form.

📄 CodeRabbit inference engine (.agents/skills/update-project-version/SKILL.md)

Files:

  • crates/pii-redaction/Cargo.toml
Source excerpt: Identify the changed documentation, examples, or public strings and any corresponding entry points such as `README.md`, `docs/index.yml`, or package READMEs.

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

Files:

  • crates/pii-redaction/README.md
Source excerpt: Rust `Cargo.toml` package names and workspace metadata

📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)

Files:

  • crates/pii-redaction/Cargo.toml
Source excerpt: Preserve MDX front matter and the JSX SPDX comment.

📄 CodeRabbit inference engine (.agents/skills/draft-release-notes/SKILL.md)

Files:

  • docs/configure-plugins/pii-redaction/configuration.mdx
🧠 Learnings: 1
📓 Common learnings
Learnt from: CR
Repo: NVIDIA/NeMo-Relay

Timestamp: 2026-10-14T15:00:57.748Z
Learning: Applicability reference:
AGENTS.md: # NeMo Relay Repository Guidance
## On-Demand Guidance
See `CONTRIBUTING.md` and `docs/contribute/testing-and-docs.mdx` for contributor
details, and `.agents/skills/README.md` for the maintainer skill boundary.

Source excerpt:
# Contributing to NeMo Relay

## Pull Request Process

### Before Submitting

5. Update the relevant documentation entry points and references.
Learnt from: CR
Repo: NVIDIA/NeMo-Relay

Timestamp: 2026-10-14T15:00:57.748Z
Learning: Applicability reference:
AGENTS.md: # NeMo Relay Repository Guidance
## On-Demand Guidance
See `CONTRIBUTING.md` and `docs/contribute/testing-and-docs.mdx` for contributor
details, and `.agents/skills/README.md` for the maintainer skill boundary.

Source excerpt:
# Contributing to NeMo Relay

## Documentation Checklist

If your change affects public behavior, bindings, examples, or workspace
structure, update the corresponding docs in the same branch.
🔇 Additional comments: 6
crates/pii-redaction/src/trajectory.rs: 1

222-224: LGTM!

crates/pii-redaction/tests/unit/trajectory_status_tests.rs: 1

1-280: LGTM!

crates/pii-redaction/tests/unit/component_tests.rs: 1

65-67: LGTM!

Also applies to: 1581-1581, 1629-1629, 4150-4153

crates/pii-redaction/README.md: 1

148-155: LGTM!

docs/configure-plugins/pii-redaction/configuration.mdx: 1

264-271: LGTM!

crates/pii-redaction/Cargo.toml: 1

32-32: LGTM!

Walkthrough

Trajectory redaction now preserves recognized status codes and bounded error classifications on scope events. New regression tests cover metadata filtering and exported events and spans. The README and configuration guide document retained and discarded metadata.

Changes

Trajectory status metadata

Layer / File(s) Summary
Scope metadata allowlist
crates/pii-redaction/src/trajectory.rs, crates/pii-redaction/tests/unit/trajectory_status_tests.rs, crates/pii-redaction/tests/unit/component_tests.rs, crates/pii-redaction/README.md, docs/configure-plugins/pii-redaction/configuration.mdx
Scope events retain otel.status_code values OK, ERROR, and UNSET. For ERROR, sanitization retains only listed Relay classifications or _OTHER as error.type. Other metadata remains discarded. Tests and documentation cover these rules.
Exporter regression coverage
crates/pii-redaction/Cargo.toml, crates/pii-redaction/tests/unit/component_tests.rs, crates/pii-redaction/tests/unit/trajectory_status_tests.rs
Tests exercise Full, GenAI, and OpenInference exports across successful and failing calls. They check that private content is absent from captured events and spans, while returned errors retain the original content. The crate adds the OpenTelemetry trace development dependency.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 4b9c0

The bounded status metadata change is ready to merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 3 files. (3 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title follows Conventional Commits format, uses the allowed lowercase type and scope, clearly describes the change, contains 53 characters, and has no trailing period.
Description check Passed The description includes all required template sections, completed contribution and duplicate-work confirmations, implementation details, reviewer guidance, a valid related-issue action, and comprehen…
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 3 files. (3 skipped: 3 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions github-actions Bot added size:M PR is medium Bug issue describes bug; PR fixes bug lang:rust PR changes/introduces Rust code labels Oct 14, 2026
@willkill07

Copy link
Copy Markdown
Member

@j-nolan thank you for this PR.

Two questions:

  1. Is this ready for review? I still notice it is in draft.
  2. Could you retarget this fix for the release/0.10 branch?
    • This is a two step process
    • First, rebase your commit on top of the upstream release/0.10 branch, resolve any conflicts, and do a push --force-with-lease
    • Second, you can edit the PR and switch the target branch to release/0.10

Thank you for your contribution! In the future, we like to have issues filed for bugs so we can keep track of them in our system. There is no need to create a corresponding issue now.

@willkill07 willkill07 self-assigned this Oct 14, 2026
@j-nolan
j-nolan force-pushed the fix/trajectory-error-status branch from ca1cad0 to 4b9c09c Compare October 14, 2026 14:57
@j-nolan
j-nolan changed the base branch from main to release/0.10 October 14, 2026 14:57
@j-nolan
j-nolan marked this pull request as ready for review October 14, 2026 14:59
@j-nolan
j-nolan requested review from a team as code owners October 14, 2026 14:59
@j-nolan

j-nolan commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Hi @willkill07 ! I retargetted to release/0.10 and marked as ready to review. I'll make sure to file issues in the future 👍 sorry about that!

@willkill07 willkill07 added this to the 0.10 milestone Oct 14, 2026
@willkill07

This comment was marked as outdated.

@copy-pr-bot

This comment was marked as outdated.

@willkill07

Copy link
Copy Markdown
Member

/ok to test 92a1da5

@github-actions

Copy link
Copy Markdown

License Diff

Compared against origin/release/0.10.

Lockfile license changes

Lockfile License Changes

Rust

Added

  • None

Removed

  • None

Updated/Changed

  • None

Node

Added

  • None

Removed

  • None

Updated/Changed

  • None

Python

Added

  • None

Removed

  • None

Updated/Changed

  • None
Status output
[license-diff] selected languages: rust, node, python
[license-diff] generating current inventory
[license-diff] current: generating Rust inventory
[license-diff] current: Rust inventory complete (474 packages)
[license-diff] current: generating Node inventory
[license-diff] current: Node inventory complete (424 packages)
[license-diff] current: generating Python inventory
[license-diff] current: Python inventory complete (115 packages)
[license-diff] current inventory complete
[license-diff] checking out base ref origin/release/0.10 into a temporary worktree
[license-diff] base: generating Rust inventory
[license-diff] base: Rust inventory complete (474 packages)
[license-diff] base: generating Node inventory
[license-diff] base: Node inventory complete (424 packages)
[license-diff] base: generating Python inventory
[license-diff] base: Python inventory complete (115 packages)
[license-diff] base inventory complete
[license-diff] removing temporary base worktree
[license-diff] comparing inventories
[license-diff] rendering Markdown output
[license-diff] done

@github-actions

Copy link
Copy Markdown

@willkill07
willkill07 enabled auto-merge (squash) October 14, 2026 16:24
@willkill07
willkill07 merged commit aa8a20f into NVIDIA:release/0.10 Oct 14, 2026
45 checks passed

This branch was previously deployed

1 inactive deployment
fern — 92a1da55 Deployed Oct 14, 2026 by willkill07 via Clean up docs preview #5744
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.

2 participants