Skip to content

feat: support optional operational file log sinks - #1484

Merged
mnajafian-nv merged 1 commit into
NVIDIA:mainfrom
bbednarski9:bbednarski/optional-log-sinks
Oct 23, 2026
Merged

mnajafian-nv merged 1 commit into
NVIDIA:mainfrom
bbednarski9:bbednarski/optional-log-sinks

Conversation

@bbednarski9

@bbednarski9 bbednarski9 commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Overview

Allow each operational file log sink to opt into best-effort startup, so unavailable log storage does not prevent an otherwise usable Relay runtime or daemon from starting. Required sinks retain strict startup behavior by default.

  • 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 failure_policy = "required" | "optional" to individual file sinks, including [daemon.logging], configuration layering, and the interactive editor. Rust callers use FileLogSinkFailurePolicy.
  • Skip optional sinks only for structured filesystem initialization failures, covering append-only and rotating files. Validate every sink and reserve destinations before opening files; invalid configuration, path collisions, required-sink failures, and delivery-infrastructure failures remain fatal.
  • Report unavailable sinks through one bounded stderr warning and existing diagnostic observations, independently of readiness and logging enablement. Paths and backend error text stay out of these reports; late diagnostics attachment observes the current unavailable state without replaying log records.
  • Preserve healthy sinks, original configured sink identities, formatter selection, and shutdown-failure attribution. Disabled sinks have no delivery queue, buffering, or automatic retry; reinitializing logging retries them. Existing runtime write-error handling, queue bounds, and rotation remain unchanged.
  • Document configuration, record loss, and recovery. Add generic core, CLI/daemon, and Python/Node.js/Go startup regression coverage; the bindings reuse the shared TOML configuration without new binding APIs.

Rust source compatibility: exhaustive FileLogSinkConfig struct literals must provide the new failure_policy field or use ..Default::default(). Existing TOML configurations continue to default to required sinks.

Validation:

  • just test-rust: 6,470 passed, 4 skipped.
  • Final focused Rust logging/configuration/daemon checks: 134 passed, including the follow-up preserving per-sink invalid-configuration evidence.
  • just test-python: 86 Rust bridge tests, 1,175 Python tests, and 24 example tests passed.
  • just test-node: 6 Rust bridge tests, 521 Node.js tests, and 26 example tests passed.
  • just --set ci true test-go: all packages passed using the shared debug build.
  • Clippy with warnings denied for the affected Rust crates, formatting, TOML documentation examples, and git diff --check passed.
  • Repository pre-commit hooks passed, including workspace Clippy/check, documentation links, type checking, dependency audits, and Go vet.

Where should the reviewer start?

Start with crates/core/src/logging/sink.rs for validation and the narrow filesystem-failure boundary, then crates/core/src/logging/mod.rs for sink identity and late diagnostics attachment. Review the startup policy in crates/core/src/logging/config.rs and the regression cases in crates/core/tests/coverage/logging_tests.rs and crates/cli/tests/runtime_diagnostics_tests.rs.

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

Summary by CodeRabbit

  • New Features
    • File logging sinks now support a startup failure policy. By default, a sink that cannot be opened still prevents startup; setting its policy to optional lets the application start and continue writing to healthy sinks.
    • Unavailable optional sinks are reported with sanitized diagnostics and remain disabled until logging is reinitialized. Invalid configuration and destination conflicts still prevent startup.
  • Documentation
    • Updated logging and diagnostics references to explain the policy, its defaults, and runtime behavior.

Add a required-by-default per-file startup failure policy. Skip optional filesystem initialization failures while preserving healthy sinks, bounded diagnostic evidence, and strict configuration validation. Cover core, CLI/daemon, and binding startup behavior and document record loss and reinitialization.

Signed-off-by: Bryan Bednarski <[email protected]>
@bbednarski9
bbednarski9 requested review from a team as code owners October 23, 2026 18:15
@github-actions github-actions Bot added size:XL PR is extra large Feature a new feature lang:go PR changes/introduces Go code lang:js PR changes/introduces Javascript/Typescript code lang:python PR changes/introduces Python code labels Oct 23, 2026
@coderabbitai

coderabbitai Bot commented Oct 23, 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 25c8470 and 4bc3b59.

📒 Files selected for processing: 17
  • crates/cli/src/commands/configure/editor.rs
  • crates/cli/src/commands/configure/editor/prompt.rs
  • crates/cli/src/configuration/logging.rs
  • crates/cli/tests/coverage/commands/configure_editor_tests.rs
  • crates/cli/tests/coverage/shared/config_tests.rs
  • crates/cli/tests/runtime_diagnostics_tests.rs
  • crates/core/src/logging/config.rs
  • crates/core/src/logging/diagnostics.rs
  • crates/core/src/logging/mod.rs
  • crates/core/src/logging/sink.rs
  • crates/core/tests/coverage/logging_sink_tests.rs
  • crates/core/tests/coverage/logging_tests.rs
  • crates/node/tests/logging_tests.mjs
  • docs/reference/diagnostics/index.mdx
  • docs/reference/operational-logging.mdx
  • go/nemo_relay/logging_test.go
  • python/tests/test_logging.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: 3
  • GitHub Check: Prepare
  • GitHub Check: Detect docs changes
  • GitHub Check: Apply PR labels
