Route agents to owning application files
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-08-28 13:39:37 +02:00
parent 75894f8b52
commit 0f2f131034
6 changed files with 57 additions and 8 deletions

View File

@@ -13,11 +13,11 @@ class AiderAgent:
def __init__(self, settings: Settings) -> None:
self.settings = settings
def run(self, workspace: Path, task: str) -> str:
def run(self, workspace: Path, task: str, files: tuple[str, ...] = ()) -> str:
task_file = workspace / ".git" / "failure-task.txt"
task_file.write_text(task)
task_file.chmod(0o600)
command = self.command(task_file)
command = self.command(task_file, files)
coder = pwd.getpwnam("coder")
git_config = Path(coder.pw_dir) / ".gitconfig"
git_config.write_text(
@@ -66,8 +66,8 @@ class AiderAgent:
raise RuntimeError(f"Aider failed ({result.returncode}): {result.stderr[-4000:]}")
return result.stdout[-12_000:]
def command(self, task_file: Path) -> list[str]:
return [
def command(self, task_file: Path, files: tuple[str, ...] = ()) -> list[str]:
command = [
self.settings.agent_command,
"--model",
self.settings.agent_model,
@@ -88,3 +88,7 @@ class AiderAgent:
"--timeout",
"180",
]
for filename in files:
if (task_file.parent.parent / filename).is_file():
command.extend(["--file", filename])
return command