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: isolate canceled settings reads from shared bootstrap requests

[._.]/ Adam Eivy9d3895777648
diff --git a/client/src/services/apiCore.js b/client/src/services/apiCore.js
index f09788548f..a1aec460cc 100644
--- a/client/src/services/apiCore.js
+++ b/client/src/services/apiCore.js
@@ -63,6 +63,9 @@ const inflightReads = new Map();
// Options that change error handling are part of the key, so a silent caller never
// joins (or starts) a flight whose failure toasts, and vice versa.
export function singleFlightRead(endpoint, start, options = {}) {
+ // A caller owns its signal's lifetime; aborting it must not cancel another
+ // consumer's read or make a remount join the request its cleanup just aborted.
+ if (options.signal) return start();
const key = `${endpoint}|silent:${!!options.silent}|hco:${!!options.hostControlOptional}`;
let pending = inflightReads.get(key);
if (!pending) {
diff --git a/client/src/services/apiCore.test.js b/client/src/services/apiCore.test.js
index 76c80e7438..88a2f2faa9 100644
--- a/client/src/services/apiCore.test.js
+++ b/client/src/services/apiCore.test.js
@@ -180,6 +180,26 @@ describe('shell bootstrap reads are single-flight', () => {
expect(toast.error).toHaveBeenCalledTimes(1);
});
+ it('isolates a caller-owned abort from concurrent shared bootstrap readers', async () => {
+ global.fetch.mockImplementation((_url, { signal }) => {
+ if (!signal) return Promise.resolve(makeResponse({ status: 200, ok: true, json: { theme: 'classic-midnight' } }));
+ return new Promise((_resolve, reject) => {
+ signal.addEventListener('abort', () => reject(new DOMException('Aborted', 'AbortError')), { once: true });
+ });
+ });
+ const controller = new AbortController();
+ const abandoned = getSettings({ silent: true, signal: controller.signal }).catch((err) => err);
+ const readers = Promise.allSettled([getSettings({ silent: true }), getSettings({ silent: true })]);
+ controller.abort();
+
+ await expect(readers).resolves.toEqual([
+ { status: 'fulfilled', value: { theme: 'classic-midnight' } },
+ { status: 'fulfilled', value: { theme: 'classic-midnight' } },
+ ]);
+ await expect(abandoned).resolves.toMatchObject({ code: 'SERVER_UNREACHABLE' });
+ expect(global.fetch).toHaveBeenCalledTimes(2);
+ });
+
it('does not cache a failure', async () => {
global.fetch.mockResolvedValueOnce(makeResponse({ status: 500, json: { error: 'boom' } }));
await expect(getSettings({ silent: true })).rejects.toMatchObject({ status: 500 });