Skip to content

fix: tighten OpenClaw ATOF hook-backed provenance metadata#209

Merged
rapids-bot[bot] merged 4 commits into
NVIDIA:mainfrom
mnajafian-nv:fix/openclaw-atof-provenance-fidelity
Jun 4, 2026
Merged

fix: tighten OpenClaw ATOF hook-backed provenance metadata#209
rapids-bot[bot] merged 4 commits into
NVIDIA:mainfrom
mnajafian-nv:fix/openclaw-atof-provenance-fidelity

Conversation

@mnajafian-nv
Copy link
Copy Markdown
Contributor

@mnajafian-nv mnajafian-nv commented Jun 3, 2026

Overview

This PR tightens provenance metadata for OpenClaw hook-backed ATOF events and adds focused test coverage so hook-backed events emit the stable metadata they actually have, without claiming provider-fidelity fields that the current hook-backed path does not expose.

  • 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

  • Adds hook-backed provenance metadata for OpenClaw session lifecycle and mark events where stable metadata is available.
  • Preserves stable session identifiers and backfills missing session context on overlap-sensitive replay paths so LLM and tool replay metadata stays correlated when later hooks provide additional session information.
  • Adds focused assertions for session, lifecycle, LLM replay, and tool replay metadata.
  • Adds explicit absence assertions so hook-backed paths do not claim unsupported provider-fidelity fields such as agent_kind, provider_payload_exact, or fidelity_source.
  • Keeps the change scoped to the OpenClaw integration layer without changing generic ATOF exporter behavior or widening provider-event exposure work.
  • Regenerates repo-maintained package-lock.json, ATTRIBUTIONS-Node.md, and ATTRIBUTIONS-Rust.md so the full pre-commit suite remains green.

Where should the reviewer start?

Start with integrations/openclaw/src/hooks-backend.ts, then review the metadata plumbing in integrations/openclaw/src/hook-replay/session.ts, integrations/openclaw/src/hook-replay/llm.ts, and integrations/openclaw/src/hook-replay/tool.ts, followed by the targeted OpenClaw tests.

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

  • Relates to OpenClaw observability consistency work.

Validation

  • npm test --workspace=nemo-relay-openclaw
  • npm run typecheck --workspace=nemo-relay-openclaw
  • cargo test -p nemo-relay atof
  • cargo test -p nemo-relay
  • uv run pre-commit run --all-files

Summary by CodeRabbit

  • Improvements

    • Enhanced OpenClaw hook metadata with enriched session identifiers, agent IDs, and run information for improved event correlation and tracking.
    • Improved session lifecycle management with automatic enrichment of missing session attributes during replay.
    • Extended hook event metadata to include source, tool call IDs, and structured context across LLM calls, tool calls, and session lifecycle events.
  • Chores

    • Updated third-party license attributions and removed entries for deprecated dependencies.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
@mnajafian-nv mnajafian-nv requested review from a team as code owners June 3, 2026 21:03
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

Walkthrough

This PR adds structured metadata to OpenClaw hook-replay events, enriches session state with stable identifiers used in emitted spans/marks, updates emission points to forward metadata, extends test mocks to capture metadata, and removes several Node attributions while consolidating Rust license entries.

Changes

License Attribution Cleanup

Layer / File(s) Summary
Node package attribution removals
ATTRIBUTIONS-Node.md
Removes attribution blocks for @lydell/node-pty-*, @mariozechner/clipboard*, @napi-rs/canvas*, and sqlite-vec*.
Rust dependency license consolidation
ATTRIBUTIONS-Rust.md
Switches several RustCrypto entries to Apache-2.0 (removing MIT OR Apache-2.0), removes inlined MIT text blocks in multiple entries, and replaces generic-array MIT section with an expanded inlined MIT license text block.

OpenClaw Hook-Replay Metadata Enrichment

