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

fix: unwedge the provider service Refresh catalog and Refresh models buttons

[._.]/ Adam Eivyf6ddc979d57c
diff --git a/server/services/harnesses.js b/server/services/harnesses.js
index bc00c40d83..68724cbf0c 100644
--- a/server/services/harnesses.js
+++ b/server/services/harnesses.js
@@ -396,9 +396,13 @@ async function applyHarnessCatalog(runtime, models, targets) {
* would also spawn an unrelated record's bootstrap CLI, minting a credential
* nobody asked for. The Harnesses page button omits it and refreshes them all.
*
+ * `probeOnly` lists without writing any provider record. A caller already holding
+ * the provider-graph queue (`refreshServiceCatalog`) must use it: every record
+ * write awaits a graph reconcile that queues behind that caller and never returns.
+ *
* @returns {Promise<{ok:boolean, reason?:string, models:string[], updated:string[]}>}
*/
-export async function refreshHarnessModels(id, { run = commandOutput, providerId = null, listModels, ...probeDeps } = {}) {
+export async function refreshHarnessModels(id, { run = commandOutput, providerId = null, listModels, probeOnly = false, ...probeDeps } = {}) {
const runtime = getProviderRuntime(id);
if (!runtime) return { ok: false, reason: 'Unknown harness.', models: [], updated: [] };
// `listModels` is the alternative to `modelsArgs` for a harness whose
@@ -505,7 +509,7 @@ export async function refreshHarnessModels(id, { run = commandOutput, providerId
continue;
}
for (const model of listed) seen.add(model);
- updated.push(...await applyHarnessCatalog(runtime, listed, group.targets));
+ if (!probeOnly) updated.push(...await applyHarnessCatalog(runtime, listed, group.targets));
}
// `reason` rides along on a PARTIAL success too: with one bucket probed per
diff --git a/server/services/harnesses.test.js b/server/services/harnesses.test.js
index 1ba1b382d6..f029863d23 100644
--- a/server/services/harnesses.test.js
+++ b/server/services/harnesses.test.js
@@ -296,6 +296,23 @@ describe('refreshHarnessModels', () => {
expect.objectContaining({ models: ['opencode/big-pickle', 'opencode/mimo-v2.5-free'] }));
});
+ // Catches the service-catalog refresh wedging the provider-graph queue: it
+ // holds that queue while probing, and any record write here awaits a graph
+ // reconcile queued behind it — the button spun forever and every later
+ // graph operation hung until a restart.
+ it('probeOnly lists the models and writes no provider record', async () => {
+ const run = vi.fn(async (command, args) => (args[0] === 'models' ? OPENCODE_MODELS : '1.18.27'));
+ providerService.listProviders.mockResolvedValue([
+ { id: 'plain-cli', type: 'cli', command: 'opencode', models: [] },
+ ]);
+
+ const result = await refreshHarnessModels('opencode', { run, probeOnly: true, ...found });
+
+ expect(result.ok).toBe(true);
+ expect(result.models).toEqual(['opencode/big-pickle', 'opencode/mimo-v2.5-free']);
+ expect(providerService.updateProvider).not.toHaveBeenCalled();
+ });
+
// Catches a card's button spawning an unrelated record's bootstrap CLI —
// minting a credential and hitting its proxy on a click not about it.
it('probes only the clicked record’s bucket when scoped by providerId', async () => {
diff --git a/server/services/providerServices.js b/server/services/providerServices.js
index 0455bd9102..fc165e6094 100644
--- a/server/services/providerServices.js
+++ b/server/services/providerServices.js
@@ -138,7 +138,8 @@ const defaultDeps = () => ({
harnessModels: async (harnessId) => {
const [{ refreshHarnessModels }, { PROVIDER_RUNTIMES }] = await Promise.all([import('./harnesses.js'), import('./providerRuntimeInstaller.js')]);
const runtime = PROVIDER_RUNTIMES.find((row) => row.vendor === harnessId || row.id === harnessId)?.id ?? harnessId;
- return refreshHarnessModels(runtime);
+ // Probe-only: this runs inside the provider-graph queue, where a record write would wait on itself.
+ return refreshHarnessModels(runtime, { probeOnly: true });
},
// Probe-only: the answer lands in the instance catalog, never on the record.
routeModels: (providerId) => requireToolkit().services.providers.fetchProviderModels(providerId),