Skip to content

fix(imitation): improve collection safety and episode handling - #3497

Draft
ruthwikdasyam wants to merge 7 commits into
mainfrom
ruthwik/datacollection/2
Draft

fix(imitation): improve collection safety and episode handling#3497
ruthwikdasyam wants to merge 7 commits into
mainfrom
ruthwik/datacollection/2

Conversation

@ruthwikdasyam

@ruthwikdasyam ruthwikdasyam commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Contribution path

  • Small, safe change that does not need a tracking issue

Problem

Imitation collection performed unnecessary pose/TF lookup for semantically poseless streams, could stop its recorder before final producer events, and did not clearly report an episode left open at the end of a recording. Quest disconnects could also leave stale controller engagement active, and invalid episode button mappings were silently ignored.

Solution

  • Keep collection streams explicitly poseless and disable TF recording without changing the shared Memory recorder or SQLite store.
  • Stop camera, teleop, coordinator, and episode producers before the collection recorder.
  • Persist an explicit discard when shutdown interrupts an active episode.
  • Clear Quest controller state on the final client disconnect, publish a zero-button safe command, require fresh reconnect state, and reject unknown controller identities.
  • Validate episode button mappings at startup.
  • Extend dataprep inspection to report incomplete source episodes separately from saved/discarded episodes.
  • Add a real SQLite-to-HDF5/LeRobot integration test that reopens SQLite, HDF5, Parquet, and MP4 outputs and validates values, timestamps, episode boundaries, and counts.

Recorder FIFO, overload metrics, drain guarantees, and explicit WAL checkpointing are intentionally deferred to a later change. Generic Memory recorder behavior remains unchanged.

How to Test

Run the recording inspector against a collection database:

dimos dataprep inspect /path/to/session.db

Automated verification:

uv run pytest dimos/memory dimos/imitation dimos/teleop/quest -q

uv run mypy dimos/

uv run pre-commit run --all-files

Results: 527 tests passed, mypy passed across 998 source files, and all pre-commit hooks passed.

AI assistance

OpenCode with GPT-5.6 Sol was used extensively for codebase analysis, implementation, merge-conflict resolution, tests, and verification. The changes and generated tests were reviewed through focused diffs, type checking, pre-commit, and the affected test suites.

Checklist

  • I have read and approved the CLA.

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.38235% with 18 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
dimos/teleop/quest/quest_teleop_module.py 69.56% 7 Missing ⚠️
dimos/imitation/test_datacollection_e2e.py 96.26% 5 Missing ⚠️
dimos/imitation/collection/episode_monitor.py 89.47% 1 Missing and 1 partial ⚠️
dimos/imitation/collection/recorder.py 66.66% 1 Missing and 1 partial ⚠️
dimos/imitation/dataprep/build.py 86.66% 1 Missing and 1 partial ⚠️
@@            Coverage Diff             @@
##             main    #3497      +/-   ##
==========================================
+ Coverage   74.05%   76.17%   +2.12%     
==========================================
  Files        1283     1226      -57     
  Lines      124704   119002    -5702     
  Branches    11141    10670     -471     
==========================================
- Hits        92349    90650    -1699     
+ Misses      29493    25260    -4233     
- Partials     2862     3092     +230     
Flag Coverage Δ
OS-ubuntu-24.04-arm 70.40% <52.94%> (-0.03%) ⬇️
OS-ubuntu-latest 72.36% <93.38%> (+0.14%) ⬆️
Py-3.10 72.36% <93.38%> (+0.14%) ⬆️
Py-3.11 72.35% <93.38%> (+0.13%) ⬆️
Py-3.12 72.35% <93.38%> (+0.14%) ⬆️
Py-3.13 72.36% <93.38%> (+0.14%) ⬆️
Py-3.14 72.36% <93.38%> (+0.14%) ⬆️
Py-3.14t 72.36% <93.38%> (+0.13%) ⬆️
SelfHosted-Large 29.74% <25.36%> (+0.03%) ⬆️
SelfHosted-Linux 35.80% <25.36%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
dimos/cli/dimos.py 64.78% <ø> (ø)
dimos/imitation/collection/blueprint.py 88.23% <ø> (ø)
dimos/imitation/collection/test_blueprint.py 100.00% <100.00%> (ø)
dimos/imitation/collection/test_episode_monitor.py 99.00% <100.00%> (+0.13%) ⬆️
dimos/imitation/collection/test_recorder.py 100.00% <100.00%> (ø)
dimos/imitation/dataprep/core.py 92.42% <100.00%> (+5.12%) ⬆️
dimos/imitation/dataprep/test_core.py 99.40% <100.00%> (+0.02%) ⬆️
dimos/teleop/quest/test_quest_teleop_module.py 100.00% <100.00%> (ø)
dimos/imitation/collection/episode_monitor.py 87.80% <89.47%> (-0.05%) ⬇️
dimos/imitation/collection/recorder.py 88.88% <66.66%> (-11.12%) ⬇️
... and 3 more

... and 86 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ruthwikdasyam ruthwikdasyam changed the title fix(imitation): harden data collection integrity and Quest safety fix(imitation): improve collection safety and episode handling Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant