codeplain 0.4.3.dev60__py3-none-any.whl → 0.4.3.dev62__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codeplain-0.4.3.dev60.dist-info → codeplain-0.4.3.dev62.dist-info}/METADATA +1 -1
- {codeplain-0.4.3.dev60.dist-info → codeplain-0.4.3.dev62.dist-info}/RECORD +25 -20
- codeplain_REST_api.py +51 -47
- plain2code.py +2 -0
- render_machine/actions/fix_conformance_test.py +347 -145
- render_machine/actions/fix_unit_tests.py +1 -0
- render_machine/actions/prepare_testing_environment.py +89 -15
- render_machine/actions/render_conformance_tests.py +2 -0
- render_machine/actions/run_conformance_tests.py +5 -0
- render_machine/agent_tools.py +414 -83
- render_machine/conformance_fix_conversation.py +409 -0
- render_machine/render_context.py +3 -1
- render_machine/render_types.py +69 -0
- render_machine/render_utils.py +10 -1
- tests/test_agent_tools.py +180 -0
- tests/test_api_client_retries.py +52 -0
- tests/test_background_preparation.py +73 -0
- tests/test_conformance_fix_conversation.py +677 -0
- tests/test_fix_unit_tests_action.py +7 -0
- tests/test_fix_unit_tests_conformance_context.py +8 -106
- tests/test_render_finished_report.py +14 -0
- tests/test_script_timeout_hint.py +24 -0
- {codeplain-0.4.3.dev60.dist-info → codeplain-0.4.3.dev62.dist-info}/WHEEL +0 -0
- {codeplain-0.4.3.dev60.dist-info → codeplain-0.4.3.dev62.dist-info}/entry_points.txt +0 -0
- {codeplain-0.4.3.dev60.dist-info → codeplain-0.4.3.dev62.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
change_detection.py,sha256=Fy1qsfX13NMUFAQEWFhi4OGfswb0a-WDPIBoY1wnArA,5914
|
|
2
|
-
codeplain_REST_api.py,sha256=
|
|
2
|
+
codeplain_REST_api.py,sha256=Dj4QqTWnzIEi_NkRxXbNOmC9nPTWD_n56S2_nrLtEkk,25623
|
|
3
3
|
concept_utils.py,sha256=vzwC0_0HOZtPerDs7qPmjtyPleQNiuQ4CcmCKoIy7EM,141
|
|
4
4
|
conformance_fix_journal.py,sha256=7wL3UOc3BWaUo5MCmiFbb3kIwOQ6iEpdQSyEmedo8Vk,9488
|
|
5
5
|
diff_utils.py,sha256=AjiQlqo5pRos_8hVXZo5yBurl5BzSrTMGrQv4dCtRCg,1198
|
|
@@ -12,7 +12,7 @@ metadata_utils.py,sha256=YO17o7IAma5TT1ZN0pTwrLVr_KxFQ8APv02KqKPpI5k,1641
|
|
|
12
12
|
module_renderer.py,sha256=OvIgAorSxGwrdTZcKy4hdmNgkdJGh6z6-VzzqrTlRHs,6966
|
|
13
13
|
partial_rendering.py,sha256=7rQu0EE1H8JND-uePovdKfiQHGfdQncDyepwup7QBSY,15742
|
|
14
14
|
path_resolution.py,sha256=0tMqU0a1g4DYhTOp7QjLVSEkv_cgasb4NI1mK809dUM,2233
|
|
15
|
-
plain2code.py,sha256=
|
|
15
|
+
plain2code.py,sha256=w0LJhXj8aF7p8aBo4nLNEeXkHSAuvYayVUN71J4OMU8,24183
|
|
16
16
|
plain2code_arguments.py,sha256=tP7OQK0JhccZC7d6PWLmIeXctp-FO48e0tGuJUDq8es,21133
|
|
17
17
|
plain2code_console.py,sha256=YGBONkQtwZUkrjxTKhqcBoRzW0EmSfYHPH8P4_FM60I,6040
|
|
18
18
|
plain2code_events.py,sha256=QnugBgO1baTe4kj2V3LUnkMDzhmksKwPDFuOKfH9g5o,1738
|
|
@@ -37,13 +37,14 @@ config/system_config.yaml,sha256=of5R9vukSohU9AlkGJOcAVQA1UJgxYmDy6islU6iFuE,508
|
|
|
37
37
|
docs/generate_cli.py,sha256=MyzIgjtT7SXURgHLyc7VldccQdILZi9i49xpuqEoJU4,740
|
|
38
38
|
examples/example_hello_world_python/harness_tests/hello_world_display/test_hello_world.py,sha256=dwTowrHiVKKbrDv21v8xJC30Q57AXZkQasdGOO5JsBE,470
|
|
39
39
|
render_machine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
|
-
render_machine/agent_tools.py,sha256=
|
|
40
|
+
render_machine/agent_tools.py,sha256=o_jL6hEaDYRwkrQlUxRd66b5OOSNe2Gi0xMBfk2lc4I,28601
|
|
41
41
|
render_machine/code_renderer.py,sha256=ZmisVQHVtI1rBN1qdywW-H_hNeUzVELkHUdApGReYjY,3795
|
|
42
|
+
render_machine/conformance_fix_conversation.py,sha256=IVRnf4nPSGLG8GjFLDYvLpeuBKhJtntTL_hX2nLnbnk,21329
|
|
42
43
|
render_machine/conformance_tests.py,sha256=PNTCnJNd_xNIhpTPPS8vlx8qws3cTgQSTLdADRab2YM,9617
|
|
43
44
|
render_machine/implementation_code_helpers.py,sha256=Fxm-IInoZjAIZn41_-WXWj7VIYczpW4yH44Gt8CYMAQ,2378
|
|
44
|
-
render_machine/render_context.py,sha256
|
|
45
|
-
render_machine/render_types.py,sha256=
|
|
46
|
-
render_machine/render_utils.py,sha256=
|
|
45
|
+
render_machine/render_context.py,sha256=-eqJCB0pAYZV5VlSrfqsWGclr1hpkBgyJnWSt4s-0ws,30728
|
|
46
|
+
render_machine/render_types.py,sha256=OansFuNG3tuHedK-aeNc05_Id1RYTMX8kbpaR0b9GIQ,15565
|
|
47
|
+
render_machine/render_utils.py,sha256=2yf1vdkELKt4bET6YVKl1kjjp5N0ivgSX6Idb6HL6kg,10185
|
|
47
48
|
render_machine/state_machine_config.py,sha256=0pL4PyrZ5F2UumvHLMRfhyh64M4pDvf-9zEs-5OAEU8,27866
|
|
48
49
|
render_machine/states.py,sha256=Lu-7upbs9_bjJsy0P738qx5IiN0DzVcFdhF2-m6YjnQ,2067
|
|
49
50
|
render_machine/triggers.py,sha256=VekNhHGR-u5JXIboqc_Eyqf73LNH7wezLK7r3WWtodk,1269
|
|
@@ -55,14 +56,14 @@ render_machine/actions/create_dist.py,sha256=ykER7i2OvWAXjrlAZnkQHpiNl00vSMF8WDx
|
|
|
55
56
|
render_machine/actions/distill_conformance_test_memory.py,sha256=54ooMdAc79OrKfWCPsczGNx1zhUng4UNPZLo6j4eMEw,2681
|
|
56
57
|
render_machine/actions/exit_with_error.py,sha256=bw7seapQg5gE5Ag233SJkjnVW4B-JjHPr50XzG0v1P8,1570
|
|
57
58
|
render_machine/actions/finish_functional_requirement.py,sha256=usQgPSg6PHpBOR1RhK7lPz9zjY-2VJJDqi3T0nlqdLw,841
|
|
58
|
-
render_machine/actions/fix_conformance_test.py,sha256=
|
|
59
|
-
render_machine/actions/fix_unit_tests.py,sha256=
|
|
59
|
+
render_machine/actions/fix_conformance_test.py,sha256=JP4ejH4Z-VfpLwYN6bkHGIN-1G8hF8bpLpPOkNvHSNk,23723
|
|
60
|
+
render_machine/actions/fix_unit_tests.py,sha256=D7Bdz9_DkYDdS-FnH-OH2xiPOT7uP4tVzwRru8vMMHI,13769
|
|
60
61
|
render_machine/actions/prepare_repositories.py,sha256=DGDITJ1jDRHWlk48rWDaYVO6T9mbLROoncsAE44VAhs,3933
|
|
61
|
-
render_machine/actions/prepare_testing_environment.py,sha256=
|
|
62
|
+
render_machine/actions/prepare_testing_environment.py,sha256=gfijfe825rGBGZZKSQ8PU0Gdx3sIXyuxhSJy4Bwav74,5431
|
|
62
63
|
render_machine/actions/refactor_code.py,sha256=dlS0iam9bzEeUr2NFuft6TcOv6IOtzdSb1tDQ85vmII,2708
|
|
63
|
-
render_machine/actions/render_conformance_tests.py,sha256=
|
|
64
|
+
render_machine/actions/render_conformance_tests.py,sha256=60J15SP80-Zs15e3fJjUaXn_CgcD-wgcVeO5aP9zg6E,10929
|
|
64
65
|
render_machine/actions/render_functional_requirement.py,sha256=f6UbhmWpaUsbqSni2Vpjf_155kZR1N3Fj5K77dL2xjU,5536
|
|
65
|
-
render_machine/actions/run_conformance_tests.py,sha256=
|
|
66
|
+
render_machine/actions/run_conformance_tests.py,sha256=uNZ8fyBjTxtCpjdKu3KKH84ecefvM5_J05raJdKGIHk,4112
|
|
66
67
|
render_machine/actions/run_unit_tests.py,sha256=j0qsHMLy49I_DX5QLlH0OdPT6bPMc0icmVg2N5MYm9U,2711
|
|
67
68
|
render_machine/actions/summarize_conformance_tests.py,sha256=5TdhZ9Mt96WAlFtJAju3iQ9fXFwHcR48Wwe9XyddTIU,1681
|
|
68
69
|
standard_template_library/golang-console-app-template.plain,sha256=JOusEjCj7jagnXUzaI-SdIr3hj1wTo2uShK017aNtVM,949
|
|
@@ -73,10 +74,13 @@ tests/__init__.py,sha256=Wk73Io62J15BtlLVIzxmASDWaaJkQLevS4BLK5LDAQg,16
|
|
|
73
74
|
tests/conftest.py,sha256=QZcp08htUlJGgmHDlRWFgsWXZ8o8IBWTD5QqJaUMlU8,790
|
|
74
75
|
tests/test_acceptance_scenario_rendered_once.py,sha256=R5LE_9e9yrvhGvLuAxsINiiFrzrAvMZzwlogMyyEk5s,7098
|
|
75
76
|
tests/test_acceptance_scenarios_after_a_code_fix.py,sha256=MHJltqgPsZV9UY3sdPLsMNrbMjIAXwB9CreWa6n1orA,4676
|
|
76
|
-
tests/test_agent_tools.py,sha256=
|
|
77
|
+
tests/test_agent_tools.py,sha256=T5g-jaXgKF6XHUkaDJ9vPaz4XRj7TL827ptwygoKROY,16478
|
|
78
|
+
tests/test_api_client_retries.py,sha256=u_15vmK9mBFunwuesqU7BJ_drTnH1tU7KYl5Az7ShA4,1611
|
|
77
79
|
tests/test_arg_provenance.py,sha256=kUqTcaCxMgbwY0-k_aHf40X1TN-5p7DhLHYrfcgX9N0,4252
|
|
80
|
+
tests/test_background_preparation.py,sha256=xZgYy2KFzNJJo48qsI5PufJQ51_avC15kkOWZoUElJA,3126
|
|
78
81
|
tests/test_change_detection.py,sha256=jGSBuMFHFiZxe14kB6PucH3Aw0dh5RsKpvQgxhmUdEo,14413
|
|
79
82
|
tests/test_cli_output.py,sha256=9yTk0pD2w6vkiSdSkYwneUmEtNqX4x64F6PzYShUEcw,19331
|
|
83
|
+
tests/test_conformance_fix_conversation.py,sha256=Q1eCUZnSQgEF_mXmSnHGelDX5bfuz9NawfikjbmsEZA,32570
|
|
80
84
|
tests/test_conformance_fix_journal.py,sha256=6IDSMKTSRLB-iWb6jzGvG3TwJomzg0S0SlyG4IbAZdg,10729
|
|
81
85
|
tests/test_console_log_styles.py,sha256=sxlhynMAP-kmqhBn1-pKvZXdCnlKSyCGJqwYKrh6sQ0,6468
|
|
82
86
|
tests/test_dependency_pins.py,sha256=D_c5sb7ikwuV4zy8trB0DDzwNLkhAX221X67atLA-ec,1864
|
|
@@ -84,8 +88,8 @@ tests/test_distill_conformance_test_memory.py,sha256=6hmrzbL-1Yf7O2JgEFWi6GR-43M
|
|
|
84
88
|
tests/test_dry_run_link_validation.py,sha256=0Ca7v4DHMPBVmmBLWr2AHk4xVHzdOS2PHiPdumgpWkM,2154
|
|
85
89
|
tests/test_exit_when_done.py,sha256=eQeAjZaScqw93liajuYZ1XAIhZX-NpjWMeBXKSazedU,5594
|
|
86
90
|
tests/test_file_utils.py,sha256=RPab1wBsbE7XAPGync56WveFVnRvafFVRia1a2mMQhk,4490
|
|
87
|
-
tests/test_fix_unit_tests_action.py,sha256=
|
|
88
|
-
tests/test_fix_unit_tests_conformance_context.py,sha256=
|
|
91
|
+
tests/test_fix_unit_tests_action.py,sha256=HyMxzGPJRn5CW9wF7o-1k0c75dnh3bMzVYLg21MSzAQ,11703
|
|
92
|
+
tests/test_fix_unit_tests_conformance_context.py,sha256=rUm8G47NKTr-A_CmwSaz1fshDo3yjgPef07ZCIPxZdE,9354
|
|
89
93
|
tests/test_folder_path_resolution.py,sha256=K9v684xkPE0HOAsovg8uDixpZmaIk7ho-Wd3rTjKLF0,6560
|
|
90
94
|
tests/test_frid_arguments.py,sha256=zIEU2HGgJU4YOY2DXkjO9MmTlIUk4Iu5dfEU9OwKbak,1264
|
|
91
95
|
tests/test_functionality_position.py,sha256=QQdhIqZhRC8-30xKZPyOye6dm8kSkJnja4PB53iZkeE,3540
|
|
@@ -102,11 +106,12 @@ tests/test_plain2code_state.py,sha256=O-sDt4F_lF6XtanWKWfh5IsNmDdfuJP_JoGagujzdf
|
|
|
102
106
|
tests/test_plain2code_utils.py,sha256=MXAYsWMY_7Vb4im2ZJK46Gsq1ApIjuGkQAEmUz0ISOY,1665
|
|
103
107
|
tests/test_plain_modules.py,sha256=fc7__5jSfr6CLh92IQDUdkOS9qkS1XRFmGXPj76v4Xs,33698
|
|
104
108
|
tests/test_prepare_repositories_layout.py,sha256=PhJQLnHfjfjo6CTWoicyEKgL0_GtjwB2OKYAWSBVHtk,14638
|
|
105
|
-
tests/test_render_finished_report.py,sha256=
|
|
109
|
+
tests/test_render_finished_report.py,sha256=FmuntIaGGIebUZUnvMQ0nmRHiSVIG3n5WsXRAzEgo90,9944
|
|
106
110
|
tests/test_render_range.py,sha256=N4XS6zQbQmDlQmUvl6vhqLL7VcczET65GG1DWypP-k0,1832
|
|
107
111
|
tests/test_render_stop_reason.py,sha256=38PhTWPf-Yal8EPcH9h5BRHwVXz56roWseH4sDBQFcY,8608
|
|
108
112
|
tests/test_resolve_config_file.py,sha256=b87tDOvyzbsnE-QRWbZ97ou7NuyaAgskv-dbYBum31c,2830
|
|
109
113
|
tests/test_script_path_resolution.py,sha256=tiEqMevQRXr9YpfHN0xldOOQpLAUgnSqTzeZWkKHaUY,4156
|
|
114
|
+
tests/test_script_timeout_hint.py,sha256=RkSdzPM0tnTcScs5WXNa_vKbJPJF3-QAR0Y0AhUb-1g,905
|
|
110
115
|
tests/test_system_config.py,sha256=gH5qs9q4lh5CljAdz28HUrJzuKqCvkZherFuv7enMak,2787
|
|
111
116
|
tests/test_telemetry.py,sha256=lRm-Z7g2-33CFEkTJHLSUsOpltSnD47gyUoPCRD9SHQ,8153
|
|
112
117
|
tests/test_terminal_attachment.py,sha256=-yssQKLfE-PcOnBIoNJjjXISqjjZvePb74ZwW_TvJJ4,10533
|
|
@@ -128,8 +133,8 @@ tui/spinner.py,sha256=Ro6Gd9Przf-whuHqPRY6HwI0T57yJjyNPbhDbigZKZE,2471
|
|
|
128
133
|
tui/state_handlers.py,sha256=5FkF13mCLYAOgpYnzR932U3tYxSnMkCu5jybMFEBVe4,16264
|
|
129
134
|
tui/styles.css,sha256=kiC7Og_2G1E7owoiZgV95-3_dSeQnsNj3qzaY04xkDg,6727
|
|
130
135
|
tui/widget_helpers.py,sha256=jitm2WHiKj-NVFL-hULxWzckPreRbUTl9OIZLN31-ek,6997
|
|
131
|
-
codeplain-0.4.3.
|
|
132
|
-
codeplain-0.4.3.
|
|
133
|
-
codeplain-0.4.3.
|
|
134
|
-
codeplain-0.4.3.
|
|
135
|
-
codeplain-0.4.3.
|
|
136
|
+
codeplain-0.4.3.dev62.dist-info/METADATA,sha256=Bqkn5dUCEOHmdu9_kVb_0GrCb2WepcTN_8qxfO9ythE,7260
|
|
137
|
+
codeplain-0.4.3.dev62.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
138
|
+
codeplain-0.4.3.dev62.dist-info/entry_points.txt,sha256=oDZkBqu9WhtZApb_K6ia8-fn9aojwmAsgnKELceX5T4,46
|
|
139
|
+
codeplain-0.4.3.dev62.dist-info/licenses/LICENSE,sha256=pCeKgQ1mXE5OmNUuKOfOZh1T1vqkeCUxghE7N8qgnzc,11345
|
|
140
|
+
codeplain-0.4.3.dev62.dist-info/RECORD,,
|
codeplain_REST_api.py
CHANGED
|
@@ -13,6 +13,10 @@ from plain2code_state import RunState
|
|
|
13
13
|
|
|
14
14
|
MAX_RETRIES = 4
|
|
15
15
|
RETRY_DELAY = 3
|
|
16
|
+
# Agent calls carry a whole session: losing one ends a long-running fix, so they retry longer (with the delay
|
|
17
|
+
# capped), which rides out a provider or network outage of several minutes.
|
|
18
|
+
AGENT_MAX_RETRIES = 8
|
|
19
|
+
MAX_RETRY_DELAY = 60
|
|
16
20
|
|
|
17
21
|
# A report the render does not consume must not be able to hold the process open
|
|
18
22
|
# at exit, and requests waits indefinitely by default.
|
|
@@ -86,6 +90,18 @@ ERROR_CODE_EXCEPTIONS = {
|
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
|
|
93
|
+
# Client errors that a retry can fix: a timeout on the server's side and rate limiting.
|
|
94
|
+
RETRYABLE_CLIENT_ERROR_STATUSES = {408, 429}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def _is_permanent_client_error(error: Exception) -> bool:
|
|
98
|
+
"""An HTTP 4xx answer other than RETRYABLE_CLIENT_ERROR_STATUSES: asking again gets the same answer."""
|
|
99
|
+
if not isinstance(error, requests.exceptions.HTTPError) or error.response is None:
|
|
100
|
+
return False
|
|
101
|
+
status = error.response.status_code
|
|
102
|
+
return 400 <= status < 500 and status not in RETRYABLE_CLIENT_ERROR_STATUSES
|
|
103
|
+
|
|
104
|
+
|
|
89
105
|
class CodeplainAPI:
|
|
90
106
|
|
|
91
107
|
def __init__(self, api_key, console):
|
|
@@ -135,7 +151,7 @@ class CodeplainAPI:
|
|
|
135
151
|
)
|
|
136
152
|
time.sleep(retry_delay)
|
|
137
153
|
# Exponential backoff
|
|
138
|
-
return retry_delay * 2
|
|
154
|
+
return min(retry_delay * 2, MAX_RETRY_DELAY)
|
|
139
155
|
else:
|
|
140
156
|
if not silent:
|
|
141
157
|
self.console.error(f"Max retries ({num_retries}) exceeded. Last error: {error}")
|
|
@@ -214,6 +230,10 @@ class CodeplainAPI:
|
|
|
214
230
|
if response_json is not None and "error_code" in response_json:
|
|
215
231
|
if response_json["error_code"] not in RETRY_ERROR_CODES:
|
|
216
232
|
raise e
|
|
233
|
+
if _is_permanent_client_error(e):
|
|
234
|
+
# Asking again gets the same answer (e.g. an expired agent session is 404): the caller gets the
|
|
235
|
+
# HTTPError itself, right away, to handle it.
|
|
236
|
+
raise e
|
|
217
237
|
|
|
218
238
|
retry_delay = self._handle_retry_logic(attempt, retry_delay, num_retries, e, silent)
|
|
219
239
|
|
|
@@ -405,50 +425,6 @@ class CodeplainAPI:
|
|
|
405
425
|
|
|
406
426
|
return self.post_request(endpoint_url, headers, payload, run_state)
|
|
407
427
|
|
|
408
|
-
def fix_conformance_tests_issue(
|
|
409
|
-
self,
|
|
410
|
-
frid,
|
|
411
|
-
functional_requirement_id,
|
|
412
|
-
plain_source_tree,
|
|
413
|
-
linked_resources,
|
|
414
|
-
existing_files_content,
|
|
415
|
-
memory_files_content,
|
|
416
|
-
module_name: str,
|
|
417
|
-
conformance_tests_module_name: str,
|
|
418
|
-
required_modules,
|
|
419
|
-
code_diff,
|
|
420
|
-
conformance_tests_files,
|
|
421
|
-
conformance_tests_issue,
|
|
422
|
-
implementation_fix_count,
|
|
423
|
-
conformance_tests_folder_name,
|
|
424
|
-
conflicting_requirements_count: int,
|
|
425
|
-
fix_attempts_journal: list,
|
|
426
|
-
run_state: RunState,
|
|
427
|
-
):
|
|
428
|
-
endpoint_url = f"{self.api_url}/fix_conformance_tests_issue"
|
|
429
|
-
headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}
|
|
430
|
-
|
|
431
|
-
payload = {
|
|
432
|
-
"frid": frid,
|
|
433
|
-
"functional_requirement_id": functional_requirement_id,
|
|
434
|
-
"plain_source_tree": plain_source_tree,
|
|
435
|
-
"linked_resources": linked_resources,
|
|
436
|
-
"existing_files_content": existing_files_content,
|
|
437
|
-
"memory_files_content": memory_files_content,
|
|
438
|
-
"module_name": module_name,
|
|
439
|
-
"conformance_tests_module_name": conformance_tests_module_name,
|
|
440
|
-
"required_modules": required_modules,
|
|
441
|
-
"code_diff": code_diff,
|
|
442
|
-
"conformance_tests_files": conformance_tests_files,
|
|
443
|
-
"conformance_tests_issue": conformance_tests_issue,
|
|
444
|
-
"implementation_fix_count": implementation_fix_count,
|
|
445
|
-
"conformance_tests_folder_name": conformance_tests_folder_name,
|
|
446
|
-
"conflicting_requirements_count": conflicting_requirements_count,
|
|
447
|
-
"fix_attempts_journal": fix_attempts_journal,
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
return self.post_request(endpoint_url, headers, payload, run_state)
|
|
451
|
-
|
|
452
428
|
def render_acceptance_tests(
|
|
453
429
|
self,
|
|
454
430
|
frid,
|
|
@@ -577,6 +553,34 @@ class CodeplainAPI:
|
|
|
577
553
|
|
|
578
554
|
return self.post_request(endpoint_url, headers, payload, run_state)
|
|
579
555
|
|
|
556
|
+
def report_conflicting_requirements(
|
|
557
|
+
self,
|
|
558
|
+
frid: str,
|
|
559
|
+
functional_requirement_id: str,
|
|
560
|
+
plain_source_tree: dict,
|
|
561
|
+
module_name: str,
|
|
562
|
+
conformance_tests_module_name: str,
|
|
563
|
+
required_modules,
|
|
564
|
+
failing_reason: str,
|
|
565
|
+
conflict_reason: str,
|
|
566
|
+
run_state: RunState,
|
|
567
|
+
):
|
|
568
|
+
"""Report a conflict the conformance tests fixer and its reviewer agreed on after it had been declared
|
|
569
|
+
once. The server always answers with the ConflictingRequirements error, raised here, ending the render."""
|
|
570
|
+
endpoint_url = f"{self.api_url}/report_conflicting_requirements"
|
|
571
|
+
headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}
|
|
572
|
+
payload = {
|
|
573
|
+
"frid": frid,
|
|
574
|
+
"functional_requirement_id": functional_requirement_id,
|
|
575
|
+
"plain_source_tree": plain_source_tree,
|
|
576
|
+
"module_name": module_name,
|
|
577
|
+
"conformance_tests_module_name": conformance_tests_module_name,
|
|
578
|
+
"required_modules": required_modules,
|
|
579
|
+
"failing_reason": failing_reason,
|
|
580
|
+
"conflict_reason": conflict_reason,
|
|
581
|
+
}
|
|
582
|
+
return self.post_request(endpoint_url, headers, payload, run_state)
|
|
583
|
+
|
|
580
584
|
def agent_start(self, task_type: str, task_params: dict, frid: str, module_name: str, run_state: RunState):
|
|
581
585
|
"""Start a server-side agent session; returns the first turn (tool calls or completion)."""
|
|
582
586
|
endpoint_url = f"{self.api_url}/agent/start"
|
|
@@ -587,7 +591,7 @@ class CodeplainAPI:
|
|
|
587
591
|
"frid": frid,
|
|
588
592
|
"module_name": module_name,
|
|
589
593
|
}
|
|
590
|
-
return self.post_request(endpoint_url, headers, payload, run_state)
|
|
594
|
+
return self.post_request(endpoint_url, headers, payload, run_state, num_retries=AGENT_MAX_RETRIES)
|
|
591
595
|
|
|
592
596
|
def agent_continue(
|
|
593
597
|
self, session_id: str, tool_results: list[dict], frid: str, module_name: str, run_state: RunState
|
|
@@ -601,4 +605,4 @@ class CodeplainAPI:
|
|
|
601
605
|
"frid": frid,
|
|
602
606
|
"module_name": module_name,
|
|
603
607
|
}
|
|
604
|
-
return self.post_request(endpoint_url, headers, payload, run_state)
|
|
608
|
+
return self.post_request(endpoint_url, headers, payload, run_state, num_retries=AGENT_MAX_RETRIES)
|
plain2code.py
CHANGED
|
@@ -581,6 +581,8 @@ def main(): # noqa: C901
|
|
|
581
581
|
interrupted = True
|
|
582
582
|
else:
|
|
583
583
|
error_message = user_error_message(e)
|
|
584
|
+
# A module that finished before the error set render_succeeded; the render as a whole did not.
|
|
585
|
+
run_state.set_render_succeeded(False)
|
|
584
586
|
|
|
585
587
|
if not isinstance(e, EXPECTED_EXCEPTIONS):
|
|
586
588
|
exc_info = sys.exc_info()
|