Skip to content

Control coordinator refactor to add declarative task#2959

Merged
mustafab0 merged 8 commits into
mainfrom
mustafa/control-coordinator-refactor-main
Jul 21, 2026
Merged

Control coordinator refactor to add declarative task#2959
mustafab0 merged 8 commits into
mainfrom
mustafa/control-coordinator-refactor-main

Conversation

@mustafab0

Copy link
Copy Markdown
Contributor

Problem

The ControlCoordinator hardcoded which task consumes which input stream and which methods are RPC-invokable. Adding a task meant editing the coordinator, and stream allowlists drifted from the tasks they mirrored.

Issue: #2958
Closes DIM-1231


Solution

Tasks now declare their own I/O in _registry.py manifests as import-free string cards. ControlTaskRegistry parses them into typed StreamBinding/TaskBindings (routing.py), and the coordinator builds its route table and command allowlist from the registry at task-registration time.

task_invoke only dispatches methods a task declares via TASK_EXPOSES. Twist, cartesian, velocity, teleop, servo, and g1-groot tasks migrated to cards.


Breaking Changes

None


How to Test

  1. .venv/bin/python -m pytest dimos/control -k "routing or coordinator_commands or registry"
  2. Register a task with a binding card; confirm the coordinator routes its stream without coordinator edits.
  3. Call task_invoke on an undeclared method — expect a clear "declare it in TASK_EXPOSES" error.

@mustafab0 mustafab0 changed the title aMustafa/control coordinator refactor main Control coordinator refactor to add declarative task Jul 15, 2026
@greptile-apps

greptile-apps Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes control-task routing declarative. The main changes are:

  • Task manifests declare consumed streams and exposed commands.
  • The coordinator builds routes and subscriptions from registered task types.
  • Migrated tasks add card-compatible stream handlers.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
dimos/control/coordinator.py Builds stream routes and command declarations from task manifests.
dimos/control/tasks/registry.py Parses and validates task binding cards during registry discovery.
dimos/control/routing.py Adds typed stream-routing and task-binding definitions.
dimos/control/tasks/g1_groot_wbc_task/_registry.py Declares the task's twist input and lifecycle commands.

Reviews (6): Last reviewed commit: "Auto-fixes for mustafa/control-coordinat..." | Re-trigger Greptile

Comment thread dimos/control/coordinator.py
Comment thread dimos/control/coordinator.py
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
dimos/control/tasks/test_registry.py 88.30% 14 Missing and 6 partials ⚠️
dimos/control/tasks/registry.py 82.22% 8 Missing and 8 partials ⚠️
dimos/control/coordinator.py 92.90% 8 Missing and 3 partials ⚠️
dimos/control/test_coordinator_commands.py 98.11% 4 Missing ⚠️
dimos/control/_control_test_helpers.py 89.65% 3 Missing ⚠️
dimos/control/test_coordinator_routing.py 99.45% 2 Missing ⚠️
dimos/control/tasks/teleop_task/teleop_task.py 50.00% 1 Missing ⚠️
@@            Coverage Diff             @@
##             main    #2959      +/-   ##
==========================================
+ Coverage   72.31%   72.80%   +0.48%     
==========================================
  Files        1024     1030       +6     
  Lines       92074    92959     +885     
  Branches     8418     8478      +60     
==========================================
+ Hits        66585    67679    +1094     
+ Misses      23232    22989     -243     
- Partials     2257     2291      +34     
Flag Coverage Δ
OS-ubuntu-24.04-arm 65.93% <95.00%> (+0.57%) ⬆️
OS-ubuntu-latest 68.24% <95.00%> (+0.53%) ⬆️
Py-3.10 68.23% <95.00%> (+0.53%) ⬆️
Py-3.11 68.22% <95.00%> (+0.53%) ⬆️
Py-3.12 68.23% <95.00%> (+0.53%) ⬆️
Py-3.13 68.23% <95.00%> (+0.54%) ⬆️
Py-3.14 68.24% <95.00%> (+0.53%) ⬆️
Py-3.14t 68.23% <95.00%> (+0.52%) ⬆️
SelfHosted-Large 30.12% <26.53%> (+<0.01%) ⬆️
SelfHosted-Linux 37.26% <26.53%> (-0.10%) ⬇️
SelfHosted-macOS 36.15% <26.53%> (-0.09%) ⬇️

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