🧰 Additional context used
📚 Code guidelines: 2
.agents/skills/contribute-docs/SKILL.md — configured
.agents/skills/review-doc-style/SKILL.md — configured
📓 Path-based instructions: 7
Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.

⚙️ CodeRabbit configuration file

Files:

  • docs/reference/diagnostics/index.mdx
  • docs/reference/operational-logging.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/logging_tests.mjs
  • go/nemo_relay/logging_test.go
  • crates/cli/tests/coverage/commands/configure_editor_tests.rs
  • python/tests/test_logging.py
  • crates/cli/tests/runtime_diagnostics_tests.rs
  • crates/cli/tests/coverage/shared/config_tests.rs
  • crates/core/tests/coverage/logging_sink_tests.rs
  • crates/core/tests/coverage/logging_tests.rs
Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.

⚙️ CodeRabbit configuration file

Files:

  • crates/core/src/logging/config.rs
  • crates/core/src/logging/diagnostics.rs
  • crates/core/tests/coverage/logging_sink_tests.rs
  • crates/core/tests/coverage/logging_tests.rs
  • crates/core/src/logging/mod.rs
  • crates/core/src/logging/sink.rs
Treat binding changes as public API changes.

⚙️ CodeRabbit configuration file

Files:

  • crates/node/tests/logging_tests.mjs
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/logging_test.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/reference/diagnostics/index.mdx
  • docs/reference/operational-logging.mdx
Source excerpt: Verify MDX files use JSX delimiters for top-of-file SPDX comments.

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

Files:

  • docs/reference/diagnostics/index.mdx
  • docs/reference/operational-logging.mdx
🪛 ast-grep (0.45.3)
python/tests/test_logging.py

[info] 144-144: use jsonify instead of json.dumps for JSON output
Context: json.dumps(str(blocked / "relay.jsonl"))
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)

[info] 147-147: use jsonify instead of json.dumps for JSON output
Context: json.dumps(str(healthy))
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)

🔇 Additional comments: 17
crates/core/src/logging/config.rs: 1

230-243: LGTM!

Also applies to: 265-266, 277-277, 372-373, 441-441

crates/cli/src/configuration/logging.rs: 1

11-11: LGTM!

Also applies to: 34-35, 131-131

crates/cli/src/commands/configure/editor.rs: 1

18-18: LGTM!

crates/cli/src/commands/configure/editor/prompt.rs: 1

13-14: LGTM!

Also applies to: 558-561, 571-578

crates/cli/tests/coverage/commands/configure_editor_tests.rs: 1

855-878: LGTM!

crates/cli/tests/coverage/shared/config_tests.rs: 1

4628-4628: LGTM!

Also applies to: 4657-4660, 4669-4672, 5802-5836

crates/core/src/logging/sink.rs: 1

19-23: LGTM!

Also applies to: 34-41, 48-51, 54-55, 75-75, 83-83, 85-117, 120-122, 153-153, 170-176, 178-270, 276-276, 283-290, 295-295, 304-304

crates/core/src/logging/diagnostics.rs: 1

210-221: LGTM!

Also applies to: 263-275

crates/core/tests/coverage/logging_tests.rs: 1

10-13: LGTM!

Also applies to: 728-728, 2223-2514

crates/core/tests/coverage/logging_sink_tests.rs: 1

541-542: LGTM!

Also applies to: 590-590, 604-606, 621-621, 847-869

crates/core/src/logging/mod.rs: 1

29-29: LGTM!

Also applies to: 118-121, 132-135, 148-149, 167-172, 202-203, 210-211, 263-263, 293-294, 353-365, 367-368

crates/cli/tests/runtime_diagnostics_tests.rs: 1

101-203: LGTM!

crates/node/tests/logging_tests.mjs: 1

193-228: LGTM!

go/nemo_relay/logging_test.go: 1

68-68: LGTM!

Also applies to: 239-286

python/tests/test_logging.py: 1

9-10: LGTM!

Also applies to: 130-158

docs/reference/diagnostics/index.mdx: 1

362-369: LGTM!

docs/reference/operational-logging.mdx: 1

15-15: LGTM!

Also applies to: 23-24, 309-309, 344-403, 421-423

Walkthrough

File sinks now default to required startup behavior and can be configured as optional. Optional sinks that fail filesystem initialization are disabled while healthy sinks continue. The change adds sink-specific diagnostics, CLI configuration support, integration tests, and documentation.

Changes

File-sink startup policy

Layer / File(s) Summary
Policy configuration and CLI editing
crates/core/src/logging/config.rs, crates/cli/src/configuration/logging.rs, crates/cli/src/commands/configure/editor*, crates/cli/tests/coverage/*
Adds FileLogSinkFailurePolicy with Required as the default and Optional as the alternative. CLI configuration parsing, layered configuration, and the editor accept and resolve the policy.
Sink validation and construction
crates/core/src/logging/sink.rs, crates/core/src/logging/diagnostics.rs, crates/core/tests/coverage/logging*
Validates sink settings and path collisions before opening files. Classified filesystem open failures disable optional sinks and produce sanitized initialization diagnostics; required sinks and other initialization failures remain errors.
Runtime sink tracking and diagnostics
crates/core/src/logging/mod.rs, crates/core/tests/coverage/logging_sink_tests.rs, crates/core/tests/coverage/logging_tests.rs
Tracks configured positions for installed and unavailable sinks. Shutdown failures and diagnostics attached after startup use those positions to report sink-specific status.
Integration tests and documentation
crates/cli/tests/runtime_diagnostics_tests.rs, crates/node/tests/logging_tests.mjs, go/nemo_relay/logging_test.go, python/tests/test_logging.py, docs/reference/*
Tests the policy in daemon and language-binding scenarios. Documents defaults, unavailable-sink behavior, diagnostics, record handling, and recovery.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant LoggingRuntime
  participant build_logger_with_diagnostics
  participant FileSink
  participant SinkDiagnostics
  participant HealthySink
  LoggingRuntime->>build_logger_with_diagnostics: build logger and validate destinations
  build_logger_with_diagnostics->>FileSink: open configured file
  FileSink-->>build_logger_with_diagnostics: return filesystem open error
  build_logger_with_diagnostics->>SinkDiagnostics: record sanitized initialization failure
  build_logger_with_diagnostics->>HealthySink: install healthy sink
  build_logger_with_diagnostics-->>LoggingRuntime: return installed and unavailable sink positions
Loading

Possibly related PRs

Merge Risk: ⚪ Minimal · up to 4bc3b

No identified issue blocks the optional file-sink policy from merging after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 47.83% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 46 functions across 15 files. (2 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title uses the allowed Conventional Commits format, has the valid lowercase type "feat", provides a concise imperative summary, is 49 characters long, and has no trailing period.
Description check Passed The description includes all required sections, confirms the checklist items, explains the implementation and validation, identifies reviewer starting points, and links the change with the required "C…
Linked Issues check Passed Issue [#1297] requires required-by-default file sinks, optional append-only and rotating sinks, preserved validation, healthy-sink continuity, observable degradation, configuration support, tests, and…
Out of Scope Changes check Passed The changed Rust runtime, CLI configuration and editor, daemon diagnostics tests, binding startup tests, and operational logging documentation implement the file-sink startup policy in [#1297]. The ch…
Full details: Description check

Explanation

The description includes all required sections, confirms the checklist items, explains the implementation and validation, identifies reviewer starting points, and links the change with the required "Closes #1297" action keyword.

Full details: Linked Issues check

Explanation

Issue [#1297] requires required-by-default file sinks, optional append-only and rotating sinks, preserved validation, healthy-sink continuity, observable degradation, configuration support, tests, and documentation. FileLogSinkFailurePolicy defaults to Required; sink.rs validates all sinks and reserves paths before opening files, and skips only classified filesystem open failures for Optional sinks. The configuration and editor support [logging] and [daemon.logging]. Tests cover defaults, invalid settings, collisions, multiple sinks, diagnostics, daemon health, and Python, Node.js, and Go startup behavior. Documentation covers record loss and reinitialization recovery.

Full details: Out of Scope Changes check

Explanation

The changed Rust runtime, CLI configuration and editor, daemon diagnostics tests, binding startup tests, and operational logging documentation implement the file-sink startup policy in [#1297]. The changes do not demonstrate unrelated agent telemetry or service-manager work. Binding test changes validate shared TOML and environment behavior without adding unrelated binding APIs.

Full details: Docstring Coverage

Explanation

Docstring coverage is 47.83% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 46 functions across 15 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.

@github-actions github-actions Bot added the lang:rust PR changes/introduces Rust code label Oct 23, 2026
@github-actions

Copy link
Copy Markdown

@willkill07 willkill07 added this to the 0.11 milestone Oct 23, 2026
@willkill07
willkill07 enabled auto-merge (squash) October 23, 2026 19:01
@bbednarski9
bbednarski9 disabled auto-merge October 23, 2026 19:07

@mnajafian-nv mnajafian-nv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@mnajafian-nv
mnajafian-nv merged commit b4c3c9a into NVIDIA:main Oct 23, 2026
97 checks passed

This branch was previously deployed

1 inactive deployment
fern — 4bc3b592 Deployed Oct 23, 2026 by mnajafian-nv via Clean up docs preview #6478
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature a new feature 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:XL PR is extra large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Support optional operational file log sinks without blocking daemon startup

3 participants