Skip to content

Commit 8a35fd2

Browse files
committed
Revert "Agentic unit test fixing (#325)"
This reverts commit a87a7d9.
1 parent 2778ade commit 8a35fd2

9 files changed

Lines changed: 104 additions & 1108 deletions

‎codeplain_REST_api.py‎

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,38 @@ def render_functional_requirement(
253253

254254
return self.post_request(endpoint_url, headers, payload, run_state)
255255

256+
def fix_unittests_issue(
257+
self,
258+
frid,
259+
plain_source_tree,
260+
linked_resources,
261+
existing_files_content,
262+
module_name: str,
263+
required_modules,
264+
unittests_issue,
265+
run_state: RunState,
266+
conformance_tests_fixes: list[dict] | None = None,
267+
):
268+
endpoint_url = f"{self.api_url}/fix_unittests_issue"
269+
headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}
270+
271+
payload = {
272+
"frid": frid,
273+
"plain_source_tree": plain_source_tree,
274+
"linked_resources": linked_resources,
275+
"existing_files_content": existing_files_content,
276+
"module_name": module_name,
277+
"required_modules": required_modules,
278+
"unittests_issue": unittests_issue,
279+
"unittest_batch_id": run_state.unittest_batch_id,
280+
}
281+
# Implementation code changes made by the conformance tests fixer right before this unit tests run;
282+
# only sent when unit tests are processed inside the conformance tests phase.
283+
if conformance_tests_fixes is not None:
284+
payload["conformance_tests_fixes"] = conformance_tests_fixes
285+
286+
return self.post_request(endpoint_url, headers, payload, run_state)
287+
256288
def distill_conformance_test_memory(
257289
self,
258290
frid,
@@ -526,29 +558,3 @@ def summarize_finished_conformance_tests(
526558
}
527559

528560
return self.post_request(endpoint_url, headers, payload, run_state)
529-
530-
def agent_start(self, task_type: str, task_params: dict, frid: str, module_name: str, run_state: RunState):
531-
"""Start a server-side agent session; returns the first turn (tool calls or completion)."""
532-
endpoint_url = f"{self.api_url}/agent/start"
533-
headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}
534-
payload = {
535-
"task_type": task_type,
536-
"task_params": task_params,
537-
"frid": frid,
538-
"module_name": module_name,
539-
}
540-
return self.post_request(endpoint_url, headers, payload, run_state)
541-
542-
def agent_continue(
543-
self, session_id: str, tool_results: list[dict], frid: str, module_name: str, run_state: RunState
544-
):
545-
"""Feed tool results into an agent session and run its next turn."""
546-
endpoint_url = f"{self.api_url}/agent/continue"
547-
headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}
548-
payload = {
549-
"session_id": session_id,
550-
"tool_results": tool_results,
551-
"frid": frid,
552-
"module_name": module_name,
553-
}
554-
return self.post_request(endpoint_url, headers, payload, run_state)

‎render_machine/actions/fix_unit_tests.py‎

Lines changed: 47 additions & 224 deletions
Large diffs are not rendered by default.

‎render_machine/actions/run_unit_tests.py‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@ class RunUnitTests(BaseAction):
1616
UNRECOVERABLE_ERROR_OUTCOME = "unrecoverable_error_occurred"
1717

1818
def execute(self, render_context: RenderContext, _previous_action_payload: Any | None):
19-
context = render_context.unit_tests_running_context
20-
if context.verified_passing:
21-
# The fixing agent's own run passed and no file changed since; running again is redundant.
22-
context.verified_passing = False
23-
console.info("Unit tests already passed in the fixing agent's last run; not running them again.")
24-
render_context.script_execution_history.latest_unit_test_output_path = context.verified_passing_log_path
25-
render_context.script_execution_history.should_update_script_outputs = True
26-
return self.SUCCESSFUL_OUTCOME, None
27-
2819
unittests_script = os.path.normpath(render_context.unittests_script)
2920

3021
console.info(

‎render_machine/agent_tools.py‎

Lines changed: 0 additions & 270 deletions
This file was deleted.

‎render_machine/render_context.py‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
FridContext,
2020
ScriptExecutionHistory,
2121
TestExecutionPhase,
22-
UnitTestsAgentSession,
2322
UnitTestsRunningContext,
2423
)
2524

@@ -189,14 +188,6 @@ def should_run_unit_tests(self) -> bool:
189188
def should_run_conformance_tests(self) -> bool:
190189
return self.conformance_tests_script is not None
191190

192-
@property
193-
def unit_tests_agent_session(self) -> UnitTestsAgentSession:
194-
"""The agent session fixing the unit tests: per unit-test loop, except during the conformance
195-
phase, where one session spans every loop (see UnitTestsAgentSession)."""
196-
if self.conformance_tests_running_context is not None:
197-
return self.conformance_tests_running_context.unit_tests_agent_session
198-
return self.unit_tests_running_context.agent_session
199-
200191
def start_unittests_processing(self):
201192
self.unit_tests_running_context = UnitTestsRunningContext(fix_attempts=0)
202193
self.run_state.increment_unittest_batch_id()

0 commit comments

Comments
 (0)