Skip to content

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Oct 30, 2025

What does this PR do?

It makes the coordinator responsible for creating and removing the working directories of components. Until now, CommandRuntime and ServiceRuntime did this on their own, whereas the OtelManager didn't do it at all. We move the logic for creating and removing the directories into the component module itself, and call it from the Coordinator. The new logic is as follows.

  • When we generate a new component model, we ensure each component has a working directory.
  • When we get a STOPPED state for a component AND that component is not present in the component model, we delete its working directory.

The condition that the component must not be present in the current model fixes an issue where the working directory would be deleted when the component was being moved between runtimes.

Why is it important?

  1. Currently, the Otel runtime does not remove the working directories at all. The behavior should be the same no matter where the component runs.
  2. If a component is moved from the process runtime to the otel runtime, its working directory is incorrectly deleted. This causes filestream to re-ingest all logs, for example.

Note that I've included an integration test from #10544, which specifically checks point 2 from above.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • I have added an integration test or an E2E test

How to test this PR locally

Related issues


This is an automatic backport of pull request #10857 done by [Mergify](https://mergify.com).

@mergify mergify bot requested a review from a team as a code owner October 30, 2025 14:25
@mergify mergify bot added the backport label Oct 30, 2025
@mergify mergify bot requested review from blakerouse and pchila and removed request for a team October 30, 2025 14:25
@github-actions github-actions bot added bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team labels Oct 30, 2025
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

* Move component setup and teardown code to the Component struct

* Move teardown to coordinator

* Integration test to check data re-ingest when switching runtimes

* Add integration test for component working dirs

* Check workdir creation time in tests

* Fix linter warnings

* Fix a minor issue in endpoint integration tests

* Add changelog entry

* Completely remove workdir handling from command runtime

* Fix changelog summary

* Use fleet in the integration test

---------

Co-authored-by: Lee E. Hinman <[email protected]>
(cherry picked from commit 41fd24f)
@swiatekm swiatekm force-pushed the mergify/bp/9.2/pr-10857 branch from 23d2c32 to 4c3a49d Compare October 30, 2025 17:37
@elasticmachine
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

History

cc @swiatekm

@cmacknz cmacknz merged commit 720085f into 9.2 Oct 30, 2025
21 checks passed
@cmacknz cmacknz deleted the mergify/bp/9.2/pr-10857 branch October 30, 2025 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants