Skip to content

Implement new control API - #489

Open
danth wants to merge 11 commits into
eclipse-score:mainfrom
etas-contrib:control-api
Open

Implement new control API#489
danth wants to merge 11 commits into
eclipse-score:mainfrom
etas-contrib:control-api

Conversation

@danth

@danth danth commented Aug 18, 2026

Copy link
Copy Markdown
Member

This pull request adapts the launch manager (and tests) to use the new control API based on mw::com, and removes the old API.

Notable points

  • The State_Manager application type is now aliased to Reporting_and_Supervised.

    Instead, mw::com access control must be used to prevent unwanted processes acting as state managers.

  • There is a workaround to make the process_fd_leak test pass, because there is no possibility to set O_CLOEXEC on mw::com's file descriptors when they are created.

    I've opened an issue to fix this upstream: Set CLOEXEC on file descriptors communication#1064

  • External documentation needs to be updated before this is released.

Relevant issues

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.7.0) and connecting to it...
INFO: Invocation ID: 888f0780-f607-43de-9fe8-7fb3cd200f21
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //:license-check (51 packages loaded, 10 targets configured)

Analyzing: target //:license-check (88 packages loaded, 10 targets configured)

Analyzing: target //:license-check (144 packages loaded, 737 targets configured)

Analyzing: target //:license-check (156 packages loaded, 4383 targets configured)

Analyzing: target //:license-check (158 packages loaded, 8562 targets configured)

Analyzing: target //:license-check (163 packages loaded, 9368 targets configured)

Analyzing: target //:license-check (169 packages loaded, 9541 targets configured)

Analyzing: target //:license-check (172 packages loaded, 11426 targets configured)

INFO: Analyzed target //:license-check (173 packages loaded, 11555 targets configured).
[12 / 16] Creating runfiles tree bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/score_tooling+/dash/tool/formatters/dash_format_converter.runfiles [for tool]; 0s local ... (2 actions, 1 running)
INFO: Found 1 target...
Target //:license.check.license_check up-to-date:
  bazel-bin/license.check.license_check
  bazel-bin/license.check.license_check.jar
INFO: Elapsed time: 25.810s, Critical Path: 0.69s
INFO: 16 processes: 4 disk cache hit, 12 internal.
INFO: Build completed successfully, 16 total actions
INFO: Running command line: bazel-bin/license.check.license_check ./formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

@danth
danth requested a deployment to workflow-approval August 18, 2026 13:40 — with GitHub Actions Waiting
@danth
danth requested a deployment to workflow-approval August 18, 2026 13:40 — with GitHub Actions Waiting
@danth
danth requested a deployment to workflow-approval August 18, 2026 13:42 — with GitHub Actions Waiting
@danth
danth requested a deployment to workflow-approval August 18, 2026 13:42 — with GitHub Actions Waiting
@danth
danth requested a deployment to workflow-approval August 19, 2026 08:17 — with GitHub Actions Waiting
@danth
danth requested a deployment to workflow-approval August 19, 2026 08:17 — with GitHub Actions Waiting
@danth
danth requested a deployment to workflow-approval August 19, 2026 10:01 — with GitHub Actions Waiting
@danth
danth requested a deployment to workflow-approval August 19, 2026 10:01 — with GitHub Actions Waiting
@danth
danth requested a deployment to workflow-approval August 19, 2026 13:33 — with GitHub Actions Waiting
@danth
danth requested a deployment to workflow-approval August 19, 2026 13:33 — with GitHub Actions Waiting
@danth
danth requested a deployment to workflow-approval August 21, 2026 15:00 — with GitHub Actions Waiting
@danth
danth requested a deployment to workflow-approval August 21, 2026 15:00 — with GitHub Actions Waiting
Comment thread score/launch_manager/src/daemon/src/process_group_manager/control_provider.cpp Outdated
Comment thread score/launch_manager/src/daemon/src/process_group_manager/control_provider.cpp Outdated
Comment thread score/launch_manager/src/daemon/src/control/control_provider.hpp
Comment thread score/launch_manager/src/daemon/src/control/icontrollable_graph.hpp
Comment thread tests/integration/crash_on_startup/crash_on_startup.json Outdated

@WilliamRoebuck WilliamRoebuck 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.

A really great implementation, I have some small cleanup suggestions. I also rambled a bit about the API but I understand I may be a bit late on this so apologies if it's not relevant. As I'll be away from tomorrow, just comment and resolve if you disagree or I've misunderstood

Comment thread score/launch_manager/src/daemon/src/process_group_manager/control_provider.cpp Outdated
Comment thread score/launch_manager/src/daemon/src/process_group_manager/control_provider.cpp Outdated
// workaround to detect we're in fallback
// This verifies that a fallback process was actually started - the launch manager
// did not just send an event without taking the action.
EXPECT_TRUE(std::filesystem::exists(fallback_file)) << "Fallback run target was not activated";

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.

Can we just use get_active_run_target() here? Rather than repeating this step each test, we could have a single test to verify that a component configured to launch in fallback actually launched

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I tried to make minimal changes from the old tests, but this can be cleaned up.

I think we should have a separate test which makes sure that the callbacks are telling the truth, then no further verification is needed in the other tests.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think these improvements could be done in a separate pull request, so long as the tests are passing in their current state. :))

Comment thread tests/utils/test_helper/test_helper.hpp
Comment thread examples/control_application/control_daemon.cpp
case fb::ApplicationType::Reporting_And_Supervised:
return ApplicationType::ReportingAndSupervised;
case fb::ApplicationType::State_Manager:
return ApplicationType::StateManager;

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.

I would recommend to translate fb::ApplicationType::State_Manager into ApplicationType::ReportingAndSupervised until we remove State_Manager from configuration schema.

Additionally we probably need to create work item to change configuration schema and to adapt translation script scripts/config_mapping/lifecycle_config.py

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I have reverted the removal for now, and we just translate it to Reporting_and_Supervised. See also.

const ActivateRunTargetRequest& request)
{
SCORE_LANGUAGE_FUTURECPP_ASSERT_PRD_MESSAGE(
request.mode == ActivationMode::kForced, "Only ActivationMode::kForced is implemented");

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.

If we don't have a work item already, we should create one.

The queue is the intended mode and forced flag should be used sparingly...

Comment thread examples/control_application/control_daemon.cpp Outdated
Comment thread score/launch_manager/src/daemon/src/control/icontrollable_graph.hpp Outdated
Comment thread score/launch_manager/src/daemon/src/control/icontrollable_graph.hpp Outdated
Comment thread score/launch_manager/src/daemon/src/control/BUILD Outdated
{
const auto instance_specifier_result =
InstanceSpecifier::Create(std::string{"LaunchManager/StateManager/Instance"});
SCORE_LANGUAGE_FUTURECPP_ASSERT_PRD_MESSAGE(

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.

Could we give this error back to the user, e.g. with an init() method or a Create(..) call?
Then we can log an error in main and cleanly shutdown the process.

I suspect people run into this problem frequently when they first try to start LM without a mw::com config file that has this exact instance specifier defined. Then it would be more user friendly to have a nice error message instead of crashing on an assertion.

instance_specifier_result.has_value(), instance_specifier_result.error().Message().data());

auto skeleton_result = LmControlSkeleton::Create(instance_specifier_result.value());
SCORE_LANGUAGE_FUTURECPP_ASSERT_PRD_MESSAGE(skeleton_result.has_value(), skeleton_result.error().Message().data());

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.

Same here, I would also pass this back to main and log a nice error with more context.
E.g. Failed to setup mw::com communication for LmControl service...Error: <mw::com error>

namespace score::mw::lifecycle::internal
{

class ControlProvider

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.

Maybe we can do it as a subsequent step in another PR to not block this one, but we should think how we can restructure the class so we can unit test it. I am not sure if we can provoke all the error cases without having some mocking mechanism in place.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I have been working on some unit tests locally... I think if we could somehow call the handle_ methods directly in the test, then it would be fairly simple to check their behaviour independently from mw::com. I'm not sure the best way to structure that though, as just marking them public would not be ideal.

Result<IdentifierHash> ProcessGroupManager::get_active_run_target() const
{
return &process_interface_;
auto promise = concurrency::InterruptiblePromise<Result<IdentifierHash>>{};

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.

If I remember correctly the Future/Promise from Score baselibs requires heap allocation. In that case we cannot really use this at runtime.

However, for this initial implementation I think it is still fine and we can exchange this later to not add too much complexity within this PR. Its a nice clean implementation using future promise.

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

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Initial implementation of mw::com-based control API (daemon) Create a design for using mw::com for Control API

5 participants