Layer / File(s) Summary
Session identifier enrichment
integrations/openclaw/src/hook-replay/session.ts
Adds toJsonRecord import and enrichSession helper; ensureSession fills missing sessionKey, agentId, and resumedFrom on existing/aliased sessions.
Session start/end event metadata
integrations/openclaw/src/hook-replay/session.ts
Extends closeSessionRoot to accept metadata, constructs structured metadata for openclaw.session_start and wires it into scope push and event emission.
Mark emission and session end metadata
integrations/openclaw/src/hook-replay/marks.ts, integrations/openclaw/src/hooks-backend.ts
Updates emitMark to forward optional metadata; hooks-backend now forwards explicit metadata when closing sessions and emits session-level marks with computed metadata (normalized source, session/run ids).
LLM and tool call metadata
integrations/openclaw/src/hook-replay/llm.ts, integrations/openclaw/src/hook-replay/tool.ts
LLM/tool metadata now source sessionId/sessionKey/agentId from the resolved session; existingSessionForMessageWrite can retroactively set sessionKey; tool_blocked marks include structured identity metadata.
Test runtime infrastructure
integrations/openclaw/test/hooks-backend.test.ts, integrations/openclaw/test/llm-replay.test.ts, integrations/openclaw/test/tool-replay.test.ts
Extends TestNemoRelayRuntime types and mock implementations to accept and record metadata on pushScope, event, llmCall, llmCallEnd, toolCall, and toolCallEnd; adds helpers to assert disallowed metadata keys are absent.
Metadata validation test assertions
integrations/openclaw/test/hooks-backend.test.ts, integrations/openclaw/test/llm-replay.test.ts, integrations/openclaw/test/tool-replay.test.ts
Asserts metadata presence and contents across lifecycle scenarios and replay flows (session start/lazy start/end, tool blocked/after_tool_call, agent lifecycle, subagent spawn/end), and verifies absence of overclaimed fields in emitted metadata.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 52.94% 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 Title follows Conventional Commits format with 'fix' type, scope '(OpenClaw ATOF hook-backed provenance metadata)', and concise imperative summary under 72 characters.
Description check ✅ Passed Description includes all required template sections: Overview with confirmation checklist, Details explaining changes, Where should reviewer start guidance, Related Issues reference, and comprehensive Validation section.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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:XL PR is extra large Bug issue describes bug; PR fixes bug labels Jun 3, 2026
@mnajafian-nv mnajafian-nv self-assigned this Jun 3, 2026
@github-actions github-actions Bot added the lang:js PR changes/introduces Javascript/Typescript code label Jun 3, 2026
@mnajafian-nv mnajafian-nv added this to the 0.4 milestone Jun 3, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 `@ATTRIBUTIONS-Rust.md`:
- Around line 3126-3127: The generated ATTRIBUTIONS-Rust.md is missing blank
lines before the "### License:" headings (MD022); update the generator in
scripts/licensing/attributions_lockfile_md.py to always emit a separating blank
line before the license heading. Locate the markdown-emission function (e.g.,
generate_markdown / emit_entry / format_license_section or the function that
builds the package block / write_entry) and ensure it inserts a "\n" (or an
empty line) before emitting "### License: ..." for each package entry,
preserving the existing license-selection logic that prefers Apache-2.0 where
you consolidate dual-license crates.
🪄 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: e8ea1d7c-9590-41ee-9677-0710a6555bce

📥 Commits

Reviewing files that changed from the base of the PR and between d1001be and 8824a00.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (10)
  • ATTRIBUTIONS-Node.md
  • ATTRIBUTIONS-Rust.md
  • integrations/openclaw/src/hook-replay/llm.ts
  • integrations/openclaw/src/hook-replay/marks.ts
  • integrations/openclaw/src/hook-replay/session.ts
  • integrations/openclaw/src/hook-replay/tool.ts
  • integrations/openclaw/src/hooks-backend.ts
  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/test/llm-replay.test.ts
  • integrations/openclaw/test/tool-replay.test.ts
💤 Files with no reviewable changes (1)
  • ATTRIBUTIONS-Node.md
📜 Review details
🧰 Additional context used
📓 Path-based instructions (16)
**/*.{wasm,js,ts}{,x}

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

Ensure WebAssembly package naming conventions are consistent with generated package expectations and downstream consumption

Files:

  • integrations/openclaw/src/hook-replay/tool.ts
  • integrations/openclaw/src/hook-replay/marks.ts
  • integrations/openclaw/src/hooks-backend.ts
  • integrations/openclaw/src/hook-replay/llm.ts
  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/src/hook-replay/session.ts
  • integrations/openclaw/test/llm-replay.test.ts
  • integrations/openclaw/test/tool-replay.test.ts
**/*.{js,ts,jsx,tsx}

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

Run Node.js formatting with npm run format --workspace=nemo-relay-node

Include SPDX license header in all JavaScript and TypeScript source files using double-slash comment syntax

Files:

  • integrations/openclaw/src/hook-replay/tool.ts
  • integrations/openclaw/src/hook-replay/marks.ts
  • integrations/openclaw/src/hooks-backend.ts
  • integrations/openclaw/src/hook-replay/llm.ts
  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/src/hook-replay/session.ts
  • integrations/openclaw/test/llm-replay.test.ts
  • integrations/openclaw/test/tool-replay.test.ts
**/*.{rs,py,js,ts,tsx,jsx,go,sh,toml,yaml,yml,md}

📄 CodeRabbit inference engine (AGENTS.md)

Keep SPDX headers on source, docs, scripts, and configuration files. The project is Apache-2.0.

Files:

  • integrations/openclaw/src/hook-replay/tool.ts
  • integrations/openclaw/src/hook-replay/marks.ts
  • integrations/openclaw/src/hooks-backend.ts
  • integrations/openclaw/src/hook-replay/llm.ts
  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/src/hook-replay/session.ts
  • integrations/openclaw/test/llm-replay.test.ts
  • integrations/openclaw/test/tool-replay.test.ts
  • ATTRIBUTIONS-Rust.md
**/*.{rs,py,go,js,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions: Rust and Python use snake_case, C FFI exports prefixed nemo_relay_, Go uses PascalCase for public APIs, Node.js uses camelCase.

Files:

  • integrations/openclaw/src/hook-replay/tool.ts
  • integrations/openclaw/src/hook-replay/marks.ts
  • integrations/openclaw/src/hooks-backend.ts
  • integrations/openclaw/src/hook-replay/llm.ts
  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/src/hook-replay/session.ts
  • integrations/openclaw/test/llm-replay.test.ts
  • integrations/openclaw/test/tool-replay.test.ts
**/*{test,spec,smoke}.{js,ts,py}

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

Relevant integration tests or smoke path must pass

Files:

  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/test/llm-replay.test.ts
  • integrations/openclaw/test/tool-replay.test.ts
{crates/adaptive/**/*.rs,**/*test*.{rs,py,go,ts,js},**/*adaptive*test*.{rs,py,go,ts,js},docs/plugins/adaptive/**}

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

Maintain documented and tested validation and report behavior for adaptive surfaces

Files:

  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/test/llm-replay.test.ts
  • integrations/openclaw/test/tool-replay.test.ts
**/*.{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:

  • ATTRIBUTIONS-Rust.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:

  • ATTRIBUTIONS-Rust.md
**/*.md

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

Documentation must be updated if activation or usage changed

**/*.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 ...

Files:

  • ATTRIBUTIONS-Rust.md
**/{docs,examples,**/*.md,*.patch,*.diff,.github,*.sh,*.yaml,*.yml}

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

Update documentation, examples, CI configuration, and patch artifacts when performing rename operations

Files:

  • ATTRIBUTIONS-Rust.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:

  • ATTRIBUTIONS-Rust.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:

  • ATTRIBUTIONS-Rust.md
{docs/**,README.md,CONTRIBUTING.md,**/*.md}

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

Run docs link validation with just docs-linkcheck when links change

Files:

  • ATTRIBUTIONS-Rust.md
{docs/**,README.md,**/Cargo.toml,**/package.json,**/*.md}

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

Ensure renamed public surfaces are reflected consistently in manifests and docs for large or public-facing changes

Files:

  • ATTRIBUTIONS-Rust.md
**/*.{md,mdx,py,sh,yaml,yml,toml,json}

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

Keep package names, repo references, and build commands current

Files:

  • ATTRIBUTIONS-Rust.md
**/*.{html,md,mdx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Include SPDX license header in HTML and Markdown files using HTML comment syntax

Files:

  • ATTRIBUTIONS-Rust.md
🧠 Learnings (16)
📚 Learning: 2026-05-07T18:04:44.387Z
Learnt from: mnajafian-nv
Repo: NVIDIA/NeMo-Flow PR: 67
File: integrations/openclaw/src/modules.ts:1-2
Timestamp: 2026-05-07T18:04:44.387Z
Learning: In NVIDIA/NeMo-Flow, TypeScript source files should use `//` line comments for SPDX headers (e.g., `// SPDX-FileCopyrightText: ...` and `// SPDX-License-Identifier: ...`) rather than C-style block comments (`/* ... */`). The repo’s copyright checker enforces this mapping, so `//` SPDX headers in `.ts` files should not be flagged as a style violation.

Applied to files:

  • integrations/openclaw/src/hook-replay/tool.ts
  • integrations/openclaw/src/hook-replay/marks.ts
  • integrations/openclaw/src/hooks-backend.ts
  • integrations/openclaw/src/hook-replay/llm.ts
  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/src/hook-replay/session.ts
  • integrations/openclaw/test/llm-replay.test.ts
  • integrations/openclaw/test/tool-replay.test.ts
📚 Learning: 2026-05-21T22:52:14.330Z
Learnt from: CR
Repo: NVIDIA/NeMo-Relay PR: 0
File: .agents/skills/validate-change/SKILL.md:0-0
Timestamp: 2026-05-21T22:52:14.330Z
Learning: For Node.js binding changes, use `test-node-binding`

Applied to files:

  • integrations/openclaw/test/hooks-backend.test.ts
📚 Learning: 2026-05-29T21:25:49.977Z
Learnt from: CR
Repo: NVIDIA/NeMo-Relay PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-29T21:25:49.977Z
Learning: Applies to crates/node/**/*.{js,ts,tsx} : Node.js public entry points include the main runtime package plus `nemo-relay-node/typed`, `nemo-relay-node/plugin`, and `nemo-relay-node/adaptive`.

Applied to files:

  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/test/llm-replay.test.ts
📚 Learning: 2026-05-21T22:47:58.898Z
Learnt from: CR
Repo: NVIDIA/NeMo-Relay PR: 0
File: .agents/skills/add-middleware/SKILL.md:0-0
Timestamp: 2026-05-21T22:47:58.898Z
Learning: Applies to crates/core/src/api/runtime/state.rs : Add chain execution helpers to `NemoRelayContextState` following the pattern of existing methods like `tool_sanitize_request_chain` or `tool_request_intercepts_chain`

Applied to files:

  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/test/llm-replay.test.ts
📚 Learning: 2026-05-29T21:25:49.977Z
Learnt from: CR
Repo: NVIDIA/NeMo-Relay PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-29T21:25:49.977Z
Learning: Scope stacks are hierarchical and always have a root scope. They establish parent-child event relationships, visibility for scope-local middleware and subscribers, cleanup boundaries, and concurrent request isolation.

Applied to files:

  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/test/llm-replay.test.ts
📚 Learning: 2026-05-26T21:03:12.012Z
Learnt from: CR
Repo: NVIDIA/NeMo-Relay PR: 0
File: .agents/skills/review-doc-style/SKILL.md:0-0
Timestamp: 2026-05-26T21:03:12.012Z
Learning: Keep documentation aligned with current NeMo Relay behavior, repo layout, and entry points

Applied to files:

  • integrations/openclaw/test/llm-replay.test.ts
📚 Learning: 2026-05-29T21:25:49.977Z
Learnt from: CR
Repo: NVIDIA/NeMo-Relay PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-29T21:25:49.977Z
Learning: Events use ATOF `0.1` as the canonical event format. Scope events use start/end pairs; mark events record runtime checkpoints.

Applied to files:

  • integrations/openclaw/test/tool-replay.test.ts
📚 Learning: 2026-05-21T22:51:50.794Z
Learnt from: CR
Repo: NVIDIA/NeMo-Relay PR: 0
File: .agents/skills/update-project-version/SKILL.md:0-0
Timestamp: 2026-05-21T22:51:50.794Z
Learning: Regenerate `ATTRIBUTIONS-Rust.md` with `./scripts/generate_attributions.sh rust` after Cargo metadata changes

Applied to files:

  • ATTRIBUTIONS-Rust.md
📚 Learning: 2026-05-21T22:51:50.794Z
Learnt from: CR
Repo: NVIDIA/NeMo-Relay PR: 0
File: .agents/skills/update-project-version/SKILL.md:0-0
Timestamp: 2026-05-21T22:51:50.794Z
Learning: Do not forget to update `Cargo.lock`, `ATTRIBUTIONS-Rust.md`, and `ATTRIBUTIONS-Node.md` after changing versioned inputs that feed them

Applied to files:

  • ATTRIBUTIONS-Rust.md
📚 Learning: 2026-05-27T02:34:30.939Z
Learnt from: CR
Repo: NVIDIA/NeMo-Relay PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2026-05-27T02:34:30.939Z
Learning: Applies to **/README.md : Update relevant crate or package README when that surface changed

Applied to files:

  • ATTRIBUTIONS-Rust.md
📚 Learning: 2026-05-26T21:03:12.012Z
Learnt from: CR
Repo: NVIDIA/NeMo-Relay PR: 0
File: .agents/skills/review-doc-style/SKILL.md:0-0
Timestamp: 2026-05-26T21:03:12.012Z
Learning: Applies to **/README.md|docs/index.md|python/nemo_relay/README.md|crates/*/README.md : Public behavior changes must be reflected in corresponding entry-point documentation (Must-Fix)

Applied to files:

  • ATTRIBUTIONS-Rust.md
📚 Learning: 2026-05-27T02:34:30.939Z
Learnt from: CR
Repo: NVIDIA/NeMo-Relay PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2026-05-27T02:34:30.939Z
Learning: Applies to **/*.rs : Include SPDX license header in all Rust source files using double-slash comment syntax

Applied to files:

  • ATTRIBUTIONS-Rust.md
📚 Learning: 2026-05-21T22:52:14.330Z
Learnt from: CR
Repo: NVIDIA/NeMo-Relay PR: 0
File: .agents/skills/validate-change/SKILL.md:0-0
Timestamp: 2026-05-21T22:52:14.330Z
Learning: Applies to {docs/**,README.md,**/Cargo.toml,**/package.json,**/*.md} : Ensure renamed public surfaces are reflected consistently in manifests and docs for large or public-facing changes

Applied to files:

  • ATTRIBUTIONS-Rust.md
📚 Learning: 2026-05-21T22:49:46.956Z
Learnt from: CR
Repo: NVIDIA/NeMo-Relay PR: 0
File: .agents/skills/rename-surfaces/SKILL.md:0-0
Timestamp: 2026-05-21T22:49:46.956Z
Learning: Applies to **/*.{rs,toml} : Update Rust crate names and module prefixes during coordinated rename operations

Applied to files:

  • ATTRIBUTIONS-Rust.md
📚 Learning: 2026-05-21T22:50:51.194Z
Learnt from: CR
Repo: NVIDIA/NeMo-Relay PR: 0
File: .agents/skills/test-ffi-surface/SKILL.md:0-0
Timestamp: 2026-05-21T22:50:51.194Z
Learning: Applies to **/*.rs : Run `just test-rust` to validate FFI changes

Applied to files:

  • ATTRIBUTIONS-Rust.md
📚 Learning: 2026-05-21T22:47:33.109Z
Learnt from: CR
Repo: NVIDIA/NeMo-Relay PR: 0
File: .agents/skills/add-binding-feature/SKILL.md:0-0
Timestamp: 2026-05-21T22:47:33.109Z
Learning: Applies to crates/wasm/src/api/**/*.rs : Update WebAssembly binding in `crates/wasm/src/api/mod.rs` for language-native bindings

Applied to files:

  • ATTRIBUTIONS-Rust.md
🪛 markdownlint-cli2 (0.22.1)
ATTRIBUTIONS-Rust.md

[warning] 3127-3127: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above

(MD022, blanks-around-headings)


[warning] 3127-3127: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 7902-7902: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above

(MD022, blanks-around-headings)


[warning] 7902-7902: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 8559-8559: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above

(MD022, blanks-around-headings)


[warning] 8559-8559: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 20346-20346: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above

(MD022, blanks-around-headings)


[warning] 20346-20346: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 38802-38802: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above

(MD022, blanks-around-headings)


[warning] 38802-38802: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

🔇 Additional comments (18)
integrations/openclaw/src/hook-replay/llm.ts (2)

555-557: LGTM!


796-804: LGTM!

integrations/openclaw/src/hook-replay/tool.ts (2)

70-78: LGTM!


92-94: LGTM!

integrations/openclaw/src/hook-replay/session.ts (3)

253-264: LGTM!


333-353: LGTM!


275-293: ⚡ Quick win

Re-check positional-argument safety for closeSessionRoot

  • Within this repo, the only closeSessionRoot(...) call is in integrations/openclaw/src/hooks-backend.ts (~line 388), where the 5th positional argument passed is metadata (and timestamp is omitted), so the positional “old timestamp → new metadata” corruption can’t occur internally.
  • closeSessionRoot is still exported from integrations/openclaw/src/hook-replay/session.ts, so downstream (non-TS-checked) callers could still pass the old 5th positional argument; a consumer-side search/validation is needed.
integrations/openclaw/src/hook-replay/marks.ts (1)

17-33: LGTM!

integrations/openclaw/src/hooks-backend.ts (3)

122-132: LGTM!


386-391: LGTM!


402-409: LGTM!

integrations/openclaw/test/hooks-backend.test.ts (3)

34-53: LGTM!

Also applies to: 82-93, 164-169, 201-209, 265-272, 298-305, 333-341, 344-377


517-526: LGTM!


500-506: ⚡ Quick win

Check pushScope/event argument ordering for metadata in the real runtime API

The current stubs assume metadata is the last positional parameter for pushScope ((name, scopeType, _handle, _attributes, data, _links, metadata)) and the 4th argument for event ((name, handle, data, metadata)). The available repo/doc evidence didn’t surface the exact NemoRelayRuntimeModule.pushScope / event signatures or the OpenClaw hook/backend call sites needed to confirm these indices, so the assertions could still pass while capturing the wrong argument.

Update the test to derive/cross-check the parameter order directly from the actual exported types (and the concrete backend call signature), or adjust the stub to capture metadata in a way that can’t silently drift if the call-site order changes.

integrations/openclaw/test/llm-replay.test.ts (2)

1103-1115: ⚡ Quick win

Confirm llmCall/llmCallEnd/toolCall/toolCallEnd metadata positions match the real API.

Same positional-capture concern as the hooks-backend stubs: metadata is read as argument 6 of llmCall, argument 4 of llmCallEnd, and argument 6 of toolCall. If the real NemoRelayRuntimeModule signatures differ, the captured metadata is silently the wrong arg. Covered by the verification script on the hooks-backend file.


55-75: LGTM!

Also applies to: 530-552, 574-584, 1019-1048, 1144-1152

integrations/openclaw/test/tool-replay.test.ts (1)

46-77: LGTM!

Also applies to: 161-181, 199-206, 261-289

ATTRIBUTIONS-Rust.md (1)

13277-13297: LGTM!

Comment thread ATTRIBUTIONS-Rust.md Outdated
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
@mnajafian-nv
Copy link
Copy Markdown
Contributor Author

Pushed a follow-up for the runtime-signature feedback.

  • Fixed the session root pushScope(...) call so metadata is recorded in the metadata slot and the session payload remains the semantic input.
  • Updated the OpenClaw test runtimes to derive argument positions from Parameters<NemoRelayRuntimeModule['...']> so the mocks stay aligned with the actual Node binding signatures.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
integrations/openclaw/test/llm-replay.test.ts (1)

1156-1164: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Extract duplicated helper to shared test utility.

This helper is duplicated across three test files. While the correlation omission is correct for LLM replay (LLM metadata legitimately includes correlation per lines 538, 551, 582), extracting to a shared utility with a parameter for optional key exclusions would eliminate duplication.

🤖 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 `@integrations/openclaw/test/llm-replay.test.ts` around lines 1156 - 1164,
Extract the duplicated assertNoOverclaimedReplayMetadata helper into a shared
test utility function and add an optional parameter to exclude keys (e.g.,
exclusions?: string[]). Keep the same default behavior (assert metadata is an
object and that keys
'agent_kind','provider_payload_exact','fidelity_source','gateway_path','gateway_route'
are absent) but allow callers to pass exclusions like ['correlation'] when LLM
replay legitimately includes correlation; update all three tests to import the
shared utility and call it with the appropriate exclusions where needed,
referencing the original function name assertNoOverclaimedReplayMetadata for
locating and replacing usages.
integrations/openclaw/test/hooks-backend.test.ts (1)

533-542: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Extract duplicated helper to shared test utility.

assertNoOverclaimedHookMetadata is duplicated across three test files (hooks-backend.test.ts, llm-replay.test.ts, tool-replay.test.ts) with slight variations. Extract to a shared module (e.g., test/test-utils.ts) to eliminate duplication and ensure consistent validation logic.

🤖 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 `@integrations/openclaw/test/hooks-backend.test.ts` around lines 533 - 542,
Extract the duplicated helper assertNoOverclaimedHookMetadata into a shared test
utility module and update callers to import it: create a new exported function
(e.g., assertNoOverclaimedHookMetadata) in a common test-utils file and move the
exact validation logic there, then replace the local definitions in
hooks-backend.test.ts, llm-replay.test.ts, and tool-replay.test.ts with imports
of that shared function; ensure the signature and behavior (checking metadata is
object and asserting absence of keys 'agent_kind', 'provider_payload_exact',
'fidelity_source', 'gateway_path', 'gateway_route', 'correlation') remain
identical so existing tests keep working.
integrations/openclaw/test/tool-replay.test.ts (1)

292-301: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Extract duplicated helper to shared test utility.

This helper is duplicated across three test files. The correlation check here is correct for tool replay (tools should not claim correlation fields), but extracting to a shared utility would eliminate duplication.

🤖 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 `@integrations/openclaw/test/tool-replay.test.ts` around lines 292 - 301, The
function assertNoOverclaimedHookMetadata should be extracted from this test file
into a shared test utility module and reused by the three tests that currently
duplicate it; create a new exported helper (e.g., in a shared test/utils file)
that preserves the same checks including the 'correlation' absence for tool
replay, replace the local definition in
integrations/openclaw/test/tool-replay.test.ts with an import of that helper,
and update the other two test files to import and use the same exported
assertNoOverclaimedHookMetadata to eliminate duplication while keeping behavior
identical.
🤖 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 `@integrations/openclaw/test/hooks-backend.test.ts`:
- Line 454: The pushScope array type is missing a timestamp field, causing
inconsistency with other tests (e.g., llm-replay.test.ts); update the pushScope
type declaration to include timestamp: number (or string as used elsewhere),
then in the test where you destructure the pushed scope (the code that currently
pulls name, scopeType, data, metadata, input) also destructure timestamp and
store it in the pushScope array entries so timestamp is captured alongside the
other fields (adjust the destructuring and the object stored in the pushScope
push/assignment to include timestamp).

---

Outside diff comments:
In `@integrations/openclaw/test/hooks-backend.test.ts`:
- Around line 533-542: Extract the duplicated helper
assertNoOverclaimedHookMetadata into a shared test utility module and update
callers to import it: create a new exported function (e.g.,
assertNoOverclaimedHookMetadata) in a common test-utils file and move the exact
validation logic there, then replace the local definitions in
hooks-backend.test.ts, llm-replay.test.ts, and tool-replay.test.ts with imports
of that shared function; ensure the signature and behavior (checking metadata is
object and asserting absence of keys 'agent_kind', 'provider_payload_exact',
'fidelity_source', 'gateway_path', 'gateway_route', 'correlation') remain
identical so existing tests keep working.

In `@integrations/openclaw/test/llm-replay.test.ts`:
- Around line 1156-1164: Extract the duplicated
assertNoOverclaimedReplayMetadata helper into a shared test utility function and
add an optional parameter to exclude keys (e.g., exclusions?: string[]). Keep
the same default behavior (assert metadata is an object and that keys
'agent_kind','provider_payload_exact','fidelity_source','gateway_path','gateway_route'
are absent) but allow callers to pass exclusions like ['correlation'] when LLM
replay legitimately includes correlation; update all three tests to import the
shared utility and call it with the appropriate exclusions where needed,
referencing the original function name assertNoOverclaimedReplayMetadata for
locating and replacing usages.

In `@integrations/openclaw/test/tool-replay.test.ts`:
- Around line 292-301: The function assertNoOverclaimedHookMetadata should be
extracted from this test file into a shared test utility module and reused by
the three tests that currently duplicate it; create a new exported helper (e.g.,
in a shared test/utils file) that preserves the same checks including the
'correlation' absence for tool replay, replace the local definition in
integrations/openclaw/test/tool-replay.test.ts with an import of that helper,
and update the other two test files to import and use the same exported
assertNoOverclaimedHookMetadata to eliminate duplication while keeping behavior
identical.
🪄 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: ef64db6c-81e6-45dc-b03a-63ab6252b065

📥 Commits

Reviewing files that changed from the base of the PR and between 8824a00 and 7ea77a7.

📒 Files selected for processing (4)
  • integrations/openclaw/src/hook-replay/session.ts
  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/test/llm-replay.test.ts
  • integrations/openclaw/test/tool-replay.test.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (6)
**/*{test,spec,smoke}.{js,ts,py}

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

Relevant integration tests or smoke path must pass

Files:

  • integrations/openclaw/test/tool-replay.test.ts
  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/test/llm-replay.test.ts
{crates/adaptive/**/*.rs,**/*test*.{rs,py,go,ts,js},**/*adaptive*test*.{rs,py,go,ts,js},docs/plugins/adaptive/**}

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

Maintain documented and tested validation and report behavior for adaptive surfaces

Files:

  • integrations/openclaw/test/tool-replay.test.ts
  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/test/llm-replay.test.ts
**/*.{wasm,js,ts}{,x}

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

Ensure WebAssembly package naming conventions are consistent with generated package expectations and downstream consumption

Files:

  • integrations/openclaw/test/tool-replay.test.ts
  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/test/llm-replay.test.ts
  • integrations/openclaw/src/hook-replay/session.ts
**/*.{js,ts,jsx,tsx}

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

Run Node.js formatting with npm run format --workspace=nemo-relay-node

Include SPDX license header in all JavaScript and TypeScript source files using double-slash comment syntax

Files:

  • integrations/openclaw/test/tool-replay.test.ts
  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/test/llm-replay.test.ts
  • integrations/openclaw/src/hook-replay/session.ts
**/*.{rs,py,js,ts,tsx,jsx,go,sh,toml,yaml,yml,md}

📄 CodeRabbit inference engine (AGENTS.md)

Keep SPDX headers on source, docs, scripts, and configuration files. The project is Apache-2.0.

Files:

  • integrations/openclaw/test/tool-replay.test.ts
  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/test/llm-replay.test.ts
  • integrations/openclaw/src/hook-replay/session.ts
**/*.{rs,py,go,js,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions: Rust and Python use snake_case, C FFI exports prefixed nemo_relay_, Go uses PascalCase for public APIs, Node.js uses camelCase.

Files:

  • integrations/openclaw/test/tool-replay.test.ts
  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/test/llm-replay.test.ts
  • integrations/openclaw/src/hook-replay/session.ts
🧠 Learnings (1)
📚 Learning: 2026-05-07T18:04:44.387Z
Learnt from: mnajafian-nv
Repo: NVIDIA/NeMo-Flow PR: 67
File: integrations/openclaw/src/modules.ts:1-2
Timestamp: 2026-05-07T18:04:44.387Z
Learning: In NVIDIA/NeMo-Flow, TypeScript source files should use `//` line comments for SPDX headers (e.g., `// SPDX-FileCopyrightText: ...` and `// SPDX-License-Identifier: ...`) rather than C-style block comments (`/* ... */`). The repo’s copyright checker enforces this mapping, so `//` SPDX headers in `.ts` files should not be flagged as a style violation.

Applied to files:

  • integrations/openclaw/test/tool-replay.test.ts
  • integrations/openclaw/test/hooks-backend.test.ts
  • integrations/openclaw/test/llm-replay.test.ts
  • integrations/openclaw/src/hook-replay/session.ts
🔇 Additional comments (8)
integrations/openclaw/src/hook-replay/session.ts (3)

253-264: LGTM!


275-282: ⚡ Quick win

closeSessionRoot and pushScope argument order are consistent

  • closeSessionRoot positional parameters: the only in-repo call site (integrations/openclaw/src/hooks-backend.ts) passes metadata as the 5th argument and does not pass a positional timestamp (6th arg), so no old 5-arg timestamp usage remains.
  • pushScope argument order in integrations/openclaw/src/hook-replay/session.ts is consistent with Parameters<NemoRelayRuntimeModule['pushScope']> (runtime/test tuple expects …, data, metadata, input, timestamp)), so the data/metadata positions are not swapped.

343-352: ⚡ Quick win

Confirm pushScope positional arg semantics (data, metadata, input, timestamp).

OpenClaw’s tests stub pushScope(...args) as [name, scopeType, , , data, metadata, input, timestamp], and the session.ts call passes arg5=data, arg6=metadata, arg7=data (as input), arg8=input.timestamp ?? null. Output is provided via popScope(...), not as a pushScope positional argument.

			> Likely an incorrect or invalid review comment.
integrations/openclaw/test/hooks-backend.test.ts (2)

41-47: LGTM!

Also applies to: 94-98


512-522: LGTM!

integrations/openclaw/test/llm-replay.test.ts (1)

1097-1100: LGTM!

Also applies to: 1104-1127

integrations/openclaw/test/tool-replay.test.ts (2)

46-54: LGTM!

Also applies to: 68-77, 172-181


255-289: LGTM!

Comment thread integrations/openclaw/test/hooks-backend.test.ts
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Copy link
Copy Markdown
Contributor

@dagardner-nv dagardner-nv left a comment

Choose a reason for hiding this comment

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

Approved for deps, since the changes to package-lock.json don't introduce any actual dep changes

@willkill07
Copy link
Copy Markdown
Member

/merge

@rapids-bot rapids-bot Bot merged commit f7c9415 into NVIDIA:main Jun 4, 2026
35 checks passed
@mnajafian-nv mnajafian-nv deleted the fix/openclaw-atof-provenance-fidelity branch June 4, 2026 00:09
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:js PR changes/introduces Javascript/Typescript code size:XL PR is extra large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants