mirror of
https://github.com/FuzzingLabs/fuzzforge_ai.git
synced 2026-03-18 17:44:17 +00:00
fix: pipeline module fixes and improved AI agent guidance
This commit is contained in:
@@ -420,7 +420,7 @@ class DockerCLI(AbstractFuzzForgeSandboxEngine):
|
||||
def read_file_from_image(self, image: str, path: str) -> str:
|
||||
"""Read a file from inside an image without starting a long-running container.
|
||||
|
||||
Creates a temporary container, reads the file via cat, and removes it.
|
||||
Uses docker run with --entrypoint override to read the file via cat.
|
||||
|
||||
:param image: Image reference (e.g., "fuzzforge-rust-analyzer:latest").
|
||||
:param path: Path to file inside image.
|
||||
@@ -429,30 +429,14 @@ class DockerCLI(AbstractFuzzForgeSandboxEngine):
|
||||
"""
|
||||
logger = get_logger()
|
||||
|
||||
# Create a temporary container (don't start it)
|
||||
create_result = self._run(
|
||||
["create", "--rm", image, "cat", path],
|
||||
# Use docker run with --entrypoint to override any container entrypoint
|
||||
result = self._run(
|
||||
["run", "--rm", "--entrypoint", "cat", image, path],
|
||||
check=False,
|
||||
)
|
||||
|
||||
if create_result.returncode != 0:
|
||||
logger.debug("failed to create container for file read", image=image, path=path)
|
||||
if result.returncode != 0:
|
||||
logger.debug("failed to read file from image", image=image, path=path, stderr=result.stderr)
|
||||
return ""
|
||||
|
||||
container_id = create_result.stdout.strip()
|
||||
|
||||
try:
|
||||
# Start the container and capture output (cat will run and exit)
|
||||
start_result = self._run(
|
||||
["start", "-a", container_id],
|
||||
check=False,
|
||||
)
|
||||
|
||||
if start_result.returncode != 0:
|
||||
logger.debug("failed to read file from image", image=image, path=path)
|
||||
return ""
|
||||
|
||||
return start_result.stdout
|
||||
finally:
|
||||
# Cleanup: remove the container (may already be removed due to --rm)
|
||||
self._run(["rm", "-f", container_id], check=False)
|
||||
return result.stdout
|
||||
|
||||
@@ -481,7 +481,7 @@ class PodmanCLI(AbstractFuzzForgeSandboxEngine):
|
||||
def read_file_from_image(self, image: str, path: str) -> str:
|
||||
"""Read a file from inside an image without starting a long-running container.
|
||||
|
||||
Creates a temporary container, reads the file via cat, and removes it.
|
||||
Uses podman run with --entrypoint override to read the file via cat.
|
||||
|
||||
:param image: Image reference (e.g., "fuzzforge-rust-analyzer:latest").
|
||||
:param path: Path to file inside image.
|
||||
@@ -490,33 +490,17 @@ class PodmanCLI(AbstractFuzzForgeSandboxEngine):
|
||||
"""
|
||||
logger = get_logger()
|
||||
|
||||
# Create a temporary container (don't start it)
|
||||
create_result = self._run(
|
||||
["create", "--rm", image, "cat", path],
|
||||
# Use podman run with --entrypoint to override any container entrypoint
|
||||
result = self._run(
|
||||
["run", "--rm", "--entrypoint", "cat", image, path],
|
||||
check=False,
|
||||
)
|
||||
|
||||
if create_result.returncode != 0:
|
||||
logger.debug("failed to create container for file read", image=image, path=path)
|
||||
if result.returncode != 0:
|
||||
logger.debug("failed to read file from image", image=image, path=path, stderr=result.stderr)
|
||||
return ""
|
||||
|
||||
container_id = create_result.stdout.strip()
|
||||
|
||||
try:
|
||||
# Start the container and capture output (cat will run and exit)
|
||||
start_result = self._run(
|
||||
["start", "-a", container_id],
|
||||
check=False,
|
||||
)
|
||||
|
||||
if start_result.returncode != 0:
|
||||
logger.debug("failed to read file from image", image=image, path=path)
|
||||
return ""
|
||||
|
||||
return start_result.stdout
|
||||
finally:
|
||||
# Cleanup: remove the container (may already be removed due to --rm)
|
||||
self._run(["rm", "-f", container_id], check=False)
|
||||
return result.stdout
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Utility Methods
|
||||
|
||||
Reference in New Issue
Block a user