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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
Merge pull request #10794 from atomantic/claim/issue-9641
[._.]/e5475f5385f6
diff --cc client/src/test/browserFixture.jsindex cc471feaa0,178ee47381..f8e19a9476--- a/client/src/test/browserFixture.js+++ b/client/src/test/browserFixture.js@@@ -128,12 -231,21 +235,21 @@@ export async function startBrowserFixtu...launchOptions,env: { ...process.env, ...launchOptions.env, TMPDIR: temp, TMP: temp, TEMP: temp },}).then((launched) => {+ settle();if (abandoned) launched.close().catch(() => {});- else own(() => launched.close());+ else own(() => launched.close(), 'browser');return launched;- });- return { launching, abandon: () => { abandoned = true; } };+ }, (error) => { settle(); throw error; });+ const record = () => {+ if (recorded) return;+ recorded = true;+ settle();+ launchFacts.push(facts === undefined ? `attempt ${number}: not sampled` : `attempt ${number} at ${sampleAt}ms: ${facts}`);+ };+ recordTimedOutAttempt = record;+ return { launching, abandon: () => { abandoned = true; record(); } };};+ const describeLaunchFacts = () => (launchFacts.length ? `; launch facts: ${launchFacts.join('; ')}` : '');try {const server = await runPhase('vite', async () => {diff --cc client/src/test/browserFixture.test.jsindex a84f572abd,d6a05a4528..a0dd3ee952--- a/client/src/test/browserFixture.test.js+++ b/client/src/test/browserFixture.test.js@@@ -101,19 -155,49 +155,64 @@@ describe('startBrowserFixture', () =>expect(browser.close).toHaveBeenCalledTimes(1);expect(server.close).toHaveBeenCalledTimes(1);});++ it('bounds close() so a stalled browser teardown rejects naming it, still closes Vite, and removes the temp dir', async () => {+ const { server, createServer } = fakeVite();+ const browser = fakeBrowser({ close: vi.fn(async () => {}) });+ browser.close = vi.fn(() => new Promise(() => {}));+ const chromium = { launch: vi.fn(async () => browser) };+ const fixture = await startBrowserFixture({ name: 'example', createServer, viteConfig: () => SCOPED, chromium, phaseMs: PHASE_MS });+ expect(existsSync(fixture.temp)).toBe(true);++ const error = await fixture.close().catch(caught => caught);++ expect(error.message).toBe('browser close stalled after 50ms');+ expect(server.close).toHaveBeenCalledTimes(1);+ expect(existsSync(fixture.temp)).toBe(false);+ });});++ describe('_observeOwnedBrowserLaunch', () => {+ // A fake /proc: `children` lists per worker thread, and each child's stat.+ const fakeProc = (state) => ({+ list: (path) => {+ if (path !== '/proc/42/task') throw new Error(`unexpected ${path}`);+ return ['42', '43', 'not-a-thread'];+ },+ read: (path) => {+ if (state.unreadable) throw new Error('ENOENT');+ const thread = path.match(/^\/proc\/42\/task\/(\d+)\/children$/);+ if (thread) return `${state.children[thread[1]] ?? ''} `;+ const pid = path.match(/^\/proc\/(\d+)\/stat$/)?.[1];+ if (state.names[pid]) return `${pid} (${state.names[pid]}) S 42 42 42 0 -1`;+ throw new Error('ENOENT');+ },+ });++ it('describes only the browser child this worker spawned for the attempt, without its PID or name', () => {+ const state = { children: { 42: '1100 1200' }, names: { 1100: 'chrome', 1200: 'esbuild', 1300: 'chrome', 1400: 'node' } };+ const processFacts = vi.fn(() => 'os=linux child=uninterruptible');+ const sample = _observeOwnedBrowserLaunch({ platform: 'linux', workerPid: 42, processFacts, ...fakeProc(state) });+ // The earlier attempt's browser (1100) is still exiting; the new one is on another thread.+ state.children = { 42: '1100 1200', 43: '1300 1400' };++ expect(sample()).toBe('browserChildren=1 os=linux child=uninterruptible');+ expect(processFacts).toHaveBeenCalledWith({ pid: 1300, exitCode: null, signalCode: null }, { workerPid: 42 });++ // Two candidates cannot be told apart, and none means nothing was spawned+ // or it already exited: neither is inspected.+ processFacts.mockClear();+ state.children = { 42: '1100', 43: '1300 1500' };+ state.names[1500] = 'headless_shell';+ expect(sample()).toBe('browserChildren=2');+ state.children = { 42: '1100' };+ expect(sample()).toBe('browserChildren=0');+ expect(processFacts).not.toHaveBeenCalled();+ });++ it('reports an unreadable process table as unavailable, never as an empty one', () => {+ const state = { children: {}, names: {}, unreadable: true };+ expect(_observeOwnedBrowserLaunch({ platform: 'linux', workerPid: 42, ...fakeProc(state) })()).toBe('browserChildren=unavailable');+ expect(_observeOwnedBrowserLaunch({ platform: 'darwin' })()).toBe('os=unsupported');+ });+ });