Skip to content

[DAS-Dashboard#1194] Command-Router not working on dashboard. - #307

Open
levisingularity wants to merge 6 commits into
masterfrom
1194/fix-command-router-not-working
Open

[DAS-Dashboard#1194] Command-Router not working on dashboard.#307
levisingularity wants to merge 6 commits into
masterfrom
1194/fix-command-router-not-working

Conversation

@levisingularity

Copy link
Copy Markdown
Collaborator
  • Fixed an issue that prevented the command router from starting correctly from the dashboard.
  • Refactored orchestration command handling in the UI to use the new labels provided by das-cli, eliminating the command translation layers and slightly simplifying the code.
Screencast.from.2026-08-06.15-48-59.webm

-  removed redundant classes and services
-  removed 'command translation' layer making code overly complex
- moved dashboard initial state generation to the back-end.
- Removed constants.js and serviceinventory.js
- Reorganized API calls, removed unused api call methods.
- Reorganized data rendering to use new keys provided by the cli.
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

  • Refactors das-cli lifecycle commands to use configured endpoints and das-cli command labels. It removes --peer-hostname and --peer-port, which can affect CLI compatibility and Docker container startup behavior.
  • Updates dashboard orchestration to pass service commands directly and load state through /initial-state. Verify command-label mappings, service routes, container lifecycle handling, and configuration or secret propagation across deployments.
  • Flags a config risk: save_config still references the removed save_context_mapping_content import. The /config/load and save responses also remove the legacy hosts field.
  • Updates das-cli/tests/integration/ coverage for the removed peer options. No dashboard component-test coverage or Debian, Docker packaging, or self-hosted-runner changes are identified; validate these paths separately.

Walkthrough

The change removes peer host and port CLI options, centralizes endpoint configuration, adds a dashboard initial-state API, replaces enum-based service handling with command strings, and updates dashboard state, runtime metrics, service actions, and integration coverage.

Changes

CLI service endpoint simplification

Layer / File(s) Summary
CLI command contracts and endpoint wiring
das-cli/src/commands/*, das-cli/src/common/bus_node/*, das-cli/src/common/container_manager/*, das-cli/src/common/factory/*
Lifecycle commands now accept only port_range. Bus endpoints come from configured defaults.
CLI help and integration coverage
das-cli/src/commands/*_docs.py, das-cli/tests/integration/*
Help text and integration commands no longer use peer hostname or peer port options.

Dashboard initial state and service orchestration

Layer / File(s) Summary
Initial-state API and service inventory
das-dashboard/backend/controllers/*, das-dashboard/backend/services/*, das-dashboard/backend/shared/*
The backend exposes /initial-state with dashboard hosts and a service-to-server map.
Service-command lifecycle orchestration
das-dashboard/backend/controllers/container_controllers.py, das-dashboard/backend/services/container_services.py
Lifecycle routes and orchestration use service command strings and shared ordering.

Dashboard frontend runtime state

Layer / File(s) Summary
Initial-state context and configuration refresh
das-dashboard/src/api/*, das-dashboard/src/components/global_providers/*, das-dashboard/src/pages/setup_das/*
The frontend loads and reapplies dashboard initial state after configuration changes.
Runtime service enrichment and metrics
das-dashboard/src/hooks/*, das-dashboard/src/utils/*, das-dashboard/src/components/dashboard/*
Runtime payloads patch base services and aggregate bounded CPU and memory history.
Dynamic service controls and action feedback
das-dashboard/src/components/dashboard/MainContent/*, das-dashboard/src/components/dashboard/ArchitectureView/*
Service controls use discovered orchestration services and pass service commands unchanged to lifecycle APIs.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Suggested reviewers: andre-senna


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Tests For Behavior Changes ❌ Error The PR changes CLI and dashboard production behavior, but HEAD~1..HEAD adds no test updates and the description gives no reason for omitting tests. Add or update focused tests for command-router configuration errors, dashboard orchestration selection, metrics refresh, and setup refresh failures; or document why tests are intentionally omitted.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the command-router issue fixed by the pull request.
Description check ✅ Passed The description accurately covers the command-router fix and the dashboard orchestration refactor.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 1194/fix-command-router-not-working

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 9

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@das-cli/src/commands/link_creation_agent/lca_docs.py`:
- Line 30: Update the link-creation-agent start command synopsis in lca_docs.py
to show the port-range placeholder with the colon delimiter, matching the parser
and existing examples: start:end rather than start_port-end_port.

In `@das-cli/src/common/bus_node/busnode_command_registry.py`:
- Around line 51-60: The _get_bus_endpoint method’s missing-endpoint ValueError
is being masked by the broad ValueError handling in
BusNodeContainerManager.start_container(). Use a distinct configuration
exception for the agents.query.endpoint validation, or narrow start_container()
to catch only unknown-service errors, so the CLI preserves and displays the
missing query endpoint message.
- Around line 73-107: Add Bats lifecycle coverage for cmd_evolution_agent,
cmd_link_creation_agent, cmd_inference_agent, and cmd_context_broker: verify
start --help and restart --help omit the legacy --peer-hostname and --peer-port
options, and startup commands use the configured agents.query.endpoint. Add
coverage for a missing agents.query.endpoint that asserts an actionable
configuration error.

In `@das-dashboard/backend/controllers/container_controllers.py`:
- Around line 80-124: Add regression tests covering start_service, stop_service,
and restart_service with catalog commands such as query-engine, verifying
configured local and remote host resolution and the generated das-cli argument
order (<service_command>, <action>) with JSON output. Cover the related
manage_container flow in container_services.py, including both command
construction and host selection, while leaving production behavior unchanged.

In `@das-dashboard/backend/services/dashboard_services.py`:
- Around line 12-14: Add integration tests for the GET /initial-state endpoint
through fetch_initial_state, covering both local and remote service
configurations. Assert that hosts rows and serviceServerMap use the expected
service-command keys, and verify missing or invalid configuration returns the
shared handler’s expected error response.

In
`@das-dashboard/src/components/dashboard/MainContent/sidebar/ArchitectureActionControl.jsx`:
- Around line 91-93: Update the useEffect in ArchitectureActionControl so it
initializes selected service IDs only on the first discovery, then preserves the
existing selection across orchestrationServices updates while removing IDs no
longer available. Add a test that deselects a service, refreshes with equivalent
machine data, and verifies that service remains excluded.

In `@das-dashboard/src/hooks/useArchitectureTabMetrics.js`:
- Around line 19-43: Update the host synchronization logic around the fleet
stream setup so every existing host refreshes its stored base services from the
current machines entry instead of returning before applying changes; ensure
runtime patching and fleetMergedServices use that current per-host base list.
During inactive-host cleanup, also remove the host from fleetHostStatsByHost
alongside services, history, and link state so re-added hosts cannot display
stale statistics.

In `@das-dashboard/src/pages/setup_das/SetupDas.jsx`:
- Around line 88-95: Update refreshDashboardState so getInitialState failures
propagate or produce an explicit failure result instead of being swallowed. In
both configuration flows, distinguish a successful write from a failed dashboard
refresh and show a warning when refresh fails, preventing stale machines or
service metadata from being reported as success. Add save and load tests
covering this failure path.

In `@das-dashboard/src/utils/serviceRows.js`:
- Around line 3-63: Add focused tests for patchServicesWithRuntime and
rollupMetricsHistory covering exact service_command_label matches, AtomDB marker
fallback behavior, one-runtime-to-one-row assignment, and preservation of
unmatched base rows. Verify rollupMetricsHistory produces per-container CPU and
memory series limited to the dashboard’s 20-snapshot history window, using the
module’s existing marker/configuration symbols and test conventions.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e5d4b647-340c-4d02-a60e-9ca746d1760d

📥 Commits

Reviewing files that changed from the base of the PR and between f32d884 and 13d6c9b.

📒 Files selected for processing (48)
  • das-cli/src/commands/context_broker/context_broker_cli.py
  • das-cli/src/commands/context_broker/context_broker_docs.py
  • das-cli/src/commands/evolution_agent/evolution_agent_cli.py
  • das-cli/src/commands/evolution_agent/evolution_agent_docs.py
  • das-cli/src/commands/inference_agent/inference_agent_cli.py
  • das-cli/src/commands/inference_agent/inference_agent_docs.py
  • das-cli/src/commands/link_creation_agent/lca_docs.py
  • das-cli/src/commands/link_creation_agent/link_creation_agent_cli.py
  • das-cli/src/commands/query_agent/query_agent_cli.py
  • das-cli/src/common/bus_node/busnode_command_registry.py
  • das-cli/src/common/container_manager/busnode_container_manager.py
  • das-cli/src/common/factory/busnode_manager_factory.py
  • das-cli/tests/integration/test_context_broker.bats
  • das-cli/tests/integration/test_evolution_agent.bats
  • das-cli/tests/integration/test_inference_agent.bats
  • das-cli/tests/integration/test_link_creation_agent.bats
  • das-cli/tests/integration/test_logs.bats
  • das-dashboard/backend/controllers/config_controllers.py
  • das-dashboard/backend/controllers/container_controllers.py
  • das-dashboard/backend/controllers/dashboard_controllers.py
  • das-dashboard/backend/main.py
  • das-dashboard/backend/services/config_services.py
  • das-dashboard/backend/services/container_services.py
  • das-dashboard/backend/services/dashboard_services.py
  • das-dashboard/backend/services_init.py
  • das-dashboard/backend/shared/enums/das_services.py
  • das-dashboard/backend/shared/exceptions/exception_handlers.py
  • das-dashboard/backend/shared/internal/web_configuration.py
  • das-dashboard/backend/shared/utils/service_inventory.py
  • das-dashboard/src/api/APIUtils.js
  • das-dashboard/src/api/ConfigAPI.js
  • das-dashboard/src/api/DashboardAPI.js
  • das-dashboard/src/api/ServicesAPI.js
  • das-dashboard/src/components/dashboard/ArchitectureView/ArchitectureView.jsx
  • das-dashboard/src/components/dashboard/ArchitectureView/utils/constants.js
  • das-dashboard/src/components/dashboard/MainContent/servicestable/AgentRow.jsx
  • das-dashboard/src/components/dashboard/MainContent/servicestable/ServicesTable.jsx
  • das-dashboard/src/components/dashboard/MainContent/sidebar/ArchitectureActionControl.jsx
  • das-dashboard/src/components/dashboard/MainContent/sidebar/AtomDBActionControl.jsx
  • das-dashboard/src/components/dashboard/MainContent/sidebar/SideBar.jsx
  • das-dashboard/src/components/global_providers/DashboardContextProvider.jsx
  • das-dashboard/src/components/global_providers/ServerTabMetricsProvider.jsx
  • das-dashboard/src/hooks/useArchitectureTabMetrics.js
  • das-dashboard/src/hooks/useServerTabMetrics.js
  • das-dashboard/src/pages/setup_das/SetupDas.jsx
  • das-dashboard/src/utils/infraStatus.js
  • das-dashboard/src/utils/serviceInventory.js
  • das-dashboard/src/utils/serviceRows.js
💤 Files with no reviewable changes (10)
  • das-dashboard/src/components/dashboard/ArchitectureView/utils/constants.js
  • das-dashboard/backend/services/config_services.py
  • das-dashboard/backend/shared/enums/das_services.py
  • das-dashboard/src/utils/serviceInventory.js
  • das-dashboard/src/api/ConfigAPI.js
  • das-cli/tests/integration/test_link_creation_agent.bats
  • das-cli/tests/integration/test_evolution_agent.bats
  • das-cli/tests/integration/test_inference_agent.bats
  • das-cli/tests/integration/test_logs.bats
  • das-cli/tests/integration/test_context_broker.bats

Comment thread das-cli/src/commands/link_creation_agent/lca_docs.py Outdated
Comment thread das-cli/src/common/bus_node/busnode_command_registry.py
Comment thread das-cli/src/common/bus_node/busnode_command_registry.py
Comment thread das-dashboard/backend/controllers/container_controllers.py
Comment thread das-dashboard/backend/services/dashboard_services.py
Comment thread das-dashboard/src/hooks/useArchitectureTabMetrics.js
Comment thread das-dashboard/src/pages/setup_das/SetupDas.jsx
Comment thread das-dashboard/src/utils/serviceRows.js

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
das-dashboard/src/pages/setup_das/SetupDas.jsx (1)

102-116: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Do not replace the refresh-failure warning with a success toast.

ToastProvider stores one toast. Each flow shows a warning, then immediately shows a success toast. The success toast replaces the warning. The user can see a successful configuration operation while dashboard state remains stale.

  • das-dashboard/src/pages/setup_das/SetupDas.jsx#L102-L116: Store the refresh failure and emit one warning toast instead of the subsequent save-success toast.
  • das-dashboard/src/pages/setup_das/SetupDas.jsx#L178-L189: Store the refresh failure and emit one warning toast instead of the subsequent load-success toast.

Add save and load tests that reject getInitialState() and assert that the final visible toast is the warning.

#!/bin/bash
set -euo pipefail

ast-grep outline das-dashboard/src/components/global_providers/ToastProvider.jsx --items all

rg -n -C 5 'showToast\s*=|setToast' \
  das-dashboard/src/components/global_providers/ToastProvider.jsx

rg -n -C 8 \
  'Configuration saved, but dashboard state could not be refreshed|Configuration saved successfully|Configuration loaded, but dashboard state could not be refreshed|Configuration loaded successfully' \
  das-dashboard/src/pages/setup_das/SetupDas.jsx
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@das-dashboard/src/pages/setup_das/SetupDas.jsx` around lines 102 - 116,
Update both save and load flows in SetupDas.jsx (lines 102-116 and 178-189) to
track whether refreshDashboardState failed and show only the corresponding
warning toast when it does, rather than subsequently displaying the save/load
success toast; otherwise preserve the success behavior. Add save and load tests
that reject getInitialState() and assert the final visible toast is the warning.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@das-dashboard/src/components/dashboard/MainContent/sidebar/ArchitectureActionControl.jsx`:
- Line 1: Update the selection-initialization effect around
hasInitializedSelection and availableIds so it does not mark initialization
complete when orchestrationServices is empty; return early while availableIds
has no entries, then initialize the selection from all discovered service IDs on
the first nonempty discovery. Add a test that starts with no machines, supplies
orchestration services, and verifies every discovered service is selected.

---

Outside diff comments:
In `@das-dashboard/src/pages/setup_das/SetupDas.jsx`:
- Around line 102-116: Update both save and load flows in SetupDas.jsx (lines
102-116 and 178-189) to track whether refreshDashboardState failed and show only
the corresponding warning toast when it does, rather than subsequently
displaying the save/load success toast; otherwise preserve the success behavior.
Add save and load tests that reject getInitialState() and assert the final
visible toast is the warning.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: bdcd0a68-d96a-46e5-b26c-dd4acfb9f00e

📥 Commits

Reviewing files that changed from the base of the PR and between 13d6c9b and e62566a.

📒 Files selected for processing (6)
  • das-cli/src/commands/link_creation_agent/lca_docs.py
  • das-cli/src/common/bus_node/busnode_command_registry.py
  • das-cli/src/common/exceptions.py
  • das-dashboard/src/components/dashboard/MainContent/sidebar/ArchitectureActionControl.jsx
  • das-dashboard/src/hooks/useArchitectureTabMetrics.js
  • das-dashboard/src/pages/setup_das/SetupDas.jsx

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