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

pin the two endpoint-parsing divergences and the cold-cache provider payload (#4611)

[._.]/ Adam Eivy515475cef59a
diff --git a/server/lib/providerPrerequisites.js b/server/lib/providerPrerequisites.js
index fac62acf38..e2a687118e 100644
--- a/server/lib/providerPrerequisites.js
+++ b/server/lib/providerPrerequisites.js
@@ -90,10 +90,16 @@ const endpointHost = (endpoint) => {
* in lockstep. A host that cannot be parsed reads as NOT private, keeping the
* stricter of the two answers for input we don't understand.
*
- * The two disagree only on compact loopback spellings (`http://127.1`), which
- * `URL` expands and the client's cheap regex does not. That no longer reaches
- * the card: the client consumes THIS answer when the server publishes one, and
- * falls back to its own regex only against a server too old to publish.
+ * The two disagree only where the client's cheap regex and a real URL parser
+ * read a host differently, and in both directions THIS answer is the one that
+ * reaches the card (the client consumes it when the server publishes, falling
+ * back to its own regex only against a server too old to publish):
+ * - `http://127.1` — `URL` expands the compact form to `127.0.0.1` and this
+ * calls it private; the client's four-octet regex does not. Node's own
+ * fetch expands it the same way, so private is the correct answer.
+ * - `http://::1:11434` — an IPv6 literal without brackets, which `URL`
+ * rejects and the client regex accepts. Unparseable reads as NOT private
+ * here, per the rule above; nothing can connect to that endpoint anyway.
*/
export const isPrivateNetworkEndpoint = (endpoint) => {
const host = endpointHost(endpoint);
diff --git a/server/lib/providerPrerequisites.test.js b/server/lib/providerPrerequisites.test.js
index 2ce79097ef..501693966a 100644
--- a/server/lib/providerPrerequisites.test.js
+++ b/server/lib/providerPrerequisites.test.js
@@ -63,6 +63,17 @@ describe('isPrivateNetworkEndpoint', () => {
])('treats %s as NOT private', (endpoint) => {
expect(isPrivateNetworkEndpoint(endpoint)).toBe(false);
});
+
+ // The two documented places this parser and the client's cheap regex read a
+ // host differently. Pinned so a future edit to either has to decide about
+ // them rather than flip one by accident.
+ it('expands a compact loopback form the client regex misses', () => {
+ expect(isPrivateNetworkEndpoint('http://127.1:11434')).toBe(true);
+ });
+
+ it('rejects an IPv6 literal without brackets, which no client can connect to anyway', () => {
+ expect(isPrivateNetworkEndpoint('http://::1:11434')).toBe(false);
+ });
});
describe('providerPrerequisites', () => {
diff --git a/server/routes/providers.prerequisites.test.js b/server/routes/providers.prerequisites.test.js
index 63573618be..68aba47783 100644
--- a/server/routes/providers.prerequisites.test.js
+++ b/server/routes/providers.prerequisites.test.js
@@ -13,6 +13,7 @@ vi.mock('../services/providerRuntimeInstaller.js', async (importOriginal) => ({
})),
}));
+const { peekProviderRuntimeStatuses } = await import('../services/providerRuntimeInstaller.js');
const { createPortOSProviderRoutes } = await import('./providers.js');
const CODEX = { id: 'codex', name: 'Codex CLI', type: 'cli', command: 'codex', envVars: {} };
@@ -61,6 +62,18 @@ describe('#4611: GET /api/providers publishes each provider\'s prerequisites', (
expect(byId.openai.hasApiKey).toBe(true);
});
+ // The route never awaits the probe — a cold cache must publish NO runtime
+ // finding rather than an accusation, and the page's own /runtimes fetch fills
+ // that gap on the card.
+ it('publishes an empty finding list on a cold runtime cache', async () => {
+ peekProviderRuntimeStatuses.mockReturnValueOnce({});
+
+ const byId = providersById(await request(appWith([CODEX])).get('/api/providers'));
+
+ expect(byId.codex.prerequisitesMet).toBe(true);
+ expect(byId.codex.missingPrerequisites).toEqual([]);
+ });
+
it('still strips secrets and keeps the existing decorations', async () => {
const byId = providersById(await request(appWith([CODEX])).get('/api/providers'));