Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (codex): keep enabled-by-presence for saved new-type entries

[._.]/ Adam Eivyae975080f33b
diff --git a/client/src/components/meatspace/post/PostDrillConfig.jsx b/client/src/components/meatspace/post/PostDrillConfig.jsx
index b61b7d97c2..81d3d7f749 100644
--- a/client/src/components/meatspace/post/PostDrillConfig.jsx
+++ b/client/src/components/meatspace/post/PostDrillConfig.jsx
@@ -89,12 +89,23 @@ const LLM_DRILL_META = {
// persistable state. Without this, a type absent from the saved config renders
// as enabled (via the `enabled !== false` convention) but never enters
// `llmDrillTypes`, so Save would omit it and the launcher — which only
-// enumerates persisted keys — would never surface it in a session. Each type
-// starts from its `defaults` and is overlaid with any saved config value.
+// enumerates persisted keys — would never surface it in a session.
+//
+// A type PRESENT in the saved config keeps the launcher's enabled-by-presence
+// convention: an entry with no `enabled` field is active (`enabled !== false`),
+// so we must NOT let the opt-in default silently flip it off on the next save —
+// we overlay the count/timeLimit defaults only to fill empty inputs and resolve
+// `enabled` to the same boolean the launcher would compute. A type ABSENT from
+// the saved config uses its `defaults.enabled` (the 9 newly-exposed drills are
+// opt-in / disabled; the 5 legacy drills, always present via the server's
+// DEFAULT_CONFIG, are enabled).
function seedLlmDrillTypes(saved) {
const out = {};
for (const [type, meta] of Object.entries(LLM_DRILL_META)) {
- out[type] = { ...meta.defaults, ...(saved?.[type] || {}) };
+ const savedEntry = saved?.[type];
+ out[type] = savedEntry
+ ? { ...meta.defaults, ...savedEntry, enabled: savedEntry.enabled !== false }
+ : { ...meta.defaults };
}
return out;
}
diff --git a/client/src/components/meatspace/post/PostDrillConfig.test.jsx b/client/src/components/meatspace/post/PostDrillConfig.test.jsx
index eccc68eb8a..aa57200b89 100644
--- a/client/src/components/meatspace/post/PostDrillConfig.test.jsx
+++ b/client/src/components/meatspace/post/PostDrillConfig.test.jsx
@@ -98,6 +98,24 @@ describe('PostDrillConfig', () => {
expect(saved['reframe'].enabled).toBe(false);
});
+ it('preserves a saved new-type entry that is active by presence (no enabled field)', async () => {
+ // A config where a newly-exposed drill is present but omits `enabled` —
+ // the launcher treats this as active (enabled !== false). Seeding must not
+ // silently disable it via the opt-in default.
+ const withPresentNewType = {
+ ...config,
+ llmDrills: {
+ ...config.llmDrills,
+ drillTypes: { ...config.llmDrills.drillTypes, 'what-if': { count: 3 } },
+ },
+ };
+ render(<PostDrillConfig config={withPresentNewType} onSaved={vi.fn()} onBack={vi.fn()} />);
+ expect(screen.getByRole('switch', { name: 'What If?' }).getAttribute('aria-checked')).toBe('true');
+ fireEvent.click(screen.getByText('Save'));
+ await waitFor(() => expect(updatePostConfig).toHaveBeenCalled());
+ expect(updatePostConfig.mock.calls[0][0].llmDrills.drillTypes['what-if'].enabled).toBe(true);
+ });
+
it('exposes toggles as accessible switches reflecting on/off state', () => {
render(<PostDrillConfig config={config} onSaved={vi.fn()} onBack={vi.fn()} />);
// Legacy enabled drill → switch checked; newly-exposed drill → unchecked.