Extend bounded syntax repair retries
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-08-28 14:36:27 +02:00
parent 886cdbf7ef
commit 057c78110d
4 changed files with 9 additions and 4 deletions

View File

@@ -105,5 +105,5 @@ class Settings:
raise ValueError("FAILURE_DB_PASSWORD is required") raise ValueError("FAILURE_DB_PASSWORD is required")
if not self.test_database_password: if not self.test_database_password:
raise ValueError("TEST_DB_PASSWORD is required") raise ValueError("TEST_DB_PASSWORD is required")
if not 1 <= self.max_agent_attempts <= 3: if not 1 <= self.max_agent_attempts <= 5:
raise ValueError("MAX_AGENT_ATTEMPTS must be between 1 and 3") raise ValueError("MAX_AGENT_ATTEMPTS must be between 1 and 5")

View File

@@ -133,7 +133,9 @@ class AutomationWorker:
RuntimeError( RuntimeError(
f"{exception}\n{restored_state} Make smaller edits and run php -l on each " f"{exception}\n{restored_state} Make smaller edits and run php -l on each "
"changed PHP file. Reconstruct the intended application fix from this discarded " "changed PHP file. Reconstruct the intended application fix from this discarded "
f"patch excerpt, correcting its syntax:\n{discarded_diff}" "patch excerpt, correcting its syntax. This is a repair-only attempt: preserve the "
"intended behavior, place methods inside their owning class, and do not redesign or "
f"expand the solution:\n{discarded_diff}"
), ),
) )
continue continue

View File

@@ -70,4 +70,6 @@ def test_default_commands_initialize_disposable_laravel_schema(monkeypatch) -> N
def test_agent_attempts_are_bounded() -> None: def test_agent_attempts_are_bounded() -> None:
with pytest.raises(ValueError, match="MAX_AGENT_ATTEMPTS"): with pytest.raises(ValueError, match="MAX_AGENT_ATTEMPTS"):
settings(max_agent_attempts=4).validate() settings(max_agent_attempts=6).validate()
settings(max_agent_attempts=5).validate()

View File

@@ -169,6 +169,7 @@ def test_php_syntax_failure_discards_attempt_before_full_validation() -> None:
assert "unexpected token" in worker.agent.run.call_args_list[1].args[1] assert "unexpected token" in worker.agent.run.call_args_list[1].args[1]
assert "clean repository" in worker.agent.run.call_args_list[1].args[1] assert "clean repository" in worker.agent.run.call_args_list[1].args[1]
assert "intended fix" in worker.agent.run.call_args_list[1].args[1] assert "intended fix" in worker.agent.run.call_args_list[1].args[1]
assert "repair-only attempt" in worker.agent.run.call_args_list[1].args[1]
workspace.restore_checkpoint.assert_called_once_with(None) workspace.restore_checkpoint.assert_called_once_with(None)
worker._run_tests.assert_called_once() worker._run_tests.assert_called_once()