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: load GitHub secret settings only when needed (#6970)

[._.]/ Adam Eivy47664889c7f9
diff --git a/server/lib/importScoping.test.js b/server/lib/importScoping.test.js
index 0bb1eb75af..3db1ed1fe9 100644
--- a/server/lib/importScoping.test.js
+++ b/server/lib/importScoping.test.js
@@ -38,6 +38,8 @@ const reaches = (entry, target) => staticImportClosure(abs(entry)).files.has(abs
// Each row: the entry that was narrowed, the module it must no longer
const NARROWED = [
+ ['services/github.js', 'services/settings.js',
+ 'loads settings only for secret operations, not repository reads or sync'],
['services/sharing/peerSyncPush.js', 'services/writersRoom/bibleSync.js',
'loads bible asset handling only for Writers Room work pushes'],
['services/sharing/peerSyncReceive.js', 'services/writersRoom/bibleSync.js',
diff --git a/server/services/datadog.js b/server/services/datadog.js
index 6d852a69f8..72334bb687 100644
--- a/server/services/datadog.js
+++ b/server/services/datadog.js
@@ -33,6 +33,7 @@ export async function getInstances() {
// instance-feature registry uses to decide whether the DataDog nav entries
// should appear before the user has toggled the feature explicitly.
//
+// Detection suppresses reader logging because its caller records the failure.
// Like getInstances(), `strict` makes a PRESENT-but-corrupt config
// throw instead of reading as the empty default, so the caller records
// "detection failed" and falls back to the shipped default rather than a
diff --git a/server/services/github.js b/server/services/github.js
index 0e82f62aa2..e469177785 100644
--- a/server/services/github.js
+++ b/server/services/github.js
@@ -5,7 +5,6 @@ import { withSpawnCwdEnv } from '../lib/spawnCwd.js';
import { ServerError } from '../lib/errorHandler.js';
import { createFileWriteQueue } from '../lib/fileWriteQueue.js';
import { createMutex } from '../lib/asyncMutex.js';
-import { getSettings, updateSettings } from './settings.js';
import { dispatchHintFromLabels } from '../lib/dispatchLabels.js';
const DATA_DIR = PATHS.data;
@@ -372,6 +371,8 @@ export async function setSecret(name, value) {
const accountData = await load();
await requireActiveCachedAccount(accountData);
+ // Secret operations alone need settings; repo reads and sync keep this subtree lazy.
+ const { getSettings, updateSettings } = await import('./settings.js');
// Store value in settings.json (never returned to client)
const settings = await getSettings();
const secrets = settings.secrets || {};
@@ -406,6 +407,7 @@ export async function syncSecretToRepos(name) {
async function syncSecretToReposNow(name) {
const data = await load();
const auth = await requireActiveCachedAccount(data);
+ const { getSettings } = await import('./settings.js');
const settings = await getSettings();
const value = settings.secrets?.[name];
if (!value) throw new ServerError(`No value stored for secret: ${name}`, { status: 400, code: 'SECRET_NOT_CONFIGURED' });