#2144 user decision: refuse async where the job would certainly die with its * requester. A temporary (non-permanent) daemon stops and cancels every job * when its final live session ends. The one-shot tool channel (`cli ...`) * closes its session right after the reply, so if it is the only live session * the job is doomed. A long-lived MCP session - the IDE case this exists for - * stays con
| 2759 | * stays connected and is a valid host even when it is the only one, as is any |
| 2760 | * other live session and every permanent (`daemon start`) generation. */ |
| 2761 | static bool application_async_host_missing(cbm_daemon_application_session_t *session) { |
| 2762 | cbm_daemon_application_t *application = session->application; |
| 2763 | cbm_mutex_lock(&application->mutex); |
| 2764 | bool other_live_session = false; |
| 2765 | for (cbm_daemon_application_session_t *other = application->sessions; |
| 2766 | other && !other_live_session; other = other->next) { |
| 2767 | other_live_session = other != session && !other->session_cancelled; |
| 2768 | } |
| 2769 | bool missing = !application->permanent && session->one_shot_request && !other_live_session; |
| 2770 | cbm_mutex_unlock(&application->mutex); |
| 2771 | return missing; |
| 2772 | } |
| 2773 | |
| 2774 | /* index_repository(async: true) (#2144): start or join the project's job and |
| 2775 | * return at once. The application keeps one subscriber reference until the |
no test coverage detected