Skip to content

enhancement: reduce ATIF output size - #1520

Merged
willkill07 merged 1 commit into
NVIDIA:mainfrom
willkill07:enh/reduce-atif-output-size
Oct 26, 2026
Merged

willkill07 merged 1 commit into
NVIDIA:mainfrom
willkill07:enh/reduce-atif-output-size

Conversation

@willkill07

@willkill07 willkill07 commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Overview

ATIF exports repeat full request histories in trajectory steps and raw events. Add options to omit either copy, and send compact JSON to HTTP and S3 storage.

  • 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

  • Add include_observed_events and include_llm_requests to the Rust, Python, Node.js, and Go configuration types. Both default to true.
  • Skip the extra raw event buffer when include_observed_events is false. Keep event deduplication.
  • Remove full requests from user and agent steps when include_llm_requests is false. Apply this to embedded subagent trajectories and shutdown exports.
  • Send compact JSON to remote storage. Keep local-only exports indented. Local recovery files use the same payload as the upload.
  • Add configuration, lifecycle, HTTP upload, and size growth tests. Document the settings in plain English.

Set both options to false to remove both copies of request history. Full requests can hold data that step messages omit, so consumers that rebuild requests should keep request retention enabled. The core exporter still keeps full events in memory. Standalone AtifExporter behavior stays the same.

Validation:

  • just test-rust: 6,533 passed, with one test passing on retry. Used human-readable logging for a CLI test that expects that format.
  • just test-python: 1,211 Python tests, 86 native tests, and 24 plugin example tests passed. Pinned Python 3.13.14 to match the virtual environment.
  • just test-node and just test-go passed.
  • Final focused ATIF run: 67 tests passed. Clippy, Cargo check, formatting, and changed-file Python type checks passed.
  • just docs-linkcheck passed. The published redirect comparison was skipped because the docs service returned HTTP 403.
  • The full ty hook reports three unused-suppression warnings in unchanged integration tests. The full check passes with --exit-zero-on-warning. Only that hook was skipped for the commit retry.

Where should the reviewer start?

Start with prepare_atif_payload in crates/core/src/observability/plugin_component.rs. Then review the retention and size growth tests in crates/core/tests/unit/observability/plugin_component_tests.rs.

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

Summary by CodeRabbit

  • New Features
    • ATIF exports now include observed events and full LLM requests by default. You can disable either option to reduce exported data, including requests embedded in nested agent trajectories.
    • Remote exports use compact JSON to reduce payload size; local exports remain formatted for readability.
    • The new options are available in the observability plugin configuration across supported language clients.
  • Documentation
    • Updated ATIF configuration guidance to explain the retention options and their effects.

@willkill07
willkill07 requested review from a team as code owners October 26, 2026 13:34
@github-actions github-actions Bot added size:M PR is medium Improvement improvement to existing functionality lang:go PR changes/introduces Go code lang:js PR changes/introduces Javascript/Typescript code lang:python PR changes/introduces Python code lang:rust PR changes/introduces Rust code labels Oct 26, 2026
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 18325d9 and 96078b1.

Files selected for processing: 13
  • crates/core/src/observability/plugin_component.rs
  • crates/core/tests/integration/atif_storage_tests.rs
  • crates/core/tests/unit/observability/plugin_component_tests.rs
  • crates/node/observability.d.ts
  • crates/node/observability.js
  • crates/node/tests/observability_plugin_tests.mjs
  • docs/about-nemo-relay/concepts/subscribers.mdx
  • docs/configure-plugins/observability/atif.mdx
  • go/nemo_relay/observability_plugin.go
  • go/nemo_relay/observability_plugin_test.go
  • python/nemo_relay/observability.py
  • python/nemo_relay/observability.pyi
  • python/tests/test_observability_plugin.py

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

Recent review details
Context from checks skipped due to timeout: 2
  • GitHub Check: Changes / Detect
  • GitHub Check: Detect docs changes
Additional context used
Code guidelines: 4
.agents/skills/contribute-docs/SKILL.md — configured
.agents/skills/contribute-integration/SKILL.md — configured
.agents/skills/review-doc-style/SKILL.md — configured
.agents/skills/maintain-observability/SKILL.md — configured
Path-based instructions: 11
Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.

CodeRabbit configuration file

Files:

  • docs/configure-plugins/observability/atif.mdx
  • docs/about-nemo-relay/concepts/subscribers.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/node/tests/observability_plugin_tests.mjs
  • crates/core/tests/integration/atif_storage_tests.rs
  • go/nemo_relay/observability_plugin_test.go
  • python/tests/test_observability_plugin.py
  • crates/core/tests/unit/observability/plugin_component_tests.rs
Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.

CodeRabbit configuration file

Files:

  • crates/core/tests/integration/atif_storage_tests.rs
  • crates/core/tests/unit/observability/plugin_component_tests.rs
  • crates/core/src/observability/plugin_component.rs
Treat binding changes as public API changes.

CodeRabbit configuration file

Files:

  • crates/node/tests/observability_plugin_tests.mjs
  • crates/node/observability.js
  • crates/node/observability.d.ts
Review Python wrapper changes for typed API consistency, contextvars-based scope isolation, async behavior, and parity with the native extension.

CodeRabbit configuration file

Files:

  • python/nemo_relay/observability.pyi
  • python/nemo_relay/observability.py
Review Go binding changes for cgo memory ownership, race safety, callback cleanup, idiomatic exported APIs, and parity with Rust/FFI behavior.

CodeRabbit configuration file

Files:

  • go/nemo_relay/observability_plugin_test.go
  • go/nemo_relay/observability_plugin.go
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/observability/atif.mdx
  • docs/about-nemo-relay/concepts/subscribers.mdx
Source excerpt: Keep NeMo Relay optional Source excerpt: Use stable, documented framework or plugin APIs Source excerpt: Wrap tool and LLM paths at the correct framework boundary Source excerpt: Preserve the framework's original behavior wh...

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

Files:

  • crates/node/tests/observability_plugin_tests.mjs
  • crates/node/observability.js
  • python/nemo_relay/observability.pyi
  • crates/node/observability.d.ts
  • crates/core/tests/integration/atif_storage_tests.rs
  • docs/configure-plugins/observability/atif.mdx
  • go/nemo_relay/observability_plugin_test.go
  • docs/about-nemo-relay/concepts/subscribers.mdx
  • python/tests/test_observability_plugin.py
  • go/nemo_relay/observability_plugin.go
  • crates/core/tests/unit/observability/plugin_component_tests.rs
  • python/nemo_relay/observability.py
  • crates/core/src/observability/plugin_component.rs
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/observability/atif.mdx
  • docs/about-nemo-relay/concepts/subscribers.mdx
Source excerpt: Docs under `docs/about-nemo-relay/concepts/subscribers.mdx` and `docs/configure-plugins/observability/`

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

Files:

  • docs/configure-plugins/observability/atif.mdx
  • docs/about-nemo-relay/concepts/subscribers.mdx
Source excerpt: Update and validate docs or examples when the public workflow, documented observability contract, or emitted output changed.

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

Files:

  • docs/configure-plugins/observability/atif.mdx
Learnings: 1
Learning: 2026-07-14T02:53:44.529Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 414
File: crates/node/tests/observability_plugin_tests.mjs:34-34
Timestamp: 2026-07-14T02:53:44.529Z
Learning: Do not flag camelCase style violations for keys returned by observability plugin configuration helpers (e.g., `observability.otlpConfig()` and similar helpers like `atofConfig()` / `atifConfig()`) in the Node observability module and its tests. These helpers intentionally return the snake_case plugin configuration schema consumed by `plugin.initialize()` and written/read via TOML. This is distinct from the Node public API / native subscriber options (e.g., fields like `attributeMappings`) which follow the camelCase guideline; only the plugin-config schema helpers should be exempt.

Applied to files:

  • crates/node/tests/observability_plugin_tests.mjs
Additional comments: 13
crates/core/src/observability/plugin_component.rs: 1

614-623: LGTM!

Also applies to: 638-639, 1257-1258, 3262-3278, 3288-3288, 3316-3316, 3444-3448, 3451-3451, 3510-3512, 3620-3620, 3985-3985, 4011-4011, 4015-4015, 4021-4021, 4024-4028, 4038-4043, 4055-4059, 4070-4082, 4808-4809

crates/node/observability.d.ts: 1

69-72: LGTM!

crates/node/observability.js: 1

47-48: LGTM!

crates/node/tests/observability_plugin_tests.mjs: 1

34-35: LGTM!

Also applies to: 37-39

go/nemo_relay/observability_plugin.go: 1

206-211: LGTM!

go/nemo_relay/observability_plugin_test.go: 1

826-851: LGTM!

python/nemo_relay/observability.py: 1

201-202: LGTM!

Also applies to: 216-217

python/nemo_relay/observability.pyi: 1

81-82: LGTM!

python/tests/test_observability_plugin.py: 1

271-272: LGTM!

Also applies to: 274-276

crates/core/tests/unit/observability/plugin_component_tests.rs: 1

5713-5713: LGTM!

Also applies to: 5734-5741, 5743-5807, 5809-5882, 5884-5905

crates/core/tests/integration/atif_storage_tests.rs: 1

421-424: LGTM!

Also applies to: 426-426, 434-434, 438-439, 499-503

docs/about-nemo-relay/concepts/subscribers.mdx: 1

83-87: LGTM!

docs/configure-plugins/observability/atif.mdx: 1

48-49: LGTM!

Also applies to: 74-75, 77-107, 394-397

Walkthrough

The ATIF plugin adds options to include or omit observed events and LLM requests. It applies those options to normal and shutdown exports, uses compact JSON for remote storage, and exposes the settings in Rust, Node.js, Go, and Python configuration.

Changes

ATIF export retention

Layer / File(s) Summary
Retention configuration
crates/core/src/observability/plugin_component.rs, crates/node/observability.d.ts, crates/node/observability.js, go/nemo_relay/observability_plugin.go, python/nemo_relay/observability.py, python/nemo_relay/observability.pyi, crates/node/tests/observability_plugin_tests.mjs, go/nemo_relay/observability_plugin_test.go, python/tests/test_observability_plugin.py
Rust, Node.js, Go, and Python configuration surfaces add options for observed-event and LLM-request retention. Both default to enabled.
Export retention and serialization
crates/core/src/observability/plugin_component.rs
Normal and shutdown exports carry the configured options into payload preparation. The exporter conditionally omits observed events and recursively removes llm_request fields, including in nested trajectories. Remote-storage payloads use compact JSON; other payloads remain pretty-printed.
Retention validation and documentation
crates/core/tests/unit/observability/plugin_component_tests.rs, crates/core/tests/integration/atif_storage_tests.rs, docs/about-nemo-relay/concepts/subscribers.mdx, docs/configure-plugins/observability/atif.mdx
Tests check retention settings, nested trajectories, serialization, and HTTP upload bodies. Documentation describes the options and their effects on plugin-managed exports.

Priority: Normal

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

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant AtifSectionConfig
  participant ManagedAtifExporter
  participant prepare_atif_payload
  participant RemoteStorage
  AtifSectionConfig->>ManagedAtifExporter: retention options
  ManagedAtifExporter->>prepare_atif_payload: trajectory and output options
  prepare_atif_payload->>RemoteStorage: compact JSON payload
Loading

Possibly related PRs

  • NVIDIA/NeMo-Relay#1486: Changes ATIF user-step projection while retaining full requests in extra.llm_request, which this PR can omit.
  • NVIDIA/NeMo-Relay#1483: Changes ATIF user-message projection while retaining full requests in extra.llm_request, which this PR can omit.
Merge Risk: Minimal · up to 96078

The retention options and export behavior have no identified issue blocking merge after normal checks.

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

Failed Failed checks: 1 error · 1 warning

Check name Status Explanation Resolution
Title check Error The title clearly describes the change and meets the length, casing, imperative-summary, and punctuation rules, but enhancement is not an allowed Conventional Commits type. Replace enhancement with an allowed type, such as feat: reduce ATIF output size. The title must remain under 72 characters and must not end with a period.
Docstring Coverage Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 11 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Linked Issues check Passed Issue #1414 requires smaller ATIF payloads and optional remote observed_events. The PR adds include_observed_events and include_llm_requests, with defaults set to true, and applies them during…
Out of Scope Changes check Passed The changes stay within issue #1414. Configuration mirrors, schema validation, documentation, storage tests, lifecycle tests, and size-growth tests directly support the retention and payload-size obje…
Description check Passed The description follows the template. It has an Overview with both checklist items marked, a Details section listing the config, skip, strip, compact JSON, and test changes, and a Where should the rev…
Full details: Linked Issues check

Explanation

Issue #1414 requires smaller ATIF payloads and optional remote observed_events. The PR adds include_observed_events and include_llm_requests, with defaults set to true, and applies them during normal and shutdown exports. prepare_atif_payload omits extra.observed_events when configured and recursively removes llm_request from nested trajectories. Remote storage uses compact JSON, while local output remains pretty-printed. Rust tests cover retention, nested trajectories, teardown, compact uploads, and quadratic history growth. Python, Node.js, and Go configuration mirrors are included.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #1414. Configuration mirrors, schema validation, documentation, storage tests, lifecycle tests, and size-growth tests directly support the retention and payload-size objectives. No unrelated product behavior is evident. Standalone AtifExporter behavior remains unchanged.

Full details: Description check

Explanation

The description follows the template. It has an Overview with both checklist items marked, a Details section listing the config, skip, strip, compact JSON, and test changes, and a Where should the reviewer start section that names specific files. The Related Issues section uses Closes with #1414 and RELAY-1106. The Validation list is extra but supports the change. The description is specific and matches the raw summary and the objectives.

Full details: Docstring Coverage

Explanation

Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 11 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

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.

@willkill07 willkill07 self-assigned this Oct 26, 2026
@willkill07 willkill07 added this to the 0.11 milestone Oct 26, 2026
@github-actions

Copy link
Copy Markdown

@willkill07
willkill07 merged commit 25b4077 into NVIDIA:main Oct 26, 2026
96 of 98 checks passed
@willkill07
willkill07 deleted the enh/reduce-atif-output-size branch October 30, 2026 14:46

This branch was previously deployed

1 inactive deployment
fern — 96078b19 Deployed Oct 26, 2026 by willkill07 via Clean up docs preview #6587
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Improvement improvement to existing functionality lang:go PR changes/introduces Go code lang:js PR changes/introduces Javascript/Typescript code lang:python PR changes/introduces Python code 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.

[Enhancement]: ATIF trajectories grow quadratically with the number of model calls

2 participants