Add runtime recording#2573
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an optional runtime recorder that writes tick-level runtime data to JSONL files for later debugging and analysis.
Changes:
- Adds
RuntimeRecorderfor daily JSONL recording. - Integrates recorder setup, tick recording, and shutdown cleanup into the runtime.
- Adds config passthrough, Docker volume mounting, and recorder-focused tests.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/runtime/recorder.py |
Adds JSONL runtime tick recorder with daily file rotation. |
src/runtime/cortex.py |
Wires recorder lifecycle and per-tick recording into the runtime loop. |
src/runtime/config.py |
Adds recorder field to runtime configuration loading/serialization. |
src/runtime/converter.py |
Preserves recorder setting when converting single-mode configs. |
tests/runtime/test_recorder.py |
Adds unit tests for recorder creation, writing, rotation, stopping, and restart append behavior. |
tests/runtime/test_convert.py |
Adds converter tests for recorder passthrough/default behavior. |
docker-compose.yml |
Mounts a host recordings directory into the container. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
openminddev
reviewed
May 18, 2026
| from datetime import datetime, timezone | ||
| from typing import Any | ||
|
|
||
| enable_recording = os.environ.get("OM1_ENABLE_RECORDING", "false").lower() == "true" |
Contributor
There was a problem hiding this comment.
This should come from the config file
Introduce a Recorder singleton (providers/recorder.py) to centralize LLM interaction logging to daily-rotated JSONL files. Replace the old module-level recorder with the new provider: initialize Recorder in LLM and cortex, switch LLM plugins to call self.recorder.record(...), and use recorder.set_generation(...) in runtime/cortex.py. Add comprehensive unit tests (tests/providers/test_recorder.py) and remove the legacy src/recorder module and its tests. The Recorder supports enable/disable, generation tracking, atexit cleanup, and safer error handling when writing records.
Rename providers/recorder.py -> providers/tracer.py and replace Recorder with Tracer (method record -> gauge, default output_dir changed to "traces"). Update imports and usages across the codebase: llm/__init__.py, all llm plugins (deepseek, functiongemma, gemini, near_ai, ollama, openai, openrouter, qwen, xai) now use self.tracer.gauge instead of self.recorder.record. Wire Tracer into runtime: runtime.cortex uses Tracer, ModeCortexRuntime enables tracing when mode_config.tracing is set, and set_generation now calls tracer.set_generation. Expose tracing in configuration: runtime.config and ModeSystemConfig gain a tracing field; converter and load_mode_config now propagate the tracing flag. Tests updated: removed tests/providers/test_recorder.py and added tests/providers/test_tracer.py with equivalent checks for the new Tracer behavior.
Remove the OM1_ENABLE_RECORDING environment variable (previously defaulted to false) and replace the host volume ${HOME}/recorded_data/recordings with a repository-relative ./traces mounted to /app/OM1/traces. This moves recorded data into the project directory; update any host-side data paths or backup/migration procedures accordingly.
Move the ${HOME}/shared_data/locations and ./traces volume mounts earlier in the service's volumes list and remove their original entries. This groups local project mounts with config and cyclonedds mounts for clearer ordering and readability.
Replace the old tracing flag with use_tracer across runtime modules. Updated ModeSystemConfig and RuntimeConfig docs/fields, changed load_mode_config to read use_tracer from raw config and pass it through, adjusted ConfigConverter mapping, and updated cortex to check mode_config.use_tracer when enabling the tracer. Note: existing configs that use "tracing" should be updated to "use_tracer".
Set use_tracer: true in conversation config to enable tracing for the conversation service. Add 'traces' to .gitignore to prevent trace output from being committed.
Update runtime version and all configuration/test metadata to v1.0.5. This commit increments latest_runtime_version in src/runtime/version.py, updates version fields across numerous config JSON5 files and integration test cases, and adjusts tests/docs to expect v1.0.5 so code, tests, and documentation remain consistent with the new release.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new runtime data recording feature for OM1, enabling the system to log tick-level data to daily JSONL files. The main changes include the implementation of the
RuntimeRecorderclass, integration of recording logic into the runtime, configuration support for enabling/disabling the recorder, and comprehensive tests to ensure correct behavior.Runtime Data Recording Feature
Implementation and Integration:
RuntimeRecorderclass (src/runtime/recorder.py) to record runtime tick data (including timestamps, ASR input, LLM input/output, and actions) to daily JSONL files, with automatic file rotation and robust error handling.src/runtime/cortex.py: initializes the recorder when enabled, records tick data in_tick, and ensures proper cleanup on shutdown. [1] [2] [3] [4] [5]Configuration and Data Management:
recorderfield to the runtime config (src/runtime/config.py,src/runtime/converter.py), allowing the feature to be enabled/disabled via configuration, and ensured correct propagation through config loading and serialization. [1] [2] [3] [4]docker-compose.ymlto mount a host directory for storing recordings.Testing:
RuntimeRecorder(tests/runtime/test_recorder.py), covering directory creation, tick recording, file rotation, error handling, and persistence.These changes provide a robust and configurable mechanism to record and persist runtime activity, supporting future analysis and debugging.