fix: feed Codex prompts through stdin

This commit is contained in:
2026-05-06 15:47:15 +08:00
parent 631dc2ce3d
commit 9cc8055020
6 changed files with 14 additions and 17 deletions

View File

@@ -21,8 +21,7 @@ agents:
- "--dangerously-bypass-approvals-and-sandbox" - "--dangerously-bypass-approvals-and-sandbox"
- "--cd" - "--cd"
- "{workspace_path}" - "{workspace_path}"
- "--prompt-file" - "-"
- "{prompt_path}"
reviewer: reviewer:
command: command:
- "codex" - "codex"
@@ -30,8 +29,7 @@ agents:
- "--dangerously-bypass-approvals-and-sandbox" - "--dangerously-bypass-approvals-and-sandbox"
- "--cd" - "--cd"
- "{workspace_path}" - "{workspace_path}"
- "--prompt-file" - "-"
- "{prompt_path}"
labels: labels:
ready: "agent:ready" ready: "agent:ready"

View File

@@ -21,8 +21,7 @@ agents:
- "--dangerously-bypass-approvals-and-sandbox" - "--dangerously-bypass-approvals-and-sandbox"
- "--cd" - "--cd"
- "{workspace_path}" - "{workspace_path}"
- "--prompt-file" - "-"
- "{prompt_path}"
reviewer: reviewer:
command: command:
- "codex" - "codex"
@@ -30,8 +29,7 @@ agents:
- "--dangerously-bypass-approvals-and-sandbox" - "--dangerously-bypass-approvals-and-sandbox"
- "--cd" - "--cd"
- "{workspace_path}" - "{workspace_path}"
- "--prompt-file" - "-"
- "{prompt_path}"
labels: labels:
ready: "agent:ready" ready: "agent:ready"

View File

@@ -7,8 +7,8 @@ from .models import AgentResult
class CommandRunner: class CommandRunner:
def run(self, command: list[str], cwd: str | Path) -> AgentResult: def run(self, command: list[str], cwd: str | Path, *, stdin: str | None = None) -> AgentResult:
result = subprocess.run(command, cwd=cwd, text=True, capture_output=True, check=False) result = subprocess.run(command, cwd=cwd, input=stdin, text=True, capture_output=True, check=False)
return AgentResult(exit_code=result.returncode, stdout=result.stdout, stderr=result.stderr) return AgentResult(exit_code=result.returncode, stdout=result.stdout, stderr=result.stderr)

View File

@@ -201,7 +201,7 @@ class TaskRunner:
issue_title=issue.title, issue_title=issue.title,
branch_name=branch_name, branch_name=branch_name,
) )
result = self.command_runner.run(command, workspace) result = self.command_runner.run(command, workspace, stdin=prompt)
report = read_report(workspace / "AGENT_IMPLEMENTATION_REPORT.md") report = read_report(workspace / "AGENT_IMPLEMENTATION_REPORT.md")
self.db.add_agent_run( self.db.add_agent_run(
task_id=task.id, task_id=task.id,
@@ -236,7 +236,7 @@ class TaskRunner:
issue_title=issue.title, issue_title=issue.title,
pr_number=pr_number, pr_number=pr_number,
) )
result = self.command_runner.run(command, workspace) result = self.command_runner.run(command, workspace, stdin=prompt)
report = read_report(workspace / "AGENT_REVIEW_REPORT.md") report = read_report(workspace / "AGENT_REVIEW_REPORT.md")
self.db.add_agent_run( self.db.add_agent_run(
task_id=task.id, task_id=task.id,

View File

@@ -15,8 +15,8 @@ def make_config(tmp_path: Path, **overrides: object) -> AppConfig:
"scheduler": {"interval_seconds": 1, "concurrency": 1, "lease_seconds": 60}, "scheduler": {"interval_seconds": 1, "concurrency": 1, "lease_seconds": 60},
"workspace": {"root": tmp_path / "workspaces", "cleanup_on_success": False}, "workspace": {"root": tmp_path / "workspaces", "cleanup_on_success": False},
"agents": { "agents": {
"implementer": {"command": ["implementer", "{prompt_path}"]}, "implementer": {"command": ["implementer", "-"]},
"reviewer": {"command": ["reviewer", "{prompt_path}"]}, "reviewer": {"command": ["reviewer", "-"]},
}, },
} }
data.update(overrides) data.update(overrides)

View File

@@ -18,8 +18,8 @@ def make_config(tmp_path: Path, **overrides: object) -> AppConfig:
"scheduler": {"interval_seconds": 1, "concurrency": 1, "lease_seconds": 60}, "scheduler": {"interval_seconds": 1, "concurrency": 1, "lease_seconds": 60},
"workspace": {"root": tmp_path / "workspaces", "cleanup_on_success": False}, "workspace": {"root": tmp_path / "workspaces", "cleanup_on_success": False},
"agents": { "agents": {
"implementer": {"command": ["implementer", "{prompt_path}"]}, "implementer": {"command": ["implementer", "-"]},
"reviewer": {"command": ["reviewer", "{prompt_path}"]}, "reviewer": {"command": ["reviewer", "-"]},
}, },
} }
data.update(overrides) data.update(overrides)
@@ -144,8 +144,9 @@ class FakeRunner:
def __init__(self, *, fail_role: str | None = None): def __init__(self, *, fail_role: str | None = None):
self.fail_role = fail_role self.fail_role = fail_role
def run(self, command, cwd): def run(self, command, cwd, *, stdin=None):
role = command[0] role = command[0]
assert stdin
if role == self.fail_role: if role == self.fail_role:
return AgentResult(exit_code=1, stdout="", stderr="failed") return AgentResult(exit_code=1, stdout="", stderr="failed")
if role == "implementer": if role == "implementer":