continue
This commit is contained in:
@@ -490,6 +490,8 @@ class TestMakeAgenticCodex(unittest.TestCase):
|
||||
def _make_agentic_config(
|
||||
run_dir: Path,
|
||||
agentic_coder: bool = True,
|
||||
*,
|
||||
use_worktree: bool = False,
|
||||
) -> PipelineConfig:
|
||||
"""Build a config with an agentic coder + non-agentic reviewer."""
|
||||
coder = AgentConfig(
|
||||
@@ -521,6 +523,7 @@ def _make_agentic_config(
|
||||
]
|
||||
return PipelineConfig(
|
||||
output_dir=run_dir,
|
||||
use_worktree=use_worktree,
|
||||
max_iterations=2,
|
||||
min_iterations=1,
|
||||
language="en",
|
||||
@@ -551,7 +554,7 @@ class TestSetupWorktreeCalledForAgentic(unittest.TestCase):
|
||||
) -> None:
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
run_dir = Path(td)
|
||||
config = _make_agentic_config(run_dir)
|
||||
config = _make_agentic_config(run_dir, use_worktree=True)
|
||||
|
||||
wt_path = run_dir / "work"
|
||||
wt_path.mkdir()
|
||||
@@ -573,6 +576,44 @@ class TestSetupWorktreeCalledForAgentic(unittest.TestCase):
|
||||
mock_setup.assert_called_once()
|
||||
|
||||
|
||||
class TestDirectAgenticMode(unittest.TestCase):
|
||||
"""Agentic coders run in the current working tree by default."""
|
||||
|
||||
@patch("cross_eval.pipeline._setup_worktree")
|
||||
@patch("cross_eval.pipeline.invoke_agent_agentic")
|
||||
@patch("cross_eval.pipeline.invoke_agent")
|
||||
def test_agentic_uses_current_worktree_by_default(
|
||||
self,
|
||||
mock_invoke: MagicMock,
|
||||
mock_invoke_agentic: MagicMock,
|
||||
mock_setup: MagicMock,
|
||||
) -> None:
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
repo = Path(td)
|
||||
_init_git_repo(repo)
|
||||
run_dir = repo / ".cross-eval" / "output"
|
||||
run_dir.mkdir(parents=True, exist_ok=True)
|
||||
config = _make_agentic_config(run_dir)
|
||||
|
||||
mock_invoke_agentic.return_value = AgentResult(
|
||||
output="diff output", exit_code=0,
|
||||
agent_name="claude-coder", step_name="coding",
|
||||
duration_seconds=0.1,
|
||||
)
|
||||
mock_invoke.return_value = AgentResult(
|
||||
output="VERDICT: PASS", exit_code=0,
|
||||
agent_name="claude-reviewer", step_name="review",
|
||||
duration_seconds=0.1,
|
||||
)
|
||||
|
||||
run_pipeline(config, cwd=repo)
|
||||
|
||||
mock_setup.assert_not_called()
|
||||
self.assertEqual(mock_invoke_agentic.call_args.kwargs["worktree_path"], repo)
|
||||
reviewer_call = mock_invoke.call_args
|
||||
self.assertEqual(reviewer_call.kwargs["cwd"], repo)
|
||||
|
||||
|
||||
class TestSetupWorktreeLocation(unittest.TestCase):
|
||||
"""_setup_worktree places agentic worktrees outside the base repo."""
|
||||
|
||||
@@ -618,7 +659,7 @@ class TestReviewerRunsInWorktreeCwd(unittest.TestCase):
|
||||
) -> None:
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
run_dir = Path(td)
|
||||
config = _make_agentic_config(run_dir)
|
||||
config = _make_agentic_config(run_dir, use_worktree=True)
|
||||
|
||||
wt_path = run_dir / "work"
|
||||
wt_path.mkdir()
|
||||
@@ -660,7 +701,7 @@ class TestCommitIterationCalled(unittest.TestCase):
|
||||
) -> None:
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
run_dir = Path(td)
|
||||
config = _make_agentic_config(run_dir)
|
||||
config = _make_agentic_config(run_dir, use_worktree=True)
|
||||
|
||||
wt_path = run_dir / "work"
|
||||
wt_path.mkdir()
|
||||
@@ -702,7 +743,7 @@ class TestFinalizeWorktreeCalled(unittest.TestCase):
|
||||
) -> None:
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
run_dir = Path(td)
|
||||
config = _make_agentic_config(run_dir)
|
||||
config = _make_agentic_config(run_dir, use_worktree=True)
|
||||
|
||||
wt_path = run_dir / "work"
|
||||
wt_path.mkdir()
|
||||
|
||||
Reference in New Issue
Block a user