Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

Merge origin/main into fix/mcp-frontend-recovery

Martin Vogelb47386db145d
diff --cc src/main.c
index 29a3f4ecc,3e658c801..0e963eddd
--- a/src/main.c
+++ b/src/main.c
@@@ -3266,43 -3381,34 +3381,46 @@@ int main(int argc, char **argv)
g_daemon_client = bootstrap_result.client;
+ /* Startup requests on the connected client wait within the startup budget,
+ * like the bootstrap before them: a 1 s bound on the reply (a probe budget)
+ * ended the server whenever the daemon's UI save ran long, which the smoke's
+ * `--ui=true --port` run saw as a binary without UI assets. */
- if (role == CBM_DAEMON_PROCESS_MCP_CLIENT &&
- !main_set_client_context(g_daemon_client, NULL, tool_profile, NULL, NULL,
- bootstrap_config.startup_timeout_ms)) {
- (void)fprintf(stderr, "codebase-memory-mcp: daemon session context was rejected\n");
- (void)cbm_daemon_runtime_client_close(g_daemon_client, MAIN_CLOSE_TIMEOUT_MS);
- g_daemon_client = NULL;
- (void)main_version_cohort_close(&client_cohort_lease, &client_cohort_manager);
- return EXIT_FAILURE;
+ char mcp_session_root[MAIN_PATH_CAP] = {0};
+ char mcp_allowed_root[MAIN_PATH_CAP] = {0};
+ const char *mcp_allowed_root_ptr = NULL;
+ if (role == CBM_DAEMON_PROCESS_MCP_CLIENT) {
+ bool context_resolved =
+ main_session_context(NULL, mcp_session_root, mcp_allowed_root, &mcp_allowed_root_ptr);
+ cbm_daemon_runtime_application_status_t context_status =
- context_resolved
- ? cbm_daemon_application_client_set_context(g_daemon_client, mcp_session_root,
- mcp_allowed_root_ptr, tool_profile,
- NULL, NULL, MAIN_CONNECT_TIMEOUT_MS)
- : CBM_DAEMON_RUNTIME_APPLICATION_REJECTED;
++ context_resolved ? cbm_daemon_application_client_set_context(
++ g_daemon_client, mcp_session_root, mcp_allowed_root_ptr,
++ tool_profile, NULL, NULL, bootstrap_config.startup_timeout_ms)
++ : CBM_DAEMON_RUNTIME_APPLICATION_REJECTED;
+ if (context_status != CBM_DAEMON_RUNTIME_APPLICATION_OK) {
+ (void)fprintf(stderr, "codebase-memory-mcp: daemon session context was rejected\n");
+ (void)cbm_daemon_runtime_client_close(g_daemon_client, MAIN_CLOSE_TIMEOUT_MS);
+ g_daemon_client = NULL;
+ cbm_daemon_ipc_endpoint_free(endpoint);
+ (void)main_version_cohort_close(&client_cohort_lease, &client_cohort_manager);
+ return EXIT_FAILURE;
+ }
}
/* Persist UI mutations only after the exact-build HELLO succeeds. A
* conflicting binary must be observationally read-only: applying its
* flags before bootstrap could reconfigure the already-running daemon
* even though that client was then rejected. */
+ bool mcp_ui_enabled = false;
+ int mcp_ui_port = 0;
+ uint8_t mcp_ui_update_mask = 0;
if (role == CBM_DAEMON_PROCESS_MCP_CLIENT && cbm_mcp_tool_profile_allows_http(tool_profile)) {
- bool ui_enabled = false;
- int ui_port = 0;
bool explicitly_enabled = false;
- uint8_t update_mask =
- parse_ui_flags(argc, argv, &ui_enabled, &ui_port, &explicitly_enabled);
- if (update_mask != 0 &&
+ mcp_ui_update_mask =
+ parse_ui_flags(argc, argv, &mcp_ui_enabled, &mcp_ui_port, &explicitly_enabled);
+ if (mcp_ui_update_mask != 0 &&
cbm_daemon_application_client_set_ui_config(
- g_daemon_client, update_mask, ui_enabled, ui_port,
+ g_daemon_client, mcp_ui_update_mask, mcp_ui_enabled, mcp_ui_port,
- MAIN_CONNECT_TIMEOUT_MS) != CBM_DAEMON_RUNTIME_APPLICATION_OK) {
+ bootstrap_config.startup_timeout_ms) != CBM_DAEMON_RUNTIME_APPLICATION_OK) {
(void)fprintf(stderr, "codebase-memory-mcp: daemon UI configuration update failed\n");
(void)cbm_daemon_runtime_client_close(g_daemon_client, MAIN_CLOSE_TIMEOUT_MS);
g_daemon_client = NULL;