From 077d032cc7692df89f2fcf1c42eb2c150ac63fe1 Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Thu, 12 Feb 2026 06:20:54 +0000 Subject: [PATCH 1/2] Initial plan From dde29f59943e641dfe0309b422bd125eb79ccafd Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Thu, 12 Feb 2026 06:23:32 +0000 Subject: [PATCH 2/2] fix: handle missing docker-compose.yml during cleanup gracefully Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> --- src/docker-manager.ts | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/docker-manager.ts b/src/docker-manager.ts index c815684e..0cdc409f 100644 --- a/src/docker-manager.ts +++ b/src/docker-manager.ts @@ -1301,11 +1301,36 @@ export async function stopContainers(workDir: string, keepContainers: boolean): logger.info('Stopping containers...'); try { - await execa('docker', ['compose', 'down', '-v'], { - cwd: workDir, - stdio: 'inherit', - }); - logger.success('Containers stopped successfully'); + // Check if workDir and docker-compose.yml exist before using docker compose + const composeFile = path.join(workDir, 'docker-compose.yml'); + if (fs.existsSync(workDir) && fs.existsSync(composeFile)) { + // Normal path: use docker compose down + await execa('docker', ['compose', 'down', '-v'], { + cwd: workDir, + stdio: 'inherit', + }); + logger.success('Containers stopped successfully'); + } else { + // Fallback: compose file missing, stop containers by name + logger.debug('Compose file not found, stopping containers by name'); + + // Stop and remove containers by name + const containerNames = ['awf-agent', 'awf-squid']; + for (const name of containerNames) { + try { + // Check if container exists + const { stdout } = await execa('docker', ['ps', '-aq', '-f', `name=^${name}$`]); + if (stdout.trim()) { + logger.debug(`Stopping container: ${name}`); + await execa('docker', ['rm', '-f', name], { stdio: 'inherit' }); + } + } catch (err) { + logger.debug(`Could not stop container ${name}:`, err); + } + } + + logger.success('Containers stopped successfully'); + } } catch (error) { logger.error('Failed to stop containers:', error); throw error;