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
test: derive the process-group expectations from the platform, not the POSIX answer
[._.]/ Adam Eivya3be99cc0933
diff --git a/server/lib/credentialBootstrap.test.js b/server/lib/credentialBootstrap.test.jsindex e6ee993660..d1fc587b30 100644--- a/server/lib/credentialBootstrap.test.js+++ b/server/lib/credentialBootstrap.test.js@@ -205,7 +205,7 @@ describe('credentialBootstrap', () => {beforeEach(() => { resetDetachedGroupsForTests(); });afterEach(() => { resetDetachedGroupsForTests(); });- it('signals each tracked group and reports how many it reached', () => {+ it.skipIf(process.platform === 'win32')('signals each tracked group and reports how many it reached', () => {// Spy so the negative pids never reach real process groups.const killSpy = vi.spyOn(process, 'kill').mockImplementation(() => true);trackDetachedGroup(fakeChild(101), true);@@ -217,7 +217,7 @@ describe('credentialBootstrap', () => {killSpy.mockRestore();});- it('tracks nothing for an undetached spawn, and returns the child either way', () => {+ it.skipIf(process.platform === 'win32')('tracks nothing for an undetached spawn, and returns the child either way', () => {const killSpy = vi.spyOn(process, 'kill').mockImplementation(() => true);const child = fakeChild(303);@@ -245,7 +245,7 @@ describe('credentialBootstrap', () => {// 'close' waits for its stdio — which the harness is still holding in// exactly the case this registry exists for. Forgetting at 'exit' would drop// the group precisely when the orphaned harness is its only member.- it('keeps tracking a group whose wrapper exited while the harness holds its stdio', () => {+ it.skipIf(process.platform === 'win32')('keeps tracking a group whose wrapper exited while the harness holds its stdio', () => {const killSpy = vi.spyOn(process, 'kill').mockImplementation(() => true);const child = fakeChild(515);trackDetachedGroup(child, true);diff --git a/server/services/agentCliSpawning.test.js b/server/services/agentCliSpawning.test.jsindex b765d6e384..84b91cf5b8 100644--- a/server/services/agentCliSpawning.test.js+++ b/server/services/agentCliSpawning.test.js@@ -135,6 +135,12 @@ import { existsSync } from 'fs';import { spawn } from '../lib/childProcess.js';import { prepareCliSpawn, killProcessTree } from '../lib/bufferedSpawn.js';+// Windows takes killProcessTree's tree-wide `taskkill /T` branch instead, so+// `needsProcessGroup` is false there and these sites spawn attached. The policy+// itself is pinned with an injected platform in credentialBootstrap.test.js;+// these assert only that each site plumbs the decision through.+const EXPECT_GROUP = process.platform !== 'win32';+describe('buildCliSpawnConfig', () => {it('omits --model for Codex configured-default sentinel but bypasses sandbox/approvals', () => {const config = buildCliSpawnConfig({ id: 'codex', command: 'codex' }, 'codex-configured-default');@@ -1446,10 +1452,10 @@ describe('stream error containment', () => {const [command, , options] = spawn.mock.calls.at(-1);expect(command).toBe('token-cli');- expect(options.detached).toBe(true);+ expect(options.detached).toBe(EXPECT_GROUP);// agentManagement's pause/terminate/force-kill hold only this entry and// cannot re-derive the wrap, so the flag has to travel with it.- expect(activeAgents.get(bootstrapArgs.agentId).processGroup).toBe(true);+ expect(activeAgents.get(bootstrapArgs.agentId).processGroup).toBe(EXPECT_GROUP);activeAgents.delete(bootstrapArgs.agentId);fakeProcess.emit('close', 0);@@ -1483,7 +1489,7 @@ describe('stream error containment', () => {expect(killProcessTree).toHaveBeenCalledTimes(1);expect(killProcessTree.mock.calls[0][1]).toBe('SIGTERM');- expect(killProcessTree.mock.calls[0][2]).toEqual({ processGroup: true });+ expect(killProcessTree.mock.calls[0][2]).toEqual({ processGroup: EXPECT_GROUP });fakeProcess.killed = true;fakeProcess.emit('close', 143);diff --git a/server/services/agentManagement.test.js b/server/services/agentManagement.test.jsindex 9a7bd124dd..616d22dc8c 100644--- a/server/services/agentManagement.test.js+++ b/server/services/agentManagement.test.js@@ -2284,7 +2284,7 @@ describe('credential-bootstrap process-group teardown', () => {Object.create(ChildProcess.prototype), { kill, pid: 909090 },);- it('terminateAgent signals the whole group for a wrapped agent', async () => {+ it.skipIf(process.platform === 'win32')('terminateAgent signals the whole group for a wrapped agent', async () => {const kill = vi.fn();activeAgents.set('agent-1', {process: wrappedAgent(kill), processGroup: true, taskId: 'task-1', runId: 'run-1', pid: 909090,@@ -2299,7 +2299,7 @@ describe('credential-bootstrap process-group teardown', () => {clearTimeout(activeAgents.get('agent-1')?.killTimer);});- it('terminateAgent signals only the child for an unwrapped agent', async () => {+ it.skipIf(process.platform === 'win32')('terminateAgent signals only the child for an unwrapped agent', async () => {const kill = vi.fn();activeAgents.set('agent-1', {process: fakeChildProcess(kill), taskId: 'task-1', runId: 'run-1', pid: 123,@@ -2312,7 +2312,7 @@ describe('credential-bootstrap process-group teardown', () => {clearTimeout(activeAgents.get('agent-1')?.killTimer);});- it('killAgent SIGKILLs the whole group for a wrapped agent', async () => {+ it.skipIf(process.platform === 'win32')('killAgent SIGKILLs the whole group for a wrapped agent', async () => {const kill = vi.fn();activeAgents.set('agent-1', {process: wrappedAgent(kill), processGroup: true, taskId: 'task-1', runId: 'run-1', pid: 909090,@@ -2324,7 +2324,7 @@ describe('credential-bootstrap process-group teardown', () => {expect(kill).not.toHaveBeenCalled();});- it('pauseAgent signals the whole group for a wrapped agent', async () => {+ it.skipIf(process.platform === 'win32')('pauseAgent signals the whole group for a wrapped agent', async () => {const kill = vi.fn();activeAgents.set('agent-1', {process: wrappedAgent(kill), processGroup: true, taskId: 'task-1', runId: 'run-1', pid: 909090,diff --git a/server/services/askService.test.js b/server/services/askService.test.jsindex 75ff7d2ace..693b69013f 100644--- a/server/services/askService.test.js+++ b/server/services/askService.test.js@@ -53,6 +53,12 @@ vi.mock('./catalogDB.js', () => ({}));const { spawn } = await import('../lib/childProcess.js');++// Windows takes killProcessTree's tree-wide `taskkill /T` branch instead, so+// `needsProcessGroup` is false there and these sites spawn attached. The policy+// itself is pinned with an injected platform in credentialBootstrap.test.js;+// these assert only that each site plumbs the decision through.+const EXPECT_GROUP = process.platform !== 'win32';const catalogDB = await import('./catalogDB.js');const memoryBackend = await import('./memoryBackend.js');const memoryEmbeddings = await import('./memoryEmbeddings.js');@@ -299,13 +305,13 @@ describe('runAsk', () => {expect(args.slice(3)).toEqual(expect.arrayContaining(['--model', 'sonnet']));// #7496: the direct child is now the WRAPPER, so both stop paths below (the// timeout and the user's abort) have to reach the harness behind it.- expect(spawn.mock.calls[0][2].detached).toBe(true);+ expect(spawn.mock.calls[0][2].detached).toBe(EXPECT_GROUP);});// #7496. Ask's abort IS the user pressing stop, and it carries private// records — a harness left running past it keeps reading them. A per-pid// SIGKILL reaches only the bootstrap wrapper.- it('SIGKILLs the whole process group when the user aborts a bootstrap-wrapped ask', async () => {+ it.skipIf(process.platform === 'win32')('SIGKILLs the whole process group when the user aborts a bootstrap-wrapped ask', async () => {// Spy so the negative pid never reaches a real process group.const killSpy = vi.spyOn(process, 'kill').mockImplementation(() => true);providers.getActiveProvider.mockResolvedValue({@@ -334,7 +340,7 @@ describe('runAsk', () => {killSpy.mockRestore();});- it('SIGKILLs only the child when an UNWRAPPED ask is aborted', async () => {+ it.skipIf(process.platform === 'win32')('SIGKILLs only the child when an UNWRAPPED ask is aborted', async () => {const killSpy = vi.spyOn(process, 'kill').mockImplementation(() => true);providers.getActiveProvider.mockResolvedValue({id: 'claude-code', type: 'cli', enabled: true, command: 'claude', args: [], defaultModel: 'sonnet',diff --git a/server/services/providerUsage.test.js b/server/services/providerUsage.test.jsindex d957bc9915..4cd4d31fa8 100644--- a/server/services/providerUsage.test.js+++ b/server/services/providerUsage.test.js@@ -68,6 +68,12 @@ import { systemTimeZone } from './claudeCodeUsage.js';import { getSettings } from './settings.js';import { getImageGenQuota } from './imageGenQuota.js';+// Windows takes killProcessTree's tree-wide `taskkill /T` branch instead, so+// `needsProcessGroup` is false there and these sites spawn attached. The policy+// itself is pinned with an injected platform in credentialBootstrap.test.js;+// these assert only that each site plumbs the decision through.+const EXPECT_GROUP = process.platform !== 'win32';+// Synthetic Antigravity `/usage` panel — invented values, redacted account, in// the agy 1.1.x rendered shape (`… Limit Remaining`). The bar percentage is// percent REMAINING; a full bar with "Quota available" has no reset.@@ -455,7 +461,7 @@ describe('getProviderQuotas', () => {expect(scrapeTuiUsage).toHaveBeenCalledWith(expect.objectContaining({command: 'token-cli',- processGroup: true,+ processGroup: EXPECT_GROUP,}));});diff --git a/server/services/runner.test.js b/server/services/runner.test.jsindex 60e4fd06fc..8b1be99e7b 100644--- a/server/services/runner.test.js+++ b/server/services/runner.test.js@@ -58,6 +58,12 @@ const { writeFile, readFile } = await import('fs/promises');const { atomicWrite, tryReadFile } = await import('../lib/fileUtils.js');const runner = await import('./runner.js');const { analyzeError, ERROR_CATEGORIES } = await import('../lib/aiToolkit/errorDetection.js');++// Windows takes killProcessTree's tree-wide `taskkill /T` branch instead, so+// `needsProcessGroup` is false there and these sites spawn attached. The policy+// itself is pinned with an injected platform in credentialBootstrap.test.js;+// these assert only that each site plumbs the decision through.+const EXPECT_GROUP = process.platform !== 'win32';const {setAIToolkit, executeCliRun, buildCliArgs, hasModelFlag, extractBakedModel,emitRunStarted, finalizeRunRecord, patchRunMetadata,@@ -734,7 +740,7 @@ describe('executeCliRun — credential-bootstrap wrapping', () => {await executeCliRun({ runId: 'run-bootstrap-detached', provider: bootstrapProvider(), prompt: 'p', workspacePath: TEST_WORKSPACE });const [, , options] = spawn.mock.calls.at(-1);- expect(options.detached).toBe(true);+ expect(options.detached).toBe(EXPECT_GROUP);});it('leaves an unwrapped provider attached — its direct child IS the harness', async () => {@@ -753,7 +759,7 @@ describe('executeCliRun — credential-bootstrap wrapping', () => {expect(options.detached).toBe(false);});- it('signals the whole process group on timeout for a bootstrap-wrapped run', async () => {+ it.skipIf(process.platform === 'win32')('signals the whole process group on timeout for a bootstrap-wrapped run', async () => {// Spy so the negative pid never reaches a real process group.const killSpy = vi.spyOn(process, 'kill').mockImplementation(() => true);const child = makeChild();@@ -773,7 +779,7 @@ describe('executeCliRun — credential-bootstrap wrapping', () => {killSpy.mockRestore();});- it('signals only the child pid on timeout for an unwrapped run', async () => {+ it.skipIf(process.platform === 'win32')('signals only the child pid on timeout for an unwrapped run', async () => {const killSpy = vi.spyOn(process, 'kill').mockImplementation(() => true);const child = makeChild();child.pid = 515151;@@ -795,7 +801,7 @@ describe('executeCliRun — credential-bootstrap wrapping', () => {killSpy.mockRestore();});- it('registers a group-aware killable so /runs Stop reaches the harness, not just the wrapper', async () => {+ it.skipIf(process.platform === 'win32')('registers a group-aware killable so /runs Stop reaches the harness, not just the wrapper', async () => {const killSpy = vi.spyOn(process, 'kill').mockImplementation(() => true);const registered = [];const toolkit = fakeToolkit();diff --git a/server/services/tuiPromptRunner.test.js b/server/services/tuiPromptRunner.test.jsindex bf91d0809d..98cae2fb2c 100644--- a/server/services/tuiPromptRunner.test.js+++ b/server/services/tuiPromptRunner.test.js@@ -1632,7 +1632,7 @@ describe('executeTuiRun', () => {});afterEach(() => { killSpy.mockRestore(); });- it('signals the whole group when finish() tears a wrapped PTY down', async () => {+ it.skipIf(process.platform === 'win32')('signals the whole group when finish() tears a wrapped PTY down', async () => {const promise = executeTuiRun({runId: 'run-bootstrap-kill', provider: bootstrapProvider,prompt: 'a prompt long enough to clear the guard', workspacePath: TEST_WORKSPACE, timeout: 60000,@@ -1653,7 +1653,7 @@ describe('executeTuiRun', () => {expect(pty.kill).not.toHaveBeenCalled();});- it('leaves an unwrapped PTY on the plain node-pty kill', async () => {+ it.skipIf(process.platform === 'win32')('leaves an unwrapped PTY on the plain node-pty kill', async () => {const promise = executeTuiRun({runId: 'run-unwrapped-kill', provider: { id: 'claude', type: 'tui', command: 'echo' },prompt: 'a prompt long enough to clear the guard', workspacePath: TEST_WORKSPACE, timeout: 60000,@@ -1671,7 +1671,7 @@ describe('executeTuiRun', () => {expect(pty.kill).toHaveBeenCalledWith('SIGHUP');});- it('registers a group-aware killable so /runs Stop reaches the harness, not just the wrapper', async () => {+ it.skipIf(process.platform === 'win32')('registers a group-aware killable so /runs Stop reaches the harness, not just the wrapper', async () => {const promise = executeTuiRun({runId: 'run-bootstrap-stop', provider: bootstrapProvider,prompt: 'a prompt long enough to clear the guard', workspacePath: TEST_WORKSPACE, timeout: 60000,diff --git a/server/services/visionCli.test.js b/server/services/visionCli.test.jsindex 893d273a45..97f4f175cb 100644--- a/server/services/visionCli.test.js+++ b/server/services/visionCli.test.js@@ -29,6 +29,12 @@ const {} = await import('./visionCli.js');const { resolveWindowsExecutable, prepareWindowsSafeSpawn } = await import('../lib/bufferedSpawn.js');+// Windows takes killProcessTree's tree-wide `taskkill /T` branch instead, so+// `needsProcessGroup` is false there and these sites spawn attached. The policy+// itself is pinned with an injected platform in credentialBootstrap.test.js;+// these assert only that each site plumbs the decision through.+const EXPECT_GROUP = process.platform !== 'win32';+const PNG_DATA_URL = `data:image/png;base64,${Buffer.from('fake-png').toString('base64')}`;describe('decodeImageDataUrl', () => {@@ -340,7 +346,7 @@ describe('describeImageViaCli', () => {provider: bootstrapProvider, dataUrl: PNG_DATA_URL, prompt: 'p', spawnImpl: wrappedSpawn,});expect(wrappedSpawn.mock.calls[0][0]).toBe('token-cli');- expect(wrappedSpawn.mock.calls[0][2].detached).toBe(true);+ expect(wrappedSpawn.mock.calls[0][2].detached).toBe(EXPECT_GROUP);const plainChild = makeFakeChild();const plainSpawn = spawnEmitting(plainChild, (c) => { c.emit('close', 0); });@@ -351,7 +357,7 @@ describe('describeImageViaCli', () => {expect(plainSpawn.mock.calls[0][2].detached).toBe(false);});- it('signals the whole group on timeout for a wrapped provider', async () => {+ it.skipIf(process.platform === 'win32')('signals the whole group on timeout for a wrapped provider', async () => {// Spy so the negative pid never reaches a real process group.const killSpy = vi.spyOn(process, 'kill').mockImplementation(() => true);const child = makeFakeChild();