Files with missing lines Coverage Δ
dimos/control/routing.py 100.00% <100.00%> (ø)
dimos/control/task.py 80.45% <100.00%> (+0.94%) ⬆️
dimos/control/tasks/cartesian_ik_task/_registry.py 100.00% <100.00%> (ø)
...ntrol/tasks/cartesian_ik_task/cartesian_ik_task.py 31.09% <ø> (-0.88%) ⬇️
dimos/control/tasks/eef_twist_task/_registry.py 100.00% <100.00%> (ø)
...mos/control/tasks/eef_twist_task/eef_twist_task.py 86.36% <ø> (+0.52%) ⬆️
dimos/control/tasks/g1_groot_wbc_task/_registry.py 100.00% <100.00%> (ø)
...ntrol/tasks/g1_groot_wbc_task/g1_groot_wbc_task.py 81.11% <100.00%> (+0.68%) ⬆️
.../tasks/g1_groot_wbc_task/test_g1_groot_wbc_task.py 100.00% <100.00%> (ø)
dimos/control/tasks/servo_task/_registry.py 100.00% <100.00%> (ø)
... and 16 more

... and 18 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.

@github-actions github-actions Bot added the ready-to-merge Required CI checks have passed on this PR label Jul 15, 2026
@mustafab0
mustafab0 force-pushed the mustafa/control-coordinator-refactor-main branch from 9958e94 to 9720a99 Compare July 15, 2026 17:39
@github-actions github-actions Bot added ready-to-merge Required CI checks have passed on this PR and removed ready-to-merge Required CI checks have passed on this PR labels Jul 15, 2026
@mustafab0
mustafab0 enabled auto-merge July 16, 2026 03:14
Comment thread dimos/control/tasks/test_registry.py Outdated
Comment thread dimos/control/tasks/test_registry.py Outdated
Replace the two duplicated __path__ + Path.iterdir() walks with a single
_task_dirs() helper built on importlib.resources.files(), so the CI guard
enumerates task dirs the same way regardless of install layout (editable,
wheel, or zip) and the walk logic lives in one place. Behavior-preserving:
same 12 task dirs discovered; 13/13 test_registry + 123/123 control pass.
@github-actions github-actions Bot added ready-to-merge Required CI checks have passed on this PR and removed ready-to-merge Required CI checks have passed on this PR labels Jul 16, 2026
@mustafab0
mustafab0 requested a review from spomichter July 16, 2026 06:54
@github-actions github-actions Bot added ready-to-merge Required CI checks have passed on this PR and removed ready-to-merge Required CI checks have passed on this PR labels Jul 16, 2026
Comment thread dimos/control/_control_test_helpers.py Outdated
Comment thread dimos/control/coordinator.py
@github-actions github-actions Bot removed the ready-to-merge Required CI checks have passed on this PR label Jul 17, 2026
@github-actions github-actions Bot added the ready-to-merge Required CI checks have passed on this PR label Jul 18, 2026
@mustafab0
mustafab0 dismissed spomichter’s stale review July 21, 2026 00:18

Discussed during weekly planning this is good to go.

@mustafab0
mustafab0 added this pull request to the merge queue Jul 21, 2026
Merged via the queue into main with commit ed8d1be Jul 21, 2026
49 of 51 checks passed
@mustafab0
mustafab0 deleted the mustafa/control-coordinator-refactor-main branch July 21, 2026 04:20
@github-actions

Copy link
Copy Markdown
Contributor

Successfully created backport PR for release/0.0.14b1:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Required CI checks have passed on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants