refactor: add run_ret_code method and update run method to use it (#623)

* refactor: Add run_ret_code method and update run method to use it

* feat: Add kwargs support to run methods and test for run_ret_code

* fix: preserve exit code after chmod in DockerEnv entry command

* chore: Change file permissions from 755 to 644 in env_tpl directory

* refactor: Return execution code and update evaluator logic

* lint

* refactor: Use MappingProxyType for running_extra_volume in DockerEnv methods

* lint
This commit is contained in:
you-n-g
2025-02-20 00:42:10 +08:00
committed by GitHub
parent 0bd8366254
commit dff89d2950
4 changed files with 120 additions and 54 deletions
@@ -63,7 +63,9 @@ class EnsembleCoSTEEREvaluator(CoSTEEREvaluator):
)
implementation.inject_files(**{fname: test_code})
stdout = implementation.execute(env=de, entry=f"python {fname}")
stdout, ret_code = implementation.execute_ret_code(env=de, entry=f"python {fname}")
stdout += f"\nNOTE: the above scripts run with return code {ret_code}"
if "main.py" in implementation.file_dict:
workflow_stdout = implementation.execute(env=de, entry="python main.py")
@@ -81,6 +83,6 @@ class EnsembleCoSTEEREvaluator(CoSTEEREvaluator):
stdout=stdout,
workflow_stdout=workflow_stdout,
)
return build_cls_from_json_with_retry(
EnsembleEvalFeedback, system_prompt=system_prompt, user_prompt=user_prompt
)
efb = build_cls_from_json_with_retry(EnsembleEvalFeedback, system_prompt=system_prompt, user_prompt=user_prompt)
efb.final_decision = efb.final_decision and ret_code == 0
return efb