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

perf(health): defer code review health imports (#7783)

[._.]/ Adam Eivy8fc34cfc4d39
diff --git a/server/routes/health.test.js b/server/routes/health.test.js
index 08b0aa3368..30626732ae 100644
--- a/server/routes/health.test.js
+++ b/server/routes/health.test.js
@@ -11,7 +11,6 @@ import { checkGhHealth } from '../services/github.js';
import { getBuildIdentity } from '../lib/buildIdentity.js';
import { getSettings, updateSettingsWith } from '../services/settings.js';
import { statfs } from 'fs/promises';
-import { getReviewerConfigHealth } from '../services/codeReview.js';
vi.mock('../services/pm2.js', () => ({
listProcesses: vi.fn().mockResolvedValue([])
@@ -111,6 +110,8 @@ vi.mock('../services/settings.js', () => ({
})
}));
+const { getReviewerConfigHealth } = await import('../services/codeReview.js');
+
describe('System Health Routes', () => {
const app = express();
app.use(express.json());
diff --git a/server/routes/systemHealth.js b/server/routes/systemHealth.js
index 876f2b9d99..1eb05cc908 100644
--- a/server/routes/systemHealth.js
+++ b/server/routes/systemHealth.js
@@ -20,7 +20,6 @@ import { getActiveProcessing } from '../services/activeProcessing.js';
import { getMediaCapacity } from '../services/mediaCapacity.js';
import { runningAgentsByTaskId, unclaimedTaskIds } from '../lib/cosSpawnWindow.js';
import { getBuildIdentity } from '../lib/buildIdentity.js';
-import { getReviewerConfigHealth } from '../services/codeReview.js';
// Defaults are tuned for a real dev machine: memory routinely sits in the
// 75-85% band on a host with a couple of LLMs loaded, and big SSDs commonly
@@ -154,7 +153,9 @@ router.get('/health/details', asyncHandler(async (req, res) => {
// Media-lane capacity never fails the health report: an unreadable GPU probe
// degrades to `null`, which the UI renders as unknown rather than as idle.
getMediaCapacity().catch(() => null),
- getReviewerConfigHealth().catch(() => ({ status: 'unknown', configFaults: {} }))
+ import('../services/codeReview.js')
+ .then(({ getReviewerConfigHealth }) => getReviewerConfigHealth())
+ .catch(() => ({ status: 'unknown', configFaults: {} }))
]);
const { thresholds, dismissedWarnings } = healthSettings;