Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-cd-gaps-assessment.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/claude-token-usage-analyzer.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/cli-flag-consistency-checker.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/copilot-token-usage-analyzer.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/dependency-security-monitor.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/doc-maintainer.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/duplicate-code-detector.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/firewall-issue-dispatcher.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/issue-monster.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/pelis-agent-factory-advisor.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/refactoring-scanner.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/schema-sync.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions .github/workflows/secret-digger-codex.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/security-review.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/smoke-claude.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/smoke-codex.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/smoke-copilot-byok.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/smoke-copilot.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/smoke-gemini.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/smoke-opencode.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/smoke-services.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/test-coverage-improver.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/test-coverage-reporter.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions src/commands/signal-handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,43 @@ describe('registerSignalHandlers', () => {
expect(performCleanup).toHaveBeenCalledWith('SIGTERM');
expect(processExitSpy).toHaveBeenCalledWith(143);
});

it('swallows errors thrown during SIGINT handling', async () => {
const fastKill = jest.fn().mockRejectedValue(new Error('kill failed'));
const performCleanup = jest.fn().mockResolvedValue(undefined);

const deps: SignalHandlerDependencies = {
getContainersStarted: () => true,
keepContainers: false,
fastKillAgentContainer: fastKill,
performCleanup,
};

registerSignalHandlers(deps);

// Should not throw even though fastKillAgentContainer rejects
handlers['SIGINT']();
await flushPromises();
expect(processExitSpy).toHaveBeenCalledWith(130);
});

it('swallows errors thrown during SIGTERM handling', async () => {
const fastKill = jest.fn().mockRejectedValue(new Error('kill failed'));
const performCleanup = jest.fn().mockResolvedValue(undefined);

const deps: SignalHandlerDependencies = {
getContainersStarted: () => true,
keepContainers: false,
fastKillAgentContainer: fastKill,
performCleanup,
};

registerSignalHandlers(deps);

// Should not throw even though fastKillAgentContainer rejects
handlers['SIGTERM']();
await flushPromises();
expect(processExitSpy).toHaveBeenCalledWith(143);
});
});

3 changes: 2 additions & 1 deletion src/compose-generator.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { generateDockerCompose, ACT_PRESET_BASE_IMAGE } from './docker-manager';
import { generateDockerCompose } from './compose-generator';
import { ACT_PRESET_BASE_IMAGE } from './host-env';
import { WrapperConfig } from './types';
import { baseConfig, mockNetworkConfig } from './test-helpers/docker-test-fixtures.test-utils';
import * as fs from 'fs';
Expand Down
10 changes: 9 additions & 1 deletion src/docker-manager-lifecycle.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { startContainers, stopContainers, fastKillAgentContainer, isAgentExternallyKilled, resetAgentExternallyKilled, AGENT_CONTAINER_NAME, runAgentCommand, setAwfDockerHost } from './docker-manager';
import { startContainers, runAgentCommand, fastKillAgentContainer, setAwfDockerHost, stopContainers, getLocalDockerEnv } from './docker-manager';
import { isAgentExternallyKilled, resetAgentExternallyKilled } from './container-lifecycle';
import { AGENT_CONTAINER_NAME } from './host-env';
import { logger } from './logger';
import * as fs from 'fs';
import * as path from 'path';
Expand Down Expand Up @@ -491,6 +493,12 @@ describe('docker-manager lifecycle', () => {
fs.rmSync(testDir, { recursive: true, force: true });
}
});

it('getLocalDockerEnv returns a ProcessEnv-shaped object', () => {
const env = getLocalDockerEnv();
expect(env).toBeDefined();
expect(typeof env).toBe('object');
});
});

describe('runAgentCommand', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/docker-manager-utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { subnetsOverlap, validateIdNotInSystemRange, getSafeHostUid, getSafeHostGid, getRealUserHome, extractGhHostFromServerUrl, readGitHubPathEntries, mergeGitHubPathEntries, readGitHubEnvEntries, parseGitHubEnvFile, readEnvFile, MIN_REGULAR_UID, ACT_PRESET_BASE_IMAGE, stripScheme, parseDifcProxyHost } from './docker-manager';
import { subnetsOverlap, validateIdNotInSystemRange, getSafeHostUid, getSafeHostGid, getRealUserHome, extractGhHostFromServerUrl, readGitHubPathEntries, mergeGitHubPathEntries, readGitHubEnvEntries, parseGitHubEnvFile, readEnvFile, MIN_REGULAR_UID, ACT_PRESET_BASE_IMAGE, stripScheme } from './host-env';
import { parseDifcProxyHost } from './docker-manager';
import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
Expand Down
25 changes: 2 additions & 23 deletions src/docker-manager.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,19 @@
// Re-export public API for backwards compatibility.
// Symbols previously exported from the original docker-manager.ts are listed
// explicitly here to avoid unintentionally widening the public API surface with
// internal-only constants such as SQUID_PORT, *_CONTAINER_NAME, etc.
// Only production-consumed symbols are re-exported here. Test files should
// import directly from the source modules (host-env, compose-generator, etc.).

export {
AGENT_CONTAINER_NAME,
ACT_PRESET_BASE_IMAGE,
MIN_REGULAR_UID,
setAwfDockerHost,
getLocalDockerEnv,
validateIdNotInSystemRange,
getSafeHostUid,
getSafeHostGid,
getRealUserHome,
extractGhHostFromServerUrl,
readGitHubPathEntries,
readGitHubEnvEntries,
parseGitHubEnvFile,
mergeGitHubPathEntries,
readEnvFile,
subnetsOverlap,
type SslConfig,
stripScheme,
parseDifcProxyHost,
} from './host-env';

export { generateDockerCompose } from './compose-generator';

export { writeConfigs } from './config-writer';

export {
startContainers,
runAgentCommand,
fastKillAgentContainer,
isAgentExternallyKilled,
resetAgentExternallyKilled,
} from './container-lifecycle';

export {
Expand Down
3 changes: 2 additions & 1 deletion src/host-iptables-network.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { execaResult, mockedExeca, setupHostIptablesTestSuite } from './test-helpers/host-iptables-test-setup';
import { cleanupFirewallNetwork, ensureFirewallNetwork } from './host-iptables';
import { cleanupFirewallNetwork } from './host-iptables-network';
import { ensureFirewallNetwork } from './host-iptables';
import { _testing } from './host-iptables-shared';

describe('host-iptables (network)', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/host-iptables-setup.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { API_PROXY_PORTS } from './types';
import { execaError, execaResult, mockedExeca, setupDefaultIptablesMocks, setupHostIptablesTestSuite } from './test-helpers/host-iptables-test-setup';
import { isValidPortSpec, setupHostIptables } from './host-iptables';
import { isValidPortSpec } from './host-iptables-rules';
import { setupHostIptables } from './host-iptables';
import { _testing } from './host-iptables-shared';

// setupHostIptables intentionally allows the inclusive min:max API proxy port window.
Expand Down
Loading
Loading