From 5ed6ec411eaf8e9f575249c2662479dc0684b0d4 Mon Sep 17 00:00:00 2001 From: Filsommer Date: Fri, 9 Oct 2026 14:38:06 +0300 Subject: [PATCH] Keep assistantd enabled to stop a Spotlight memory leak On a never-booted simulator slimmed offline, disabling com.apple.assistantd (the only vendor of com.apple.assistant.dictation) makes Spotlight's search header loop on dictation availability and leak memory without bound (~20-115 MB/s). Keep it enabled via the siri category's AlwaysEnabled, like gamed in #57; re-running `simslim on` repairs devices slimmed earlier. Co-Authored-By: Claude Opus 5.5 --- cmd/simslim/wizard_test.go | 2 +- profiles.go | 7 ++++++- profiles_test.go | 30 ++++++++++++++++++++++++++++++ service_descriptions.go | 1 - status_test.go | 6 +++--- 5 files changed, 40 insertions(+), 6 deletions(-) diff --git a/cmd/simslim/wizard_test.go b/cmd/simslim/wizard_test.go index 71010fa..53fef3a 100644 --- a/cmd/simslim/wizard_test.go +++ b/cmd/simslim/wizard_test.go @@ -71,7 +71,7 @@ func TestRunProfileWizard(t *testing.T) { // Drill into siri (row 2), keep its first daemon, back out, save. name: "drill in keeps an individual daemon", input: "\n\n" + arrowDown + arrowRight + space + arrowLeft + enter, - wantKeep: []string{"com.apple.assistantd"}, + wantKeep: []string{"com.apple.assistant_cdmd"}, }, { // A kept daemon is dropped when its whole feature is also kept. diff --git a/profiles.go b/profiles.go index 4944da2..9599cc7 100644 --- a/profiles.go +++ b/profiles.go @@ -49,7 +49,6 @@ var Categories = []Category{ Downside: "Siri, speech features, and Apple Intelligence services are unavailable.", ApproxMemoryMB: 265, Labels: []string{ - "com.apple.assistantd", "com.apple.assistant_cdmd", "com.apple.assistant_service", "com.apple.siriactionsd", @@ -79,6 +78,12 @@ var Categories = []Category{ "com.apple.parsec-fbf", "com.apple.proactiveeventtrackerd", }, + AlwaysEnabled: []AlwaysEnabledService{ + { + Label: "com.apple.assistantd", + Reason: "Hosts the dictation service; without it the system Spotlight app leaks memory.", + }, + }, }, { ID: "search", diff --git a/profiles_test.go b/profiles_test.go index d1d02e5..2e91828 100644 --- a/profiles_test.go +++ b/profiles_test.go @@ -185,6 +185,36 @@ func TestGamedStaysEnabledForXCTest(t *testing.T) { } } +func TestAssistantdStaysEnabledForSpotlight(t *testing.T) { + const label = "com.apple.assistantd" + desired := (Profile{}).Desired() + if SlimmableSet()[label] || desired[label] { + t.Error("assistantd must stay enabled: without its dictation service Spotlight leaks memory") + } + siri, ok := CategoryByID("siri") + if !ok { + t.Fatal("siri category is missing") + } + found := false + for _, service := range siri.AlwaysEnabled { + if service.Label == label && strings.TrimSpace(service.Reason) != "" { + found = true + } + } + if !found { + t.Error("siri must explain why assistantd stays enabled") + } + _, toEnable := delta(map[string]bool{label: true}, desired, managedSet()) + if !reflect.DeepEqual(toEnable, []string{label}) { + t.Errorf("legacy disabled assistantd repair = %v, want [%s]", toEnable, label) + } + for _, other := range []string{"com.apple.assistant_service", "com.apple.corespeechd", "com.apple.siriknowledged"} { + if !desired[other] { + t.Errorf("other Siri service %q should remain slimmable", other) + } + } +} + func TestCategoriesHaveUserImpactMetadata(t *testing.T) { for _, c := range Categories { if c.Downside == "" { diff --git a/service_descriptions.go b/service_descriptions.go index c45a3d4..f39fc57 100644 --- a/service_descriptions.go +++ b/service_descriptions.go @@ -11,7 +11,6 @@ var serviceDescriptionByLabel = map[string]string{ "com.apple.liveactivitiesd": "Updates Live Activities and Dynamic Island content.", // Siri & Intelligence - "com.apple.assistantd": "Coordinates Siri requests and assistant state.", "com.apple.assistant_cdmd": "Routes commands and intents submitted to Siri.", "com.apple.assistant_service": "Provides supporting services for Siri requests.", "com.apple.siriactionsd": "Executes Siri actions and App Intents.", diff --git a/status_test.go b/status_test.go index 6926dea..3650571 100644 --- a/status_test.go +++ b/status_test.go @@ -10,7 +10,7 @@ func TestDroppedCategories(t *testing.T) { disabled := map[string]bool{ search.Labels[0]: true, search.Labels[1]: true, - "com.apple.assistantd": true, + "com.apple.assistant_cdmd": true, "com.apple.not-a-managed-d": true, } @@ -26,8 +26,8 @@ func TestDroppedCategories(t *testing.T) { if labels := byID["search"].Labels; len(labels) != 2 { t.Errorf("search dropped labels = %v, want 2", labels) } - if labels := byID["siri"].Labels; len(labels) != 1 || labels[0] != "com.apple.assistantd" { - t.Errorf("siri dropped labels = %v, want [com.apple.assistantd]", labels) + if labels := byID["siri"].Labels; len(labels) != 1 || labels[0] != "com.apple.assistant_cdmd" { + t.Errorf("siri dropped labels = %v, want [com.apple.assistant_cdmd]", labels) } for _, c := range got { if c.Downside == "" {