Skip to content

Commit 3bba4c5

Browse files
committed
Removed report_progress tool plus prepare env change to not crash render
1 parent e0cb0ae commit 3bba4c5

4 files changed

Lines changed: 52 additions & 22 deletions

File tree

‎render_machine/actions/agent_fix_conformance_test.py‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,14 @@ def execute(self, render_context: RenderContext, previous_action_payload: Any |
4949
review_rejection_feedback = (
5050
previous_action_payload.get("review_rejection_feedback", "") if previous_action_payload else ""
5151
)
52-
# Detect whether we re-entered fixing because the environment preparation
53-
# (build/compile) step failed after the previous fix. PrepareTestingEnvironment
54-
# returns an ENVIRONMENT_ERROR payload, and the state machine routes that back
55-
# here (CONFORMANCE_FIX_APPLIED --HANDLE_ERROR--> CONFORMANCE_TEST_FAILED) without
56-
# running the conformance tests. When that happens the latest conformance test
57-
# output is stale (the tests never ran), so the agent must be pointed at the
58-
# environment preparation output instead.
52+
# Detect whether we entered fixing because the environment preparation
53+
# (build/compile) step failed — either the first preparation after the tests
54+
# were generated or the re-preparation after a previous fix.
55+
# PrepareTestingEnvironment returns an ENVIRONMENT_ERROR payload, and the
56+
# state machine routes that here (MARK_TESTING_ENVIRONMENT_FAILED -->
57+
# CONFORMANCE_TEST_FAILED) without running the conformance tests. When that
58+
# happens the latest conformance test output is stale (the tests never ran),
59+
# so the agent must be pointed at the environment preparation output instead.
5960
error = previous_action_payload.get("error") if previous_action_payload else None
6061
prepare_environment_failed = bool(error and error.get("type") == "ENVIRONMENT_ERROR")
6162

@@ -388,7 +389,7 @@ def _update_failure_signature(render_context: RenderContext, ctx, prepare_enviro
388389
"completely unchanged. Your current hypothesis class is exhausted — do NOT refine it further. "
389390
"You MUST change strategy: (1) verify your edits reach the executed code (dead-edit axiom), "
390391
"(2) re-read the failure output from scratch without your prior assumptions, and (3) pick a "
391-
"different component or layer to investigate. State your new hypothesis via report_progress "
392+
"different component or layer to investigate. State your new hypothesis explicitly "
392393
"before editing anything."
393394
)
394395

‎render_machine/actions/prepare_testing_environment.py‎

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66
from render_machine.render_context import RenderContext
77
from render_machine.render_types import RenderError
88

9+
UNRECOVERABLE_ERROR_EXIT_CODES = [69]
10+
911

1012
class PrepareTestingEnvironment(BaseAction):
1113
SUCCESSFUL_OUTCOME = "testing_environment_prepared"
1214
FAILED_OUTCOME = "testing_environment_preparation_failed"
15+
UNRECOVERABLE_ERROR_OUTCOME = "testing_environment_unrecoverable_error"
1316

1417
def execute(self, render_context: RenderContext, _previous_action_payload: Any | None):
1518
if (
@@ -21,34 +24,48 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any |
2124
console.info(
2225
f"Running testing environment preparation script {render_context.prepare_environment_script} for build folder {render_context.build_folder}."
2326
)
24-
exit_code, _, preparation_temp_file_path = render_utils.execute_script(
27+
exit_code, preparation_issue, preparation_temp_file_path = render_utils.execute_script(
2528
render_context.prepare_environment_script,
2629
[render_context.build_folder],
2730
"Testing Environment Preparation",
2831
timeout=render_context.test_script_timeout,
2932
stop_event=render_context.stop_event,
3033
)
3134

32-
render_context.conformance_tests_running_context.should_prepare_testing_environment = False
3335
render_context.script_execution_history.latest_testing_environment_output_path = preparation_temp_file_path
3436
render_context.script_execution_history.should_update_script_outputs = True
3537

36-
# Store test output file path in conformance tests context for agents to access
37-
# render_context.conformance_tests_running_context.test_output_file_path = preparation_temp_file_path
38-
3938
if exit_code == 0:
39+
render_context.conformance_tests_running_context.should_prepare_testing_environment = False
4040
return self.SUCCESSFUL_OUTCOME, None
41-
else:
42-
error_message = "Testing environment preparation failed. Please check the preparation script."
43-
if preparation_temp_file_path:
44-
error_message += f" Full output available at: {preparation_temp_file_path}"
41+
42+
if exit_code in UNRECOVERABLE_ERROR_EXIT_CODES:
43+
console.error(preparation_issue)
4544
return (
46-
self.FAILED_OUTCOME,
45+
self.UNRECOVERABLE_ERROR_OUTCOME,
4746
RenderError.encode(
48-
message=error_message,
47+
message="Testing environment preparation failed due to problems in the environment setup. Please check your environment or update the preparation script.",
4948
error_type="ENVIRONMENT_ERROR",
5049
exit_code=exit_code,
5150
script=render_context.prepare_environment_script,
52-
output_file=preparation_temp_file_path,
51+
issue=preparation_issue,
5352
).to_payload(),
5453
)
54+
55+
# A failed preparation (typically a build/compile error introduced by the
56+
# latest code changes) is handled like a failing conformance test: the fix
57+
# loop gets the preparation output and corrects the code. The flag stays
58+
# armed so the preparation re-runs after the fix is applied.
59+
error_message = "Testing environment preparation failed."
60+
if preparation_temp_file_path:
61+
error_message += f" Full output available at: {preparation_temp_file_path}"
62+
payload = RenderError.encode(
63+
message=error_message,
64+
error_type="ENVIRONMENT_ERROR",
65+
exit_code=exit_code,
66+
script=render_context.prepare_environment_script,
67+
output_file=preparation_temp_file_path,
68+
).to_payload()
69+
# The legacy (non-agent) fixer requires the failure text under this key.
70+
payload["previous_conformance_tests_issue"] = preparation_issue
71+
return self.FAILED_OUTCOME, payload

‎render_machine/state_machine_config.py‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ def get_action_result_triggers_map(self) -> Dict[str, str]:
101101
RenderConformanceTests.SUCCESSFUL_OUTCOME: triggers.MARK_CONFORMANCE_TESTS_READY,
102102
AgentRenderConformanceTests.SUCCESSFUL_OUTCOME: triggers.MARK_CONFORMANCE_TESTS_READY,
103103
PrepareTestingEnvironment.SUCCESSFUL_OUTCOME: triggers.MARK_TESTING_ENVIRONMENT_PREPARED,
104-
PrepareTestingEnvironment.FAILED_OUTCOME: triggers.HANDLE_ERROR,
104+
PrepareTestingEnvironment.FAILED_OUTCOME: triggers.MARK_TESTING_ENVIRONMENT_FAILED,
105+
PrepareTestingEnvironment.UNRECOVERABLE_ERROR_OUTCOME: triggers.HANDLE_ERROR,
105106
RunConformanceTests.SUCCESSFUL_OUTCOME: triggers.MOVE_TO_NEXT_CONFORMANCE_TEST,
106107
RunConformanceTests.FAILED_OUTCOME: triggers.MARK_CONFORMANCE_TESTS_FAILED,
107108
RunConformanceTests.UNRECOVERABLE_ERROR_OUTCOME: triggers.HANDLE_ERROR,
@@ -399,9 +400,19 @@ def get_transitions(self, render_context: RenderContext) -> List[Dict[str, Any]]
399400
"trigger": triggers.MARK_TESTING_ENVIRONMENT_PREPARED,
400401
"dest": f"{States.IMPLEMENTING_FRID.value}_{States.PROCESSING_CONFORMANCE_TESTS.value}_{States.CONFORMANCE_TEST_ENV_PREPARED.value}",
401402
},
403+
# A failed environment preparation (typically a build/compile error) is
404+
# treated like a failing conformance test: route into the fix loop with
405+
# the preparation output instead of failing the render. Covers both the
406+
# first preparation after the tests are generated and the re-preparation
407+
# after a fix is applied.
408+
{
409+
"source": f"{States.IMPLEMENTING_FRID.value}_{States.PROCESSING_CONFORMANCE_TESTS.value}_{States.CONFORMANCE_TEST_GENERATED.value}",
410+
"trigger": triggers.MARK_TESTING_ENVIRONMENT_FAILED,
411+
"dest": f"{States.IMPLEMENTING_FRID.value}_{States.PROCESSING_CONFORMANCE_TESTS.value}_{States.CONFORMANCE_TEST_FAILED.value}",
412+
},
402413
{
403414
"source": f"{States.IMPLEMENTING_FRID.value}_{States.PROCESSING_CONFORMANCE_TESTS.value}_{States.CONFORMANCE_FIX_APPLIED.value}",
404-
"trigger": triggers.HANDLE_ERROR,
415+
"trigger": triggers.MARK_TESTING_ENVIRONMENT_FAILED,
405416
"dest": f"{States.IMPLEMENTING_FRID.value}_{States.PROCESSING_CONFORMANCE_TESTS.value}_{States.CONFORMANCE_TEST_FAILED.value}",
406417
},
407418
# Review APPROVED: tests already pass, so continue the test orchestration

‎render_machine/triggers.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
START_NEW_REFACTORING_ITERATION = "start_new_refactoring_iteration"
2020
MARK_CONFORMANCE_TESTS_READY = "mark_conformance_tests_ready"
2121
MARK_TESTING_ENVIRONMENT_PREPARED = "mark_testing_environment_prepared"
22+
MARK_TESTING_ENVIRONMENT_FAILED = "mark_testing_environment_failed"
2223
MARK_CONFORMANCE_TESTS_FAILED = "mark_conformance_tests_failed"
2324
MOVE_TO_NEXT_CONFORMANCE_TEST = "move_to_next_conformance_test"
2425
MARK_ALL_CONFORMANCE_TESTS_PASSED = "mark_all_conformance_tests_passed"

0 commit comments

Comments
 (0)