embed control center deletes profiles even when daemon or UI shutdown fails
Bug Description
Deleting a profile through the embed control center ignores the return values of both daemon_client.stop_daemon and daemon_client.stop_ui. Even when either reports failure, the service deletes the profile configuration, logs, lock files, discovery metadata, and active-profile selection, then returns ok: true. A still-running process loses the profile state needed to diagnose and retry shutdown.
Steps to Reproduce
- Create and select a named embed profile, with a running daemon or control-plane UI.
- Arrange for that component's shutdown to fail (the manager returns
Falsewhen it cannot stop the process/listener). - Click Delete in the embed control center, or POST
/api/profiles/<name>/deletewith the control token. - Check the response and profile files.
Deterministic reproduction uses the real ControlCenterHandler on a loopback socket: create a named profile with a log and active selection, report the component as running, make its stop method return False, then submit Delete. Both daemon-failure and UI-failure regressions reproduce the problem.
Expected Behavior
Return ok: false with the failing component identified and preserve the profile configuration, logs, metadata, and active selection so the user can diagnose and retry.
Actual Behavior
The endpoint returns ok: true and removes the profile despite the shutdown failure.
Version
1.1.0, commit 5a672f0cdb89f4a3b841770cce2036a5b28b799d
LLM Provider
Not applicable. Windows, Python 3.11.9; real control-center HTTP socket tests with daemon/UI shutdown mocked. No LLM/database required.
Diagnosis and proposed fix
Check shutdown results and return a failed ProfileDeleteResult before calling ProfileManager.delete_profile. This differs from the Stop/Restart health-gating report: here shutdown is called, returns failure, and deletion ignores it.
Fix pushed to Web4everyone32/hindsight branch fix/control-center-preserve-profile-on-stop-failure. Both regression cases fail before the fix; the fixed control-center suite passes 48 tests.
I prepared a fix to preserve profiles when daemon or UI shutdown fails in PR #3 on my fork. Regression tests cover both shutdown failures, and all 48 control-center tests pass. Would a maintainer consider reviewing or cherry-picking this fix?