feat(plugin): add timestamped scope guards - #1166
rapids-bot[bot] merged 5 commits into
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: NVIDIA/NeMo-Relay/.coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: 📒 Files selected for processing (14)
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (3)
🧰 Additional context used📓 Path-based instructions (7)Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.⚙️ CodeRabbit configuration file Files:
Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.⚙️ CodeRabbit configuration file Files:
Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.⚙️ CodeRabbit configuration file Files:
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:
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:
Source excerpt: Search documentation source for references to the old version and update current-version install commands, package examples, and configuration examples to `` where appropriate: Review matches before changing th...📄 CodeRabbit inference engine (.agents/skills/prepare-code-freeze/SKILL.md) Files:
Source excerpt: Preserve MDX front matter and the JSX SPDX comment.📄 CodeRabbit inference engine (.agents/skills/draft-release-notes/SKILL.md) Files:
🧠 Learnings (1)📚 Learning: 2026-08-12T17:13:14.808ZApplied to files:
🔇 Additional comments (14)
WalkthroughThe change adds optional historical timestamps to Rust and Python scope APIs and worker protocol requests. The worker runtime converts supplied Unix-microsecond values for scope events. Untimestamped calls continue to omit the timestamp. ChangesHistorical scope timestamps
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant PluginRuntime
participant PushScopeRequest
participant DynamicWorker
participant ScopeEvents
PluginRuntime->>PushScopeRequest: Set optional timestamp_unix_micros
PushScopeRequest->>DynamicWorker: Send scope request
DynamicWorker->>ScopeEvents: Emit scope event with converted UTC timestamp
Merge Risk: ⚪ Minimal · up to The timestamp additions preserve ordinary scope behavior, and no actionable issue remains. This change is mergeable subject to normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 48.21% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 56 functions across 10 files. (4 skipped: 4 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: Alex Fournier <afournier@nvidia.com>
4c2ee80 to
7bbdd90
Compare
willkill07
left a comment
There was a problem hiding this comment.
Any changes made here also have to be made to:
nemo-relay-workernemo-relay-plugin(Python)
We need total consistency across all Plugin APIs.
…amped-scope-guards Signed-off-by: Alex Fournier <afournier@nvidia.com>
Signed-off-by: Alex Fournier <afournier@nvidia.com>
License DiffCompared against Lockfile license changesLockfile License ChangesRustAdded
Removed
Updated/Changed
NodeAdded
Removed
Updated/Changed
PythonAdded
Removed
Updated/Changed
Status output |
…plugin-timestamped-scope-guards Signed-off-by: Alex Fournier <afournier@nvidia.com> # Conflicts: # crates/worker-proto/tests/proto_tests.rs # crates/worker/src/lib.rs
…plugin-timestamped-scope-guards Signed-off-by: Alex Fournier <afournier@nvidia.com>
|
@coderabbitai review |
|
mnajafian-nv
left a comment
There was a problem hiding this comment.
LGTM, no p0s or p1s
|
/merge |
Overview
This is one of two independent Relay changes needed for the Switchyard plugin to replay captured routing scopes and marks beneath the managed LLM execution that triggered them.
Timestamped scopes preserve the calls' real timing. Switchyard captures
libsy.client_callandlibsy.upstream_attemptspans while provider work is happening, then publishes the completed hierarchy through Relay. If Relay timestamps those scopes when they are replayed, the provider work has already finished and the recorded durations collapse toward zero.This PR exposes historical scope timestamps consistently across Relay's plugin APIs. It does not change Relay core scope behavior.
Why the existing API is insufficient
The ordinary scope methods preserve hierarchy but use the current time. They cannot supply the original captured start and end times.
Two Switchyard-only approaches were evaluated:
scope_pushandscope_popABI directly would preserve timing, but would duplicate unsafe pointer handling, JSON conversion, status handling, and scope-handle ownership inside Switchyard. The typed SDK should expose functionality already supported by the ABI.Details
PluginRuntime::scope_at(...)andScopeGuard::close_at(...)as typed wrappers over timestamp fields already present in the native ABI.push_scope_at(...)andpop_scope_at(...).timestampkeyword topush_scope(...)andpop_scope(...), matching Relay's existing Python scope convention.PushScopeandPopScopemessages.This is additive. No existing method, callback, serialized field number, native function table, field layout, or ABI version changes. The worker protocol remains
grpc-v1; older protobuf hosts ignore the optional fields. A worker that depends on historical timestamp preservation should require Relay 0.10 or newer.Relationship and landing order
Testing
Where should the reviewer start?
Start with the native methods in
crates/plugin/src/lib.rs, then the worker protocol and host translation in:crates/worker-proto/proto/nemo/relay/worker/v1/plugin_worker.protocrates/core/src/plugin/dynamic/worker.rscrates/worker/src/lib.rspython/plugin/src/nemo_relay_plugin/_api.pyRelated Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit