Skip to content

feat(codex): support Codex >=0.142 lifecycle metadata#397

Open
willkill07 wants to merge 2 commits into
NVIDIA:mainfrom
willkill07:feat/codex-0142-support
Open

feat(codex): support Codex >=0.142 lifecycle metadata#397
willkill07 wants to merge 2 commits into
NVIDIA:mainfrom
willkill07:feat/codex-0142-support

Conversation

@willkill07

@willkill07 willkill07 commented Jul 9, 2026

Copy link
Copy Markdown
Member

Overview

Update the supported Codex CLI floor to 0.142 and align Relay's gateway correlation with Codex's shared session and thread-spawn metadata while retaining compatibility fallbacks for older clients.

  • 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

  • Prefer Codex Responses client_metadata.session_id so root and subagent provider traffic joins the same hook session.
  • Use client_metadata.thread_id for collab_spawn subagent ownership while excluding internal review, compaction, and memory calls.
  • Preserve explicit Relay header precedence, the legacy prompt_cache_key fallback, and existing payload aliases for older Codex versions.
  • Add Codex 0.142 fixtures for subagent lifecycle events, tool payloads, compact session starts, and gateway correlation.
  • Update the CLI help and Codex documentation to require 0.142 and list the ten native hook events accurately.

Validation:

  • just test-rust
  • cargo fmt --all
  • cargo clippy --workspace --all-targets -- -D warnings
  • just docs
  • uv run pre-commit run --all-files

This change does not remove the legacy compatibility path and does not introduce a hard runtime version rejection.

Where should the reviewer start?

Start with crates/cli/src/alignment/codex.rs, especially the session and subagent identifier extraction, then review the 0.142 gateway fixtures in crates/cli/tests/coverage/gateway_tests.rs.

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

  • Relates to: none

Summary by CodeRabbit

  • New Features
    • Enhanced Codex/OpenAI Responses correlation to better separate shared session identifiers from thread-spawned subagent identifiers.
  • Bug Fixes
    • Improved gateway identifier derivation and fallback behavior when explicit subagent headers are missing.
  • Documentation
    • Updated Codex compatibility requirements to codex-cli >= 0.142.0 and refreshed documented hook/event sets for the new lifecycle.
  • Tests
    • Added/updated coverage for Codex event normalization and the revised session/subagent extraction behavior.

Signed-off-by: Will Killian <wkillian@nvidia.com>
@willkill07 willkill07 requested review from a team and lvojtku as code owners July 9, 2026 13:23
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Codex session and subagent identification now use Responses client metadata for Codex 0.142 correlation, with legacy prompt-cache fallback. Alignment and gateway wiring, adapter tests, CLI comments, and documentation are updated accordingly.

Changes

Codex Session/Subagent Correlation

Layer / File(s) Summary
Codex extraction helpers
crates/cli/src/alignment/codex.rs
Adds root-session and spawned-subagent extraction from Codex client metadata, with route and metadata guards plus legacy prompt_cache_key fallback.
Alignment and gateway wiring
crates/cli/src/alignment/mod.rs, crates/cli/src/gateway.rs
Routes session and subagent resolution through the new helpers while preserving explicit NeMo Relay header precedence.
Correlation and adapter validation
crates/cli/tests/coverage/alignment_codex_tests.rs, crates/cli/tests/coverage/alignment_tests.rs, crates/cli/tests/coverage/gateway_tests.rs, crates/cli/tests/coverage/adapters_tests.rs
Tests shared session mapping, legacy fallback, route restrictions, subagent extraction, gateway identifiers, and Codex 0.142 event adaptation.
Codex 0.142 compatibility documentation
crates/cli/src/config.rs, crates/cli/src/installer.rs, crates/cli/src/launcher.rs, crates/cli/src/model.rs, docs/nemo-relay-cli/*, integrations/coding-agents/codex/README.md
Updates version requirements, hook mappings, captured-event descriptions, and compatibility comments for Codex 0.142.

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

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Gateway as build_llm_gateway_start
  participant Alignment as alignment::gateway_subagent_id
  participant Codex as codex::responses_session_id/responses_subagent_id

  Client->>Gateway: OpenAI Responses request
  Gateway->>Codex: Resolve session_id from client_metadata
  Codex-->>Gateway: session_id or prompt_cache_key fallback
  Gateway->>Alignment: Resolve subagent_id(headers, body, route)
  Alignment->>Codex: Resolve thread_id for collab_spawn
  Codex-->>Alignment: subagent_id
  Alignment-->>Gateway: Header or metadata-derived subagent_id
  Gateway-->>Client: Gateway start identifiers
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 72.73% 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
Title check ✅ Passed The title follows Conventional Commits and accurately summarizes the Codex 0.142 lifecycle metadata update.
Description check ✅ Passed The description includes the required Overview, Details, reviewer start, validation, and related issues sections, with only minor template deviations.
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.

@github-actions github-actions Bot added size:M PR is medium Feature a new feature lang:rust PR changes/introduces Rust code labels Jul 9, 2026

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

Actionable comments posted: 1

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

Inline comments:
In `@crates/cli/tests/coverage/adapters_tests.rs`:
- Around line 233-248: Strengthen the compact SessionStart test in codex::adapt
so it verifies the full outcome, not just that outcome.events[0] is
NormalizedEvent::AgentStarted. Add assertions that outcome.events has the
expected length and that no session-closing or other spurious lifecycle event is
present for the source: "compact" case, using the existing
maps_codex_0142_compact_session_start_without_closing_the_session test to cover
the intended behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 97bd0de9-bb33-44b4-9c12-393e9341e2a6

📥 Commits

Reviewing files that changed from the base of the PR and between c83c8f2 and e7c66fd.

📒 Files selected for processing (14)
  • crates/cli/src/alignment/codex.rs
  • crates/cli/src/alignment/mod.rs
  • crates/cli/src/config.rs
  • crates/cli/src/gateway.rs
  • crates/cli/src/installer.rs
  • crates/cli/src/launcher.rs
  • crates/cli/src/model.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/tests/coverage/alignment_codex_tests.rs
  • crates/cli/tests/coverage/alignment_tests.rs
  • crates/cli/tests/coverage/gateway_tests.rs
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/codex.mdx
  • integrations/coding-agents/codex/README.md
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (21)
**/*.rs

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

**/*.rs: Any Rust change must run just test-rust
Any Rust change must run cargo fmt --all
Any Rust change must run cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all for all FFI work since it is Rust work
Run just test-rust to validate FFI changes
Run cargo clippy --workspace --all-targets -- -D warnings to enforce strict linting on FFI work

When Rust files changed as part of Go work, also run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all when Rust files are changed as part of Node work
Run cargo clippy --workspace --all-targets -- -D warnings when Rust files are changed as part of Node work
Run just test-rust when Rust files are changed as part of Node work

When changing the core Rust runtime or Rust-facing API surface, format Rust code with cargo fmt (rustfmt defaults), keep cargo clippy -- -D warnings clean, and satisfy cargo deny check per deny.toml.

**/*.rs: If any Rust code changed, always run just test-rust.
If any Rust code changed, also run cargo fmt --all.
If any Rust code changed, also run cargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, run cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings even if relying on pre-commit.

Files:

  • crates/cli/src/installer.rs
  • crates/cli/src/config.rs
  • crates/cli/src/launcher.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/tests/coverage/alignment_codex_tests.rs
  • crates/cli/src/model.rs
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/cli/src/alignment/mod.rs
  • crates/cli/src/alignment/codex.rs
  • crates/cli/src/gateway.rs
  • crates/cli/tests/coverage/alignment_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions in Rust and Python: use snake_case.

Files:

  • crates/cli/src/installer.rs
  • crates/cli/src/config.rs
  • crates/cli/src/launcher.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/tests/coverage/alignment_codex_tests.rs
  • crates/cli/src/model.rs
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/cli/src/alignment/mod.rs
  • crates/cli/src/alignment/codex.rs
  • crates/cli/src/gateway.rs
  • crates/cli/tests/coverage/alignment_tests.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{rs,py,js,mjs,cjs,ts,tsx}: Use Json = serde_json::Value in Rust-facing runtime APIs where the existing code expects JSON payloads.
Use Result<T> with FlowError in core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.

Files:

  • crates/cli/src/installer.rs
  • crates/cli/src/config.rs
  • crates/cli/src/launcher.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/tests/coverage/alignment_codex_tests.rs
  • crates/cli/src/model.rs
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/cli/src/alignment/mod.rs
  • crates/cli/src/alignment/codex.rs
  • crates/cli/src/gateway.rs
  • crates/cli/tests/coverage/alignment_tests.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use language-appropriate naming conventions: Rust snake_case, C FFI exports prefixed nemo_relay_, Go PascalCase, Node.js camelCase, and Python snake_case.

Files:

  • crates/cli/src/installer.rs
  • crates/cli/src/config.rs
  • crates/cli/src/launcher.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/tests/coverage/alignment_codex_tests.rs
  • crates/cli/src/model.rs
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/cli/src/alignment/mod.rs
  • crates/cli/src/alignment/codex.rs
  • crates/cli/src/gateway.rs
  • crates/cli/tests/coverage/alignment_tests.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding // comment form.

Files:

  • crates/cli/src/installer.rs
  • crates/cli/src/config.rs
  • crates/cli/src/launcher.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/tests/coverage/alignment_codex_tests.rs
  • crates/cli/src/model.rs
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/cli/src/alignment/mod.rs
  • crates/cli/src/alignment/codex.rs
  • crates/cli/src/gateway.rs
  • crates/cli/tests/coverage/alignment_tests.rs
{crates/**/src/**/*.rs,python/**/*.py}

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

Do not add tests under src; Rust tests belong in crate tests/ trees, and Python SDK tests belong under python/tests.

Files:

  • crates/cli/src/installer.rs
  • crates/cli/src/config.rs
  • crates/cli/src/launcher.rs
  • crates/cli/src/model.rs
  • crates/cli/src/alignment/mod.rs
  • crates/cli/src/alignment/codex.rs
  • crates/cli/src/gateway.rs
**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, use maintain-dynamic-plugins and include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, prefer uv run pre-commit run --files <changed files...>.
Before review or handoff, run uv run pre-commit run --all-files.

Files:

  • crates/cli/src/installer.rs
  • docs/nemo-relay-cli/basic-usage.mdx
  • crates/cli/src/config.rs
  • crates/cli/src/launcher.rs
  • integrations/coding-agents/codex/README.md
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/tests/coverage/alignment_codex_tests.rs
  • crates/cli/src/model.rs
  • docs/nemo-relay-cli/codex.mdx
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/cli/src/alignment/mod.rs
  • crates/cli/src/alignment/codex.rs
  • crates/cli/src/gateway.rs
  • crates/cli/tests/coverage/alignment_tests.rs
**/*.{rs,py,go,js,ts}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If a language surface changed, always run that language's test target even when Rust core did not change.

Files:

  • crates/cli/src/installer.rs
  • crates/cli/src/config.rs
  • crates/cli/src/launcher.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/tests/coverage/alignment_codex_tests.rs
  • crates/cli/src/model.rs
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/cli/src/alignment/mod.rs
  • crates/cli/src/alignment/codex.rs
  • crates/cli/src/gateway.rs
  • crates/cli/tests/coverage/alignment_tests.rs
**

⚙️ CodeRabbit configuration file

**:

AGENTS.md

This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.

Project Overview

NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.

The shared runtime model is:

  1. Scope stacks decide where work belongs and which scope-local behavior is visible.
  2. Middleware registries decide what guardrails and intercepts run around managed calls.
  3. Plugins install reusable runtime behavior from configuration.
  4. Events record runtime behavior in ATOF form.
  5. Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.

Repository Structure

The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.

crates/
  core/       # Rust core runtime crate, published as nemo-relay
  adaptive/   # Adaptive runtime primitives and plugin components
  python/     # PyO3 native extension for the Python package
  ffi/        # Raw C ABI layer used by downstream bindings such as Go
  node/       # NAPI Node.js binding and JavaScript/TypeScript entry points
python/
  nemo_relay/  # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers
  tests/      # Python tests
go/
  nemo_relay/  # Experimental Go CGo binding and tests
fern/         # Fern documentation site
scripts/      # Stable wrappers and helper scripts; build/test/docs entry points live in justfile
skills/       # Published Codex/agent skills for NeMo Relay usage patterns

Prerequisites

Insta...

Files:

  • crates/cli/src/installer.rs
  • docs/nemo-relay-cli/basic-usage.mdx
  • crates/cli/src/config.rs
  • crates/cli/src/launcher.rs
  • integrations/coding-agents/codex/README.md
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/tests/coverage/alignment_codex_tests.rs
  • crates/cli/src/model.rs
  • docs/nemo-relay-cli/codex.mdx
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/cli/src/alignment/mod.rs
  • crates/cli/src/alignment/codex.rs
  • crates/cli/src/gateway.rs
  • crates/cli/tests/coverage/alignment_tests.rs
**/*.mdx

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

MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)

In MDX files, top-of-file comments must use JSX comment delimiters ({/* to open and */} to close); do not use HTML comments for MDX SPDX headers

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/codex.mdx
**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

Update README.md, fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.

**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such as RELEASING.md, not as user-facing docs pages or CHANGELOG.md
Keep stable user-facing wrappers at scripts/ root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, and grpc-v1 protocol details on separate pages

If links in documentation change, run just docs-linkcheck.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • integrations/coding-agents/codex/README.md
  • docs/nemo-relay-cli/codex.mdx
**/*.{md,markdown,mdx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • integrations/coding-agents/codex/README.md
  • docs/nemo-relay-cli/codex.mdx
{docs,examples}/**/*

📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)

Update docs and examples.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/codex.mdx
docs/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If documentation examples or commands under docs/ change, run the targeted docs checks appropriate to the change.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/codex.mdx
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}

⚙️ CodeRabbit configuration file

{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/codex.mdx
**/*.{md,rst,html,txt}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)

**/*.{md,rst,html,txt}: Always spell NVIDIA in all caps. Do not use Nvidia, nvidia, nVidia, nVIDIA, or NV.
Use an NVIDIA before a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol after NVIDIA when referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names with NVIDIA on first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms with s, not an apostrophe, such as GPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such as CPU, GPU, PC, API, and UI usually do not need to be spelled out for developer audiences.

Files:

  • integrations/coding-agents/codex/README.md
**/*.{md,rst,html}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)

Link the first mention of a product name when the destination helps the reader.

Files:

  • integrations/coding-agents/codex/README.md
**/*.{md,rst,txt}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

Spell NVIDIA in all caps. Do not use Nvidia, nvidia, or NV.

Files:

  • integrations/coding-agents/codex/README.md
**/*.{md,rst}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

**/*.{md,rst}: Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as "here" or "read more."
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Use can for possibility and reserve may for permission.
Use after for temporal relationships instead of once.
Prefer refer to over see when the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical docs.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented docs unless the source, platform, or legal guidance explicitly requires them.

Files:

  • integrations/coding-agents/codex/README.md
**/*.md

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)

**/*.md: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Format code elements, commands, parameters, package names, and expressions in monospace
Format directories, file names, and paths in monospace using backticks
Use angle brackets inside monospace for variables inside paths, such as /home/<username>/.login
Format error messages and strings in quotation marks, keeping literal code strings in code formatting when clearer
Format UI buttons, menus, fields, and labels in bold
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use, sparingly and only when introducing the term
Use italics for publication titles
Format keyboard shortcuts in plain text, such as Press Ctrl+Alt+Delete
Use owner/repo link text for GitHub repositories, preferring [NVIDIA/NeMo](link) over prose references like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text
Avoid generic anchor text such as 'here,' 'this page,' and 'read more'
Include acronyms in link text when a linked term includes an acronym
Do not link long sentences or multiple sentences
Avoid links that pull readers away from a procedure unless the link is a p...

Files:

  • integrations/coding-agents/codex/README.md
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/tests/coverage/alignment_codex_tests.rs
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/cli/tests/coverage/alignment_tests.rs
🔇 Additional comments (15)
crates/cli/tests/coverage/alignment_codex_tests.rs (1)

32-67: LGTM!

crates/cli/tests/coverage/alignment_tests.rs (1)

165-212: LGTM!

Also applies to: 254-298, 300-339

crates/cli/tests/coverage/gateway_tests.rs (1)

283-363: LGTM!

Also applies to: 416-463, 465-492

crates/cli/tests/coverage/adapters_tests.rs (1)

148-231: LGTM!

crates/cli/src/alignment/codex.rs (2)

64-80: LGTM!


43-62: 🎯 Functional Correctness

Drop this concern: legacy Codex payloads include the installation ID. The prompt_cache_key fallback is still reachable for supported legacy Responses payloads because they carry client_metadata.x-codex-installation-id alongside prompt_cache_key.

			> Likely an incorrect or invalid review comment.
crates/cli/src/alignment/mod.rs (1)

135-135: LGTM!

Also applies to: 554-564

crates/cli/src/gateway.rs (1)

130-141: LGTM!

Also applies to: 1080-1081

crates/cli/src/config.rs (1)

54-54: LGTM!

crates/cli/src/installer.rs (1)

15-17: LGTM!

crates/cli/src/launcher.rs (1)

408-409: LGTM!

crates/cli/src/model.rs (1)

33-34: LGTM!

docs/nemo-relay-cli/basic-usage.mdx (1)

310-310: LGTM!

docs/nemo-relay-cli/codex.mdx (1)

17-23: LGTM!

Also applies to: 182-191

integrations/coding-agents/codex/README.md (1)

16-18: LGTM!

Also applies to: 31-41

Comment thread crates/cli/tests/coverage/adapters_tests.rs
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

@willkill07 willkill07 added this to the 0.6 milestone Jul 9, 2026
@willkill07 willkill07 self-assigned this Jul 9, 2026
@willkill07 willkill07 changed the title feat: support Codex 0.142 lifecycle metadata feat(codex): support Codex >=0.142 lifecycle metadata Jul 9, 2026

@zhongxuanwang-nv zhongxuanwang-nv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Used powerful AIs to help review this, I don't think there's anything more needs to be addressed!

Signed-off-by: Will Killian <2007799+willkill07@users.noreply.github.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)
crates/cli/tests/coverage/adapters_tests.rs (1)

265-348: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert agent_type on the tool and stop cases too. The test currently only checks metadata["agent_type"] on SubagentStarted; add the same assertion for ToolStarted, ToolEnded, and SubagentEnded, or narrow the coverage claim to the start event only.

🤖 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/cli/tests/coverage/adapters_tests.rs` around lines 265 - 348, Extend
maps_codex_0142_subagent_and_tool_payloads to assert metadata["agent_type"]
equals "worker" in the ToolStarted, ToolEnded, and SubagentEnded match arms,
matching the existing SubagentStarted assertion.

Source: Path instructions

🤖 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 `@crates/cli/tests/coverage/adapters_tests.rs`:
- Around line 265-348: Extend maps_codex_0142_subagent_and_tool_payloads to
assert metadata["agent_type"] equals "worker" in the ToolStarted, ToolEnded, and
SubagentEnded match arms, matching the existing SubagentStarted assertion.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 3c8d0c68-e682-483b-88d5-bd86ebebe4e9

📥 Commits

Reviewing files that changed from the base of the PR and between e7c66fd and a67e723.

📒 Files selected for processing (3)
  • crates/cli/src/gateway.rs
  • crates/cli/src/installer.rs
  • crates/cli/tests/coverage/adapters_tests.rs
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: Check / Run
  • GitHub Check: CodeRabbit
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (10)
**/*.rs

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

**/*.rs: Any Rust change must run just test-rust
Any Rust change must run cargo fmt --all
Any Rust change must run cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all for all FFI work since it is Rust work
Run just test-rust to validate FFI changes
Run cargo clippy --workspace --all-targets -- -D warnings to enforce strict linting on FFI work

When Rust files changed as part of Go work, also run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all when Rust files are changed as part of Node work
Run cargo clippy --workspace --all-targets -- -D warnings when Rust files are changed as part of Node work
Run just test-rust when Rust files are changed as part of Node work

When changing the core Rust runtime or Rust-facing API surface, format Rust code with cargo fmt (rustfmt defaults), keep cargo clippy -- -D warnings clean, and satisfy cargo deny check per deny.toml.

**/*.rs: If any Rust code changed, always run just test-rust.
If any Rust code changed, also run cargo fmt --all.
If any Rust code changed, also run cargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, run cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings even if relying on pre-commit.

Files:

  • crates/cli/src/installer.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/src/gateway.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions in Rust and Python: use snake_case.

Files:

  • crates/cli/src/installer.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/src/gateway.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{rs,py,js,mjs,cjs,ts,tsx}: Use Json = serde_json::Value in Rust-facing runtime APIs where the existing code expects JSON payloads.
Use Result<T> with FlowError in core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.

Files:

  • crates/cli/src/installer.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/src/gateway.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use language-appropriate naming conventions: Rust snake_case, C FFI exports prefixed nemo_relay_, Go PascalCase, Node.js camelCase, and Python snake_case.

Files:

  • crates/cli/src/installer.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/src/gateway.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding // comment form.

Files:

  • crates/cli/src/installer.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/src/gateway.rs
{crates/**/src/**/*.rs,python/**/*.py}

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

Do not add tests under src; Rust tests belong in crate tests/ trees, and Python SDK tests belong under python/tests.

Files:

  • crates/cli/src/installer.rs
  • crates/cli/src/gateway.rs
**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, use maintain-dynamic-plugins and include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, prefer uv run pre-commit run --files <changed files...>.
Before review or handoff, run uv run pre-commit run --all-files.

Files:

  • crates/cli/src/installer.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/src/gateway.rs
**/*.{rs,py,go,js,ts}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If a language surface changed, always run that language's test target even when Rust core did not change.

Files:

  • crates/cli/src/installer.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/src/gateway.rs
**

⚙️ CodeRabbit configuration file

**:

AGENTS.md

This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.

Project Overview

NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.

The shared runtime model is:

  1. Scope stacks decide where work belongs and which scope-local behavior is visible.
  2. Middleware registries decide what guardrails and intercepts run around managed calls.
  3. Plugins install reusable runtime behavior from configuration.
  4. Events record runtime behavior in ATOF form.
  5. Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.

Repository Structure

The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.

crates/
  core/       # Rust core runtime crate, published as nemo-relay
  adaptive/   # Adaptive runtime primitives and plugin components
  python/     # PyO3 native extension for the Python package
  ffi/        # Raw C ABI layer used by downstream bindings such as Go
  node/       # NAPI Node.js binding and JavaScript/TypeScript entry points
python/
  nemo_relay/  # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers
  tests/      # Python tests
go/
  nemo_relay/  # Experimental Go CGo binding and tests
fern/         # Fern documentation site
scripts/      # Stable wrappers and helper scripts; build/test/docs entry points live in justfile
skills/       # Published Codex/agent skills for NeMo Relay usage patterns

Prerequisites

Insta...

Files:

  • crates/cli/src/installer.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/src/gateway.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
🔇 Additional comments (6)
crates/cli/src/installer.rs (2)

13-20: 📐 Maintainability & Code Quality

Run the required Rust validation before handoff.

As per coding guidelines, run just test-rust, cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, and uv run pre-commit run --all-files.

Source: Coding guidelines


13-24: 🎯 Functional Correctness

Keep the shared Codex/Claude hook list

Codex uses the same hook-event set here, and UserPromptExpansion is already covered by the Codex install path and adapter tests, so a separate Codex-only list isn’t needed.

			> Likely an incorrect or invalid review comment.
crates/cli/tests/coverage/adapters_tests.rs (2)

350-365: 🎯 Functional Correctness

Shallow assertion for compact session-start test — already flagged in prior review.

Only events[0] is checked; no assertion on events.len() or absence of a spurious session-closing event for the source: "compact" case.

Source: Path instructions


51-167: LGTM!

crates/cli/src/gateway.rs (2)

20-23: LGTM!

Also applies to: 251-262, 951-959


1078-1083: 🎯 Functional Correctness

No issue: build_llm_gateway_start already threads the parsed body and active route into subagent resolution. subagent_id is built from gateway_subagent_id(&request.headers, &request.request_json, request.provider), so there’s no stale/default-route path here.

			> Likely an incorrect or invalid review comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature a new feature